quick Add
This commit is contained in:
parent
c3bc769fa9
commit
dd502de48b
@ -427,16 +427,30 @@ class Sales extends BaseController
|
|||||||
public function save_vehicle(){
|
public function save_vehicle(){
|
||||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($this->request->getPost('formType') == 'create')
|
if($this->request->getPost('formType') == 'create')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$client['client_name'] = $this->request->getPost('createclientName');
|
$client['client_name'] = $this->request->getPost('createclientName');
|
||||||
$client['mobile_no'] = $this->request->getPost('createclientMobile');
|
$client['mobile_no'] = $this->request->getPost('createclientMobile');
|
||||||
$client['client_type'] = $this->request->getPost('createclientType');
|
$client['client_type'] = $this->request->getPost('createclientType');
|
||||||
$client['branch_id'] = $this->session->get('logged_user_branch_id');
|
$client['branch_id'] = $this->session->get('logged_user_branch_id');
|
||||||
|
$client['isactive'] = 1;
|
||||||
|
$client['created_by'] = (int)$this->session->get('logged_user');
|
||||||
|
$existingClient1 = $this->ClientModel->where('client_name', $client['client_name'])->first();
|
||||||
|
if ($existingClient1) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'success' => true, 'code' => 404,'field'=>'create-clientName',
|
||||||
|
'message' => 'The client name is already registered. Please use a different Name.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$existingClient2 = $this->ClientModel->where('mobile_no', $client['mobile_no'])->first();
|
||||||
|
if ($existingClient2) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'success' => true,'code' => 404,'field'=>'create-clientMobile',
|
||||||
|
'message' => 'The mobile number is already registered. Please use a different number.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$client_id = $this->ClientModel->insert($client);
|
$client_id = $this->ClientModel->insert($client);
|
||||||
|
|
||||||
@ -451,7 +465,8 @@ class Sales extends BaseController
|
|||||||
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
||||||
'city'=>'Chennai',
|
'city'=>'Chennai',
|
||||||
'state'=>'Tamil Nadu',
|
'state'=>'Tamil Nadu',
|
||||||
'isactive' => 1
|
'isactive' => 1,
|
||||||
|
'created_by' => (int)$this->session->get('logged_user')
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -468,25 +483,22 @@ class Sales extends BaseController
|
|||||||
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
||||||
'city'=>'Chennai',
|
'city'=>'Chennai',
|
||||||
'state'=>'Tamil Nadu',
|
'state'=>'Tamil Nadu',
|
||||||
'isactive' => 1
|
'isactive' => 1,
|
||||||
|
'created_by' => (int)$this->session->get('logged_user')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Attempt to insert the client data
|
// Attempt to insert the client data
|
||||||
$id = $this->VehicleModel->insert($data);
|
$id = $this->VehicleModel->insert($data);
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$vehicleData = $this->VehicleModel->where('vehicle_id',$id)->first();
|
$vehicleData = $this->VehicleModel->where('vehicle_id',$id)->first();
|
||||||
|
|
||||||
// If insertion succeeds, return success response
|
// If insertion succeeds, return success response
|
||||||
return $this->response->setJSON(['success' => true, 'message' => 'Client saved successfully.','vehicleData'=>$vehicleData, 'vehicle_id' => $id]);
|
return $this->response->setJSON(['success' => true,'code' => 200, 'message' => 'Client saved successfully.','vehicleData'=>$vehicleData, 'vehicle_id' => $id]);
|
||||||
} else {
|
} else {
|
||||||
// If insertion fails, return error response
|
// If insertion fails, return error response
|
||||||
return $this->response->setJSON(['success' => false, 'message' => 'Failed to save client.']);
|
return $this->response->setJSON(['success' => false, 'code' => 404,'message' => 'Failed to save client.']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class Vendor extends BaseController
|
|||||||
'address' => $this->request->getPost('address'),
|
'address' => $this->request->getPost('address'),
|
||||||
'city' => $this->request->getPost('city'),
|
'city' => $this->request->getPost('city'),
|
||||||
'state' => $this->request->getPost('state'),
|
'state' => $this->request->getPost('state'),
|
||||||
'postal_code' => $this->request->getPost('postalcode'),
|
'postal_code' => $this->request->getPost('postalcode') != '' ? $this->request->getPost('postalcode') : NULL,
|
||||||
'country' => $this->request->getPost('country'),
|
'country' => $this->request->getPost('country'),
|
||||||
'vendortype' => $this->request->getPost('vendortype'),
|
'vendortype' => $this->request->getPost('vendortype'),
|
||||||
'category' => $this->request->getPost('category'),
|
'category' => $this->request->getPost('category'),
|
||||||
|
|||||||
@ -88,7 +88,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="inputEmail4" class="col-form-label">Vehicle<span class="text-danger">*</span></label>
|
<label for="inputEmail4" class="col-form-label">Vehicle<span class="text-danger">*</span></label>
|
||||||
<?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Client"></i>' ?>
|
<?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Vehicle"></i>' ?>
|
||||||
|
|
||||||
<select class="form-control vehicle-select SelExample job_card_basic_details" name="vehicle_id" id="vehicle_name" <?= isset($sales['vehicle_id']) ? 'readonly' : 'required="true"' ?>>
|
<select class="form-control vehicle-select SelExample job_card_basic_details" name="vehicle_id" id="vehicle_name" <?= isset($sales['vehicle_id']) ? 'readonly' : 'required="true"' ?>>
|
||||||
|
|
||||||
@ -166,7 +166,7 @@
|
|||||||
<input type="date" class="form-control job_card_basic_details" name="delivery_date" placeholder="Delivery Date" value="<?= isset($jobs['delivery_date']) ? $jobs['delivery_date'] : '' ?>">
|
<input type="date" class="form-control job_card_basic_details" name="delivery_date" placeholder="Delivery Date" value="<?= isset($jobs['delivery_date']) ? $jobs['delivery_date'] : '' ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span>(<?php echo isset($jobs['status']) ? $jobs['status'] : '' ?>)</label>
|
<label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span><?php echo isset($jobs['status']) ? '( '.$jobs['status'].' )' : '' ?></label>
|
||||||
<select class="form-control status-select status_class_for_change" name="status" required data-toggle="select2">
|
<select class="form-control status-select status_class_for_change" name="status" required data-toggle="select2">
|
||||||
<?php if (isset($jobs['status'])): ?>
|
<?php if (isset($jobs['status'])): ?>
|
||||||
<?php if ($jobs['status'] === 'Cancelled'): ?>
|
<?php if ($jobs['status'] === 'Cancelled'): ?>
|
||||||
@ -2174,6 +2174,9 @@ $(document).ready(function() {
|
|||||||
var ifStatementCondition = "createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
|
var ifStatementCondition = "createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const button = $('#saveVehcileBtn');
|
||||||
|
button.prop('disabled', true).text('Processing...');
|
||||||
|
|
||||||
if(createclientMobile) {
|
if(createclientMobile) {
|
||||||
var clientArray = <?php echo json_encode($client) ?>;
|
var clientArray = <?php echo json_encode($client) ?>;
|
||||||
console.log(clientArray);
|
console.log(clientArray);
|
||||||
@ -2183,11 +2186,11 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
if(mobileIdExists) {
|
if(mobileIdExists) {
|
||||||
toastr.warning("Mobile Number Already Added!");
|
toastr.warning("Mobile Number Already Added!");
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reg_no) {
|
if (reg_no) {
|
||||||
$('#saveVehcileBtn').prop('disabled', true);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for fetching models
|
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for fetching models
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -2198,7 +2201,7 @@ $(document).ready(function() {
|
|||||||
if (response) {
|
if (response) {
|
||||||
$('#reg_no').val("");
|
$('#reg_no').val("");
|
||||||
toastr.warning("Register Number Already Added!");
|
toastr.warning("Register Number Already Added!");
|
||||||
$('#saveVehcileBtn').prop('disabled', false);
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}else{
|
}else{
|
||||||
if( eval(ifStatementCondition) ){
|
if( eval(ifStatementCondition) ){
|
||||||
|
|
||||||
@ -2218,25 +2221,29 @@ $(document).ready(function() {
|
|||||||
formType:formType,
|
formType:formType,
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.success) {
|
if (response.success && response.code == 200 ) {
|
||||||
$('#addVehicleModal').modal('hide');
|
|
||||||
toastr.success("Vehicle saved successfully!");
|
toastr.success("Vehicle saved successfully!");
|
||||||
localStorage.setItem('vehicle_id',response.vehicle_id)
|
localStorage.setItem('vehicle_id',response.vehicle_id);
|
||||||
|
$('#addVehicleModal').modal('hide');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
}else if (response.success && response.code == 404 ) {
|
||||||
|
$('#'+response.field).val("");
|
||||||
|
toastr.warning(response.message);
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
|
}else {
|
||||||
toastr.warning("Failed to save vehicle. Please try again");
|
toastr.warning("Failed to save vehicle. Please try again");
|
||||||
$('#saveVehcileBtn').prop('disabled', false);
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('Error occurred while saving vehicle:', error);
|
console.error('Error occurred while saving vehicle:', error);
|
||||||
toastr.warning("Failed to save vehicle. Please try again");
|
toastr.warning("Failed to save vehicle. Please try again");
|
||||||
$('#saveVehcileBtn').prop('disabled', false);
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
toastr.warning("Please Fill All Data");
|
toastr.warning("Please Fill All Data");
|
||||||
$('#saveVehcileBtn').prop('disabled', false);
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-center">
|
<div class="form-group text-center">
|
||||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitproductcategory(this)">Submit</button>
|
<button class="btn btn-rounded btn-primary" type="submit" id="pcBtn" onclick="submitproductcategory(this)">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- </form> -->
|
<!-- </form> -->
|
||||||
@ -111,11 +111,13 @@
|
|||||||
function submitproductcategory(params) {
|
function submitproductcategory(params) {
|
||||||
// Get the value of the Product Category Name input field
|
// Get the value of the Product Category Name input field
|
||||||
var productcategoryname = $('#product_category_name').val().trim();
|
var productcategoryname = $('#product_category_name').val().trim();
|
||||||
|
const pcButton = $('#pcBtn');
|
||||||
|
pcButton.prop('disabled', true).text('Processing...');
|
||||||
// Check if Product Category Name is empty
|
// Check if Product Category Name is empty
|
||||||
if (productcategoryname === '') {
|
if (productcategoryname === '') {
|
||||||
// Display error message
|
// Display error message
|
||||||
toastr.error('Please enter a Product Category Name.', 'Error');
|
toastr.error('Please enter a Product Category Name.', 'Error');
|
||||||
|
pcButton.prop('disabled', false).text('Submit');
|
||||||
return; // Stop further execution of the function
|
return; // Stop further execution of the function
|
||||||
}
|
}
|
||||||
var formData = {
|
var formData = {
|
||||||
@ -135,6 +137,7 @@
|
|||||||
console.log(response);
|
console.log(response);
|
||||||
if (response.status == "failed") {
|
if (response.status == "failed") {
|
||||||
toastr.warning(response.data, 'Warning');
|
toastr.warning(response.data, 'Warning');
|
||||||
|
pcButton.prop('disabled', false).text('Submit');
|
||||||
}else{
|
}else{
|
||||||
$('#product_category_modal').modal('hide');
|
$('#product_category_modal').modal('hide');
|
||||||
$('#product_category_name').val('');
|
$('#product_category_name').val('');
|
||||||
@ -147,6 +150,7 @@
|
|||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response here
|
// Handle error response here
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
pcButton.prop('disabled', false).text('Submit');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
|
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
|
||||||
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
|
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Make"></i>' ?>
|
||||||
<select class="form-control SelExample" id="make" name="make[]" required multiple>
|
<select class="form-control SelExample" id="make" name="make[]" required multiple>
|
||||||
<option value="">Select a Make</option>
|
<option value="">Select a Make</option>
|
||||||
<!-- Options for make -->
|
<!-- Options for make -->
|
||||||
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
|
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||||
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>'; ?>
|
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Modal"></i>'; ?>
|
||||||
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
||||||
<!-- Options for model will be populated dynamically via AJAX -->
|
<!-- Options for model will be populated dynamically via AJAX -->
|
||||||
<?php if(isset($models) && !empty($models)): ?>
|
<?php if(isset($models) && !empty($models)): ?>
|
||||||
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="manufacturer" class="col-form-label">Manufacturer<span class="text-danger">*</span></label>
|
<label for="manufacturer" class="col-form-label">Manufacturer<span class="text-danger">*</span></label>
|
||||||
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addManufacturerButton" style="font-size: 18px;" data-toggle="modal" data-target="#manufacturer_login-modal" title="Add Client"></i>' ?>
|
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addManufacturerButton" style="font-size: 18px;" data-toggle="modal" data-target="#manufacturer_login-modal" title="Add Manufacturer"></i>' ?>
|
||||||
<select class="form-control SelExample" id="manufacturer" name="manufacturer" required>
|
<select class="form-control SelExample" id="manufacturer" name="manufacturer" required>
|
||||||
<option value="">Select a Manufacturer</option>
|
<option value="">Select a Manufacturer</option>
|
||||||
<?php foreach ($manufacturers as $value): ?>
|
<?php foreach ($manufacturers as $value): ?>
|
||||||
@ -380,7 +380,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-center">
|
<div class="form-group text-center">
|
||||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitManufacturers(this)">Submit</button>
|
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitManufacturers(this)" id="saveManufacturersBtn">Save Manufacturers</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -680,7 +680,8 @@ $(document).ready(function() {
|
|||||||
$('#saveMakeBtn').click(function() {
|
$('#saveMakeBtn').click(function() {
|
||||||
var make = $('#makes').val();
|
var make = $('#makes').val();
|
||||||
var model = $('#models').val();
|
var model = $('#models').val();
|
||||||
|
const button = $('#saveMakeBtn');
|
||||||
|
button.prop('disabled', true).text('Processing...');
|
||||||
if (make != '' && model != '') {
|
if (make != '' && model != '') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url().'save_make'?>',
|
url: '<?php echo base_url().'save_make'?>',
|
||||||
@ -698,15 +699,18 @@ $('#saveMakeBtn').click(function() {
|
|||||||
} else {
|
} else {
|
||||||
// Handle failure here, e.g., show an error message
|
// Handle failure here, e.g., show an error message
|
||||||
toastr.error("Failed to save make and model");
|
toastr.error("Failed to save make and model");
|
||||||
|
button.prop('disabled', false).text('Save Make');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('Error occurred while saving make and model:', error);
|
console.error('Error occurred while saving make and model:', error);
|
||||||
toastr.error("Failed to save make and model. Please try again");
|
toastr.error("Failed to save make and model. Please try again");
|
||||||
|
button.prop('disabled', false).text('Save Make');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toastr.warning("Please fill in both make and model fields");
|
toastr.warning("Please fill in both make and model fields");
|
||||||
|
button.prop('disabled', false).text('Save Make');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -740,6 +744,8 @@ $('#saveMakeBtn').click(function() {
|
|||||||
$('#saveModelBtn').click(function() {
|
$('#saveModelBtn').click(function() {
|
||||||
var makeId = $('#makeSelect').val();
|
var makeId = $('#makeSelect').val();
|
||||||
var model = $('#modelInput').val();
|
var model = $('#modelInput').val();
|
||||||
|
const button = $('#saveModelBtn');
|
||||||
|
button.prop('disabled', true).text('Processing...');
|
||||||
if (makeId != '' && model != '') {
|
if (makeId != '' && model != '') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url().'save_model'?>',
|
url: '<?php echo base_url().'save_model'?>',
|
||||||
@ -759,15 +765,18 @@ $('#saveMakeBtn').click(function() {
|
|||||||
toastr.error("Failed to save model");
|
toastr.error("Failed to save model");
|
||||||
}
|
}
|
||||||
$('#model').val(response.model_id);
|
$('#model').val(response.model_id);
|
||||||
|
button.prop('disabled', false).text('Save Model');
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('Error occurred while saving model:', error);
|
console.error('Error occurred while saving model:', error);
|
||||||
toastr.error("Failed to save model. Please try again");
|
toastr.error("Failed to save model. Please try again");
|
||||||
|
button.prop('disabled', false).text('Save Model');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toastr.warning("Please fill in both make and model fields");
|
toastr.warning("Please fill in both make and model fields");
|
||||||
|
button.prop('disabled', false).text('Save Model');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -895,6 +904,9 @@ $('#saveMakeBtn').click(function() {
|
|||||||
if (!$('#manufacturer_name').val() || !$('#manufacturer_quality').val()) {
|
if (!$('#manufacturer_name').val() || !$('#manufacturer_quality').val()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const button = $('#saveManufacturersBtn');
|
||||||
|
button.prop('disabled', true).text('Processing...');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url().'save_manufacturer'?>',
|
url: '<?php echo base_url().'save_manufacturer'?>',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -922,10 +934,12 @@ $('#saveMakeBtn').click(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
button.prop('disabled', false).text('Save Manufacturer');//doubted
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response here
|
// Handle error response here
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
button.prop('disabled', false).text('Save Manufacturer');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,8 +139,8 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<!-- <option value="PO Issued" selected>PO Issued</option> -->
|
<!-- <option value="PO Issued" selected>PO Issued</option> -->
|
||||||
<option value="Received" <?= $purchase['status'] === 'Received' ? 'selected' : '' ?>>Received</option>
|
<option value="PO Issued" <?= isset($purchase['status']) && !isset($reorder) && $purchase['status'] === 'PO Issued' ? 'selected' : '' ?>>PO Issued</option>
|
||||||
<option value="PO Issued" <?= $purchase['status'] === 'PO Issued' ? 'selected' : '' ?>>PO Issued</option>
|
<option value="Received" <?= isset($purchase['status']) && !isset($reorder) && $purchase['status'] === 'Received' ? 'selected' : '' ?>>Received</option>
|
||||||
<!-- <option value="Paid">Paid</option> -->
|
<!-- <option value="Paid">Paid</option> -->
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="inputEmail4" class="col-form-label">Vehicle<span
|
<label for="inputEmail4" class="col-form-label">Vehicle<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Client"></i>' ?>
|
<?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Vehicle"></i>' ?>
|
||||||
|
|
||||||
<select class="form-control vehicle-select SelExample" name="vehicle_id" id="vehicle_id"
|
<select class="form-control vehicle-select SelExample" name="vehicle_id" id="vehicle_id"
|
||||||
<?= isset($sales['vehicle_id']) ? 'disabled' : 'required="true"' ?>>
|
<?= isset($sales['vehicle_id']) ? 'disabled' : 'required="true"' ?>>
|
||||||
@ -451,47 +451,11 @@
|
|||||||
<script>
|
<script>
|
||||||
productarray = [];
|
productarray = [];
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Function to fetch make and model information based on make and model IDs
|
|
||||||
function fetchMakeAndModel(makeId, modelId) {
|
|
||||||
// Make sure makeId and modelId are valid
|
|
||||||
if (makeId !== '' && modelId !== '') {
|
|
||||||
// Perform AJAX request to fetch product information
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo base_url().'getProducts'?>', // Replace with the actual backend endpoint
|
|
||||||
method: 'POST', // or 'GET' based on your server implementation
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
make_id: makeId,
|
|
||||||
model_id: modelId,
|
|
||||||
general: 1
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
// console.log(response);
|
|
||||||
// Populate make and model in the input field
|
|
||||||
var makeAndModel = response.makeName + ' ' + response.modelName;
|
|
||||||
$('#makeAndModel').val(makeAndModel);
|
|
||||||
|
|
||||||
if(response.product.length){
|
|
||||||
productarray = response.product;
|
|
||||||
}else{
|
|
||||||
productarray = "No Product";
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
// Handle error
|
|
||||||
console.error('Error fetching product information:', error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
productarray = [];
|
|
||||||
console.error('Make ID or Model ID not found for the selected vehicle');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event listener for vehicle selection change
|
// Event listener for vehicle selection change
|
||||||
$('.vehicle-select').change(function() {
|
$('.vehicle-select').change(function() {
|
||||||
var vehicleId = $(this).val();
|
var vehicleId = $(this).val();
|
||||||
|
console.log("**");
|
||||||
|
console.log(vehicleId);
|
||||||
|
|
||||||
if (vehicleId !== '') {
|
if (vehicleId !== '') {
|
||||||
// Find the selected vehicle
|
// Find the selected vehicle
|
||||||
@ -927,6 +891,8 @@ $(document).ready(function() {
|
|||||||
var ifStatementCondition ="createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
|
var ifStatementCondition ="createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const button = $('#saveVehcileBtn');
|
||||||
|
button.prop('disabled', true).text('Processing...');
|
||||||
|
|
||||||
if (reg_no) {
|
if (reg_no) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -938,6 +904,7 @@ $(document).ready(function() {
|
|||||||
if (response) {
|
if (response) {
|
||||||
$('#reg_no').val("");
|
$('#reg_no').val("");
|
||||||
toastr.warning("Register Number Already Added!");
|
toastr.warning("Register Number Already Added!");
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}else{
|
}else{
|
||||||
if (eval(ifStatementCondition)) {
|
if (eval(ifStatementCondition)) {
|
||||||
|
|
||||||
@ -958,30 +925,38 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.success) {
|
if (response.success && response.code == 200 ) {
|
||||||
$('#addVehicleModal').modal('hide');
|
|
||||||
toastr.success("Vehicle saved successfully!");
|
|
||||||
localStorage.setItem('vehicle_id',response.vehicle_id)
|
|
||||||
window.location.reload();
|
|
||||||
|
|
||||||
} else {
|
toastr.success("Vehicle saved successfully!");
|
||||||
|
localStorage.setItem('vehicle_id',response.vehicle_id);
|
||||||
|
$('#addVehicleModal').modal('hide');
|
||||||
|
window.location.reload();
|
||||||
|
}else if (response.success && response.code == 404 ) {
|
||||||
|
$('#'+response.field).val("");
|
||||||
|
toastr.warning(response.message);
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
|
}else {
|
||||||
toastr.warning("Failed to save vehicle. Please try again");
|
toastr.warning("Failed to save vehicle. Please try again");
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('Error occurred while saving vehicle:', error);
|
console.error('Error occurred while saving vehicle:', error);
|
||||||
toastr.warning("Failed to save vehicle. Please try again");
|
toastr.warning("Failed to save vehicle. Please try again");
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning("Please Fill All Data");
|
toastr.warning("Please Fill All Data");
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(error); // Log any errors to the console
|
console.error(error); // Log any errors to the console
|
||||||
|
button.prop('disabled', false).text('Save Vehicle');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1118,8 +1093,6 @@ $(document).on('click', '#selectClient', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(window).on('load', function() {
|
$(window).on('load', function() {
|
||||||
// This code will execute after the page has been reloaded
|
// This code will execute after the page has been reloaded
|
||||||
vehicle_id = localStorage.getItem('vehicle_id');
|
vehicle_id = localStorage.getItem('vehicle_id');
|
||||||
@ -1128,29 +1101,66 @@ $(document).on('click', '#selectClient', function() {
|
|||||||
var vehicleId = vehicle_id;
|
var vehicleId = vehicle_id;
|
||||||
if (vehicleId !== '') {
|
if (vehicleId !== '') {
|
||||||
// Find the selected client in the client data
|
// Find the selected client in the client data
|
||||||
// var selectedClient = vehicles.find(function(vehicle) {
|
var selectedClient = vehicles.find(function(vehicle) {
|
||||||
// return vehicle.vehicle_id == vehicleId;
|
return vehicle.vehicle_id == vehicleId;
|
||||||
// });
|
});
|
||||||
|
var makeId = selectedClient.make;
|
||||||
|
var modelId = selectedClient.model;
|
||||||
|
|
||||||
// console.log(selectedClient);
|
fetchMakeAndModel(makeId, modelId);
|
||||||
|
console.log(selectedClient);
|
||||||
|
|
||||||
// $('input[name="client_id"]').val(selectedClient.client_name);
|
$('input[name="client_id"]').val(selectedClient.client_name);
|
||||||
|
$('input[name="billing_address"]').val(selectedClient.address);
|
||||||
// $('input[name="billing_address"]').val(selectedClient.address);
|
// $('input[name="billing_address"]').val(selectedClient.address);
|
||||||
// // $('input[name="billing_address"]').val(selectedClient.address);
|
$('input[name="city"]').val(selectedClient.city);
|
||||||
// $('input[name="city"]').val(selectedClient.city);
|
$('input[name="state"]').val(selectedClient.state);
|
||||||
// $('input[name="state"]').val(selectedClient.state);
|
$('input[name="country"]').val(selectedClient.country);
|
||||||
// $('input[name="country"]').val(selectedClient.country);
|
$('input[name="mobile_no"]').val(selectedClient.mobile_no);
|
||||||
// $('input[name="mobile_no"]').val(selectedClient.mobile_no);
|
$('input[name="postalcode"]').val(selectedClient.postal_code);
|
||||||
// $('input[name="postalcode"]').val(selectedClient.postal_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#vehicle_id').val(vehicle_id).trigger('change');
|
$('#vehicle_name').val(vehicle_id).trigger('change');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function fetchMakeAndModel(makeId, modelId) {
|
||||||
|
// Make sure makeId and modelId are valid
|
||||||
|
if (makeId !== '' && modelId !== '') {
|
||||||
|
// Perform AJAX request to fetch product information
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url().'getProducts'?>', // Replace with the actual backend endpoint
|
||||||
|
method: 'POST', // or 'GET' based on your server implementation
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
make_id: makeId,
|
||||||
|
model_id: modelId,
|
||||||
|
general: 1
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
// console.log(response);
|
||||||
|
// Populate make and model in the input field
|
||||||
|
var makeAndModel = response.makeName + ' ' + response.modelName;
|
||||||
|
$('#makeAndModel').val(makeAndModel);
|
||||||
|
|
||||||
|
if(response.product.length){
|
||||||
|
productarray = response.product;
|
||||||
|
}else{
|
||||||
|
productarray = "No Product";
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
// Handle error
|
||||||
|
console.error('Error fetching product information:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
productarray = [];
|
||||||
|
console.error('Make ID or Model ID not found for the selected vehicle');
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- script for set the product name id -->
|
<!-- script for set the product name id -->
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-7">
|
<div class="form-group col-md-12">
|
||||||
<h5 class="text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Personal Info</h5>
|
<h5 class="text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Personal Info</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
@ -78,9 +78,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div class="password_change card-body">
|
<div class="password_change card-body">
|
||||||
<div class="form-group col-md-7">
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Change Password</h5>
|
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Change Password</h5>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
|
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
|
||||||
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
|
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Make"></i>' ?>
|
||||||
<select class="form-control SelExample" name="make" id="make" <?= isset($vehicle['make']) ? '' : 'required' ?>>
|
<select class="form-control SelExample" name="make" id="make" <?= isset($vehicle['make']) ? '' : 'required' ?>>
|
||||||
<?= isset($vehicle['make']) ? '' : '<option value="">Select a Make</option>' ?>
|
<?= isset($vehicle['make']) ? '' : '<option value="">Select a Make</option>' ?>
|
||||||
<?php foreach ($makeData as $value) : ?>
|
<?php foreach ($makeData as $value) : ?>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputPassword4" class="col-form-label">Model<span class="text-danger">*</span></label>
|
<label for="inputPassword4" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||||
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>' ?>
|
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Modal"></i>' ?>
|
||||||
<select class="form-control SelExample" name="model" id="model" <?= isset($vehicle['model']) ? '' : 'required' ?>>
|
<select class="form-control SelExample" name="model" id="model" <?= isset($vehicle['model']) ? '' : 'required' ?>>
|
||||||
<?php if (isset($vehicle["model_name"])) : ?>
|
<?php if (isset($vehicle["model_name"])) : ?>
|
||||||
<option value="<?= $vehicle["model"] ?>" >
|
<option value="<?= $vehicle["model"] ?>" >
|
||||||
@ -310,6 +310,8 @@ $(document).ready(function() {
|
|||||||
var clientName = $('#clientName').val();
|
var clientName = $('#clientName').val();
|
||||||
var clientMobile = $('#clientMobile').val();
|
var clientMobile = $('#clientMobile').val();
|
||||||
var clientType = $('#clientType').val();
|
var clientType = $('#clientType').val();
|
||||||
|
const clientButton = $('#saveClientBtn');
|
||||||
|
clientButton.prop('disabled', true).text('Processing...');
|
||||||
if(clientName != '' && clientMobile != '' && clientType != ''){
|
if(clientName != '' && clientMobile != '' && clientType != ''){
|
||||||
|
|
||||||
// Send AJAX request to save the client
|
// Send AJAX request to save the client
|
||||||
@ -333,20 +335,24 @@ $(document).ready(function() {
|
|||||||
// Manually select the newly added option
|
// Manually select the newly added option
|
||||||
$("#clientData").val(response.clientData.client_id);
|
$("#clientData").val(response.clientData.client_id);
|
||||||
$('input[name="mobile_no"]').val(response.clientData.mobile_no);
|
$('input[name="mobile_no"]').val(response.clientData.mobile_no);
|
||||||
|
clientButton.prop('disabled', false).text('Save Client');
|
||||||
} else {
|
} else {
|
||||||
// Client save operation failed, display error message
|
// Client save operation failed, display error message
|
||||||
toastr.warning("Failed to save client. Please try again");
|
toastr.warning("Failed to save client. Please try again");
|
||||||
|
clientButton.prop('disabled', false).text('Save Client');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// AJAX request failed, display error message
|
// AJAX request failed, display error message
|
||||||
console.error('Error occurred while saving client:', error);
|
console.error('Error occurred while saving client:', error);
|
||||||
toastr.warning("Failed to save client. Please try again");
|
toastr.warning("Failed to save client. Please try again");
|
||||||
|
clientButton.prop('disabled', false).text('Save Client');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
toastr.warning("Please Fill All Datas");
|
toastr.warning("Please Fill All Datas");
|
||||||
|
clientButton.prop('disabled', false).text('Save Client');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -361,6 +367,8 @@ $(document).ready(function() {
|
|||||||
$('#saveMakeBtn').click(function() {
|
$('#saveMakeBtn').click(function() {
|
||||||
var make = $('#makes').val();
|
var make = $('#makes').val();
|
||||||
var model = $('#models').val();
|
var model = $('#models').val();
|
||||||
|
const makeButton = $('#saveMakeBtn');
|
||||||
|
makeButton.prop('disabled', true).text('Processing...');
|
||||||
|
|
||||||
if (make != '' && model != '') {
|
if (make != '' && model != '') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -376,18 +384,22 @@ $('#saveMakeBtn').click(function() {
|
|||||||
// Handle success here, e.g., show a success message
|
// Handle success here, e.g., show a success message
|
||||||
toastr.success("Make and model saved successfully");
|
toastr.success("Make and model saved successfully");
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
makeButton.prop('disabled', false).text('Save Make');
|
||||||
} else {
|
} else {
|
||||||
// Handle failure here, e.g., show an error message
|
// Handle failure here, e.g., show an error message
|
||||||
toastr.error("Failed to save make and model");
|
toastr.error("Failed to save make and model");
|
||||||
|
makeButton.prop('disabled', false).text('Save Make');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('Error occurred while saving make and model:', error);
|
console.error('Error occurred while saving make and model:', error);
|
||||||
toastr.error("Failed to save make and model. Please try again");
|
toastr.error("Failed to save make and model. Please try again");
|
||||||
|
makeButton.prop('disabled', false).text('Save Make');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toastr.warning("Please fill in both make and model fields");
|
toastr.warning("Please fill in both make and model fields");
|
||||||
|
makeButton.prop('disabled', false).text('Save Make');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -422,6 +434,9 @@ $('#saveModelBtn').click(function() {
|
|||||||
var makeId = $('#makeSelect').val();
|
var makeId = $('#makeSelect').val();
|
||||||
var model = $('#modelInput').val();
|
var model = $('#modelInput').val();
|
||||||
console.log(model);
|
console.log(model);
|
||||||
|
const modalButton = $('#saveModelBtn');
|
||||||
|
modalButton.prop('disabled', true).text('Processing...');
|
||||||
|
modalButton.prop('disabled', false).text('Save Model');
|
||||||
if (makeId != '' && model != '') {
|
if (makeId != '' && model != '') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url().'save_model'?>',
|
url: '<?php echo base_url().'save_model'?>',
|
||||||
@ -435,17 +450,21 @@ $('#saveModelBtn').click(function() {
|
|||||||
$('#addModelModal').modal('hide');
|
$('#addModelModal').modal('hide');
|
||||||
toastr.success("Model saved successfully");
|
toastr.success("Model saved successfully");
|
||||||
$('#model').append('<option value="' + response.model_id + '">' + response.model_value + '</option>');
|
$('#model').append('<option value="' + response.model_id + '">' + response.model_value + '</option>');
|
||||||
|
modalButton.prop('disabled', false).text('Save Model');
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Failed to save model");
|
toastr.error("Failed to save model");
|
||||||
|
modalButton.prop('disabled', false).text('Save Model');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('Error occurred while saving model:', error);
|
console.error('Error occurred while saving model:', error);
|
||||||
toastr.error("Failed to save model. Please try again");
|
toastr.error("Failed to save model. Please try again");
|
||||||
|
modalButton.prop('disabled', false).text('Save Model');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toastr.warning("Please fill in both make and model fields");
|
toastr.warning("Please fill in both make and model fields");
|
||||||
|
modalButton.prop('disabled', false).text('Save Model');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user