CHANGE_JOB_CARD_PDF_OS_ : AADHAVAN
This commit is contained in:
parent
bc36cceaa3
commit
a75f6fb3c0
@ -545,12 +545,24 @@ class Jobcard extends BaseController
|
||||
// $service = $ServiceModel->where('JSON_CONTAINS(makes_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
// ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
// ->findAll();
|
||||
$service = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
|
||||
$service1 = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
|
||||
->where('models_id LIKE \'%"' . $modelId . '"%\'', null, false)
|
||||
->orWhere('category', 0)
|
||||
->findAll();
|
||||
|
||||
$encodedMakeId1 = 0;
|
||||
$encodedModelId1 = 0;
|
||||
|
||||
$common_services = $ServiceModel->where('makes_id LIKE \'%"' . $encodedMakeId1 . '"%\'', null, false)
|
||||
->where('models_id LIKE \'%"' . $encodedModelId1 . '"%\'', null, false)
|
||||
->findAll();
|
||||
$service = array_merge($common_services, $service1);
|
||||
|
||||
|
||||
$data['product']=$product;
|
||||
$data['service']=$service;
|
||||
// echo "<pre>";
|
||||
// print_r($service);die;
|
||||
$jobs_product= $JobcardCustomComplaintModel->where('job_card_id', $job_card_id)->findAll();
|
||||
$data['jobs_product']=$jobs_product;
|
||||
$jobs_service= $JobcardServiceModel->where('job_card_id', $job_card_id)->findAll();
|
||||
@ -1155,11 +1167,23 @@ class Jobcard extends BaseController
|
||||
$ServiceModel = new ServiceModel();
|
||||
|
||||
// Query the database to find the service based on make_id and model_id
|
||||
$service = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
|
||||
$service1 = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
|
||||
->where('models_id LIKE \'%"' . $modelId . '"%\'', null, false)
|
||||
->where('category',0)
|
||||
->where('category',1)
|
||||
->findAll();
|
||||
|
||||
$encodedMakeId1 = 0;
|
||||
$encodedModelId1 =0;
|
||||
|
||||
$common_services = $ServiceModel->where('makes_id LIKE \'%"' . $encodedMakeId1 . '"%\'', null, false)
|
||||
->where('models_id LIKE \'%"' . $encodedModelId1 . '"%\'', null, false)
|
||||
->where('category',1)
|
||||
->findAll();
|
||||
|
||||
$service2 = $ServiceModel->where('category',0)
|
||||
->findAll();
|
||||
$service = array_merge($common_services, $service1, $service2);
|
||||
|
||||
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
|
||||
$makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
|
||||
|
||||
|
||||
@ -97,11 +97,24 @@ class Sales extends BaseController
|
||||
$productModel = new ProductModel();
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
$makemodelproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->findAll();
|
||||
|
||||
$encodedMakeId1 = json_encode(['0']);
|
||||
$encodedModelId1 = json_encode(['0']);
|
||||
|
||||
$common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId1 . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId1 . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->findAll();
|
||||
$product = array_merge($common_product, $makemodelproduct);
|
||||
|
||||
|
||||
$data['product']=$product;
|
||||
$SalesProductOrderModel = new SalesOrderProductModel();
|
||||
$sales_product=$SalesProductOrderModel->where('sales_order_id', $sales_order_id)->findAll();
|
||||
@ -451,6 +464,12 @@ public function getProducts()
|
||||
|
||||
// Load the ProductModel
|
||||
$productModel = new ProductModel();
|
||||
$bikemodelsModel = new BikemodelsModel();
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
|
||||
$makeGeneral = $BikemakeModel->where('make' , 'General')->first();
|
||||
$modelGeneral = $bikemodelsModel->where('model_name' , 'General')->first();
|
||||
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
|
||||
@ -234,7 +234,7 @@
|
||||
|
||||
$('#form_add_edit').text('Edit Models');
|
||||
|
||||
var full_div = $(params).parent().parent()[0];
|
||||
var full_div = $(params).closest('tr')[0];
|
||||
|
||||
$('#modelname').val($(full_div).find('.model_name').text());
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
<th>Labour Charge</th>
|
||||
<th hidden>Status</th>
|
||||
<th>Actions</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -105,22 +104,20 @@
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
|
||||
function ReverseCalculation() {
|
||||
var tax = parseFloat($("#tax").val());
|
||||
if(tax == ''){
|
||||
toastr.warning('Please select Tax', 'Warning');
|
||||
}else{
|
||||
var labour_cost_with_tax = parseFloat($("#labour_cost_with_tax").val());
|
||||
var labour_cost = labour_cost_with_tax / parseFloat((tax / 100) + 1);
|
||||
|
||||
$("#labour_charge").val(labour_cost.toFixed(2));
|
||||
|
||||
}
|
||||
function ReverseCalculation() {
|
||||
var tax = parseFloat($("#tax").val());
|
||||
if(tax == ''){
|
||||
toastr.warning('Please select Tax', 'Warning');
|
||||
}else{
|
||||
var labour_cost_with_tax = parseFloat($("#labour_cost_with_tax").val());
|
||||
var labour_cost = labour_cost_with_tax / parseFloat((tax / 100) + 1);
|
||||
|
||||
}
|
||||
$("#labour_charge").val(labour_cost.toFixed(2));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function submitComplaint(params) {
|
||||
if (!$('#name').val() || !$('#labour_charge').val()) {
|
||||
return false;
|
||||
@ -152,9 +149,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function editComplaint(params) {
|
||||
var complaint_id = $(params).data('value');
|
||||
$.ajax({
|
||||
@ -162,7 +156,6 @@
|
||||
url: '<?php echo base_url()."edit_complaint/"?>' + complaint_id,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#form_add_edit').html(response.page_name)
|
||||
$('#complaint_id').val(response.complaint[0].complaint_id);
|
||||
$('#name').val(response.complaint[0].name);
|
||||
@ -178,7 +171,6 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
@ -189,55 +181,53 @@
|
||||
|
||||
function clearDetials(params) {
|
||||
$('#form_add_edit').text('Add Complaint');
|
||||
$('#model_form_data')[0].reset();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Complaint', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Complaint', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -494,7 +494,7 @@ $(document).ready(async function() {
|
||||
var edit_ccomplaint_data = <?php echo isset($editccomplaintdata) ? json_encode($editccomplaintdata) : 0 ?>;
|
||||
if(edit_ccomplaint_data.length > 0) {
|
||||
for (const value of edit_ccomplaint_data) {
|
||||
var newRow = '<tr class="custom_complaint_class"><td hidden> <input type="number" class="form-control labour_cost" name="labour_cost" value="'+value.labour_cost+'"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5">'+value.name+'</textarea></td>' +
|
||||
var newRow = '<tr class="custom_complaint_class"><td hidden> <input type="number" class="form-control labour_cost" name="labour_cost" step="0.01" value="'+value.labour_cost+'"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5">'+value.name+'</textarea></td>' +
|
||||
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
||||
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" /></td>' +
|
||||
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>';
|
||||
@ -753,6 +753,7 @@ $(window).on('load', function() {
|
||||
vehicle_id: vehicleId
|
||||
},
|
||||
success: function(response) {
|
||||
console.log("111111111111111111");
|
||||
console.log(response);
|
||||
servicearray = response.service;
|
||||
makeAndModel = response.makeName+' '+response.modelName;
|
||||
@ -833,8 +834,7 @@ $(window).on('load', function() {
|
||||
else if(className == 'custom_complaint_lb') {
|
||||
previousRow = $(this).closest('tr').prevAll(".custom_complaint_class").first();
|
||||
labour_rate = previousRow.find('.labour_cost');
|
||||
// labour_rate.val(actual_amount.toFixed(2));
|
||||
labour_rate.val(parseInt(actual_amount, 10));
|
||||
labour_rate.val(actual_amount.toFixed(2));
|
||||
|
||||
item_rate = previousRow.find('.item-rate1');
|
||||
item_rate.val(actual_amount.toFixed(2));
|
||||
@ -1595,10 +1595,10 @@ $(window).on('load', function() {
|
||||
selected_pr.push(rowProductid);
|
||||
});
|
||||
|
||||
if(servicearray.length == 0)
|
||||
{
|
||||
servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>;
|
||||
}
|
||||
// if(servicearray.length == 0)
|
||||
// {
|
||||
// servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>;
|
||||
// }
|
||||
console.log(servicearray);
|
||||
var newRow = '<tr class="service_class"><td hidden> <input type="text" class="form-control labour_cost" name="labour_cost"></td><td><select class="form-control book-select SelExample service" name="service_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Service</option>';
|
||||
|
||||
@ -1699,7 +1699,7 @@ $(window).on('load', function() {
|
||||
|
||||
$('#addCustomComplaint').click(function() {
|
||||
complaint = <?php echo json_encode($complaint) ?>;
|
||||
var newRow = '<tr class="custom_complaint_class"><td hidden> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" required rows="5"></textarea></td>' +
|
||||
var newRow = '<tr class="custom_complaint_class"><td hidden> <input type="number" class="form-control labour_cost" step="0.01" name="labour_cost"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" required rows="5"></textarea></td>' +
|
||||
'<td><input hidden type="text" class="form-control rate-d-only" readonly /></td>' +
|
||||
'<td hidden><input type="text" class="form-control item-rate1" name="unit-price[]" readonly /></td>' +
|
||||
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="1" name="quantity[]" readonly/></td>' +
|
||||
@ -1746,7 +1746,7 @@ $(window).on('load', function() {
|
||||
var $targetField = $previousRow.find('.item-rate1');
|
||||
$targetField.val(enteredValue);
|
||||
var $targetField2 = $previousRow.find('.labour_cost');
|
||||
$targetField2.val(int(enteredValue));
|
||||
$targetField2.val(enteredValue);
|
||||
updateCalculations();
|
||||
});
|
||||
/** TAX FIELD */
|
||||
@ -1874,16 +1874,17 @@ $(window).on('load', function() {
|
||||
}
|
||||
|
||||
if ($closestTR.attr('class') !== "product" && $closestTR.attr('class') !== "sub_service") {
|
||||
while ($closestTR.next().length > 0 ) {
|
||||
if ($closestTR.next().hasClass('service_class') || $closestTR.next().hasClass('complaint_class') || $closestTR.next().hasClass('custom_complaint_class') || $closestTR.next().hasClass('os_class')) {
|
||||
break;
|
||||
}
|
||||
// Remove the next row
|
||||
$closestTR.next().remove();
|
||||
}
|
||||
// Remove the clicked row
|
||||
}
|
||||
$closestTR.remove();
|
||||
while ($closestTR.next().length > 0 ) {
|
||||
if ($closestTR.next().hasClass('service_class') || $closestTR.next().hasClass('complaint_class') || $closestTR.next().hasClass('custom_complaint_class') || $closestTR.next().hasClass('os_class')) {
|
||||
break;
|
||||
}
|
||||
// Remove the next row
|
||||
$closestTR.next().remove();
|
||||
}
|
||||
// Remove the clicked row
|
||||
}
|
||||
$closestTR.remove();
|
||||
|
||||
updateCalculations();
|
||||
});
|
||||
|
||||
@ -2081,7 +2082,7 @@ $(window).on('load', function() {
|
||||
$('#addVehicleModal').modal('hide');
|
||||
toastr.success("Vehicle saved successfully!");
|
||||
localStorage.setItem('vehicle_id',response.vehicle_id)
|
||||
window.location.reload();
|
||||
// window.location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning("Failed to save vehicle. Please try again");
|
||||
|
||||
@ -183,66 +183,26 @@
|
||||
toastr.error('Please enter a Make Name.', 'Error');
|
||||
return; // Stop further execution of the function
|
||||
}
|
||||
|
||||
var formData = {
|
||||
makename: $('#bike_make_name').val()
|
||||
};
|
||||
|
||||
var edit_make_id = $('#edit_make_id').val();
|
||||
|
||||
if (!edit_make_id) {
|
||||
edit_make_id =0;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'create_make/'+edit_make_id,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
|
||||
if (response.status == "failed") {
|
||||
toastr.warning(response.data, 'Warning');
|
||||
}else{
|
||||
$('#bike_make_login-modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
toastr.success(response.data, 'Success');
|
||||
|
||||
// $('tbody').html('');
|
||||
|
||||
window.location.reload();
|
||||
|
||||
// $.each(response.make_list, function(index, item) {
|
||||
// var row = '<tr>' +
|
||||
// '<td class="make">' + item.make + '</td>' +
|
||||
// '<td>';
|
||||
|
||||
// if (item.isactive == 1) {
|
||||
// row += '<span style="color:green">Active</span>';
|
||||
// } else if (item.isactive == 0) {
|
||||
// row += '<span style="color:red">Inactive</span>';
|
||||
// }
|
||||
|
||||
// row += '</td><td>';
|
||||
|
||||
// // Check the isactive status and set the icon color accordingly
|
||||
// row += '<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="'+ item.make_id +'" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line" style="font-size:20px;"></i></a>';
|
||||
|
||||
// row +='<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" style="margin-left: 12px;" class="add-button" title="Add" data-id="'+ item.make_id+'" data-value="' +item.make+'" onclick="setMakeName(this)"><i class="ri-add-line icon-large" style="font-size:20px;"></i></a>';
|
||||
// row +='<a href="bike_model_index/' +item.make_id+'" class="view-list-button" title="Model List" style="margin-left: 12px;"><i class="ri-list-check-2 icon-large" style="font-size:20px;"></i></a>';
|
||||
// if (item.isactive == 1) {
|
||||
// row += '<a style="color:red; margin-left:12px;" data-id="' + item.make_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)"><i class="fa fa-bicycle" style="font-size:20px;"></i><i class="fa fa-times" style="font-size: x-small;" style="font-size:20px;"></i></a>';
|
||||
// } else if (item.isactive == 0) {
|
||||
// row += '<a style="color:green; margin-left:12px;" data-id="' + item.make_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)"><i class="fa fa-bicycle" style="font-size:20px;"></i></a>';
|
||||
// }
|
||||
|
||||
// row += '</td><td></td></tr>';
|
||||
|
||||
// // Append the row to the tbody
|
||||
// $('tbody').append(row);
|
||||
// });
|
||||
}
|
||||
|
||||
},
|
||||
@ -253,24 +213,18 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function editMake(params) {
|
||||
|
||||
$('#edit_make_id').val($(params).data('value'));
|
||||
$('#form_add_edit').text('Edit Bike Make');
|
||||
|
||||
var full_div = $(params).parent().parent()[0];
|
||||
console.log($(full_div));
|
||||
var full_div = $(params).closest('tr')[0];
|
||||
$('#bike_make_name').val($(full_div).find('.make').text());
|
||||
}
|
||||
|
||||
function clearDetials(params) {
|
||||
$('#form_add_edit').text('Add Bike Make');
|
||||
|
||||
$('#bike_make_name').val('');
|
||||
}
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var make_id = params.getAttribute('data-id');
|
||||
|
||||
@ -136,11 +136,9 @@
|
||||
}
|
||||
|
||||
function editManufacturer(params) {
|
||||
|
||||
$('#manufacturer_id').val($(params).data('value'));
|
||||
$('#form_add_edit').text('Edit Manufacturer');
|
||||
var full_div = $(params).parent().parent()[0];
|
||||
|
||||
var full_div = $(params).closest('tr')[0];
|
||||
$('#manufacturer_name').val($(full_div).find('.manufacturer_name').text());
|
||||
$('#quality').val($(full_div).find('.quality').text());
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ p {
|
||||
<?= $item['reg_no'] ?><br>
|
||||
<?= $item['bike_name'] ?> - <?= $item['bike_modal_name'] ?><br>
|
||||
<?= $item['colour'] ?> color<br>
|
||||
<?= $item['delivery_date'] ?><br>
|
||||
<?= $item['delivery_date'] ?> delivery date<br>
|
||||
</td>
|
||||
<td style="padding: 0;width: 33%;border: 0.5px solid black;">
|
||||
<table style="margin-left: -2px;width: 101%;padding: 0;">
|
||||
|
||||
@ -436,7 +436,8 @@ $(document).ready(function() {
|
||||
dataType: 'json',
|
||||
data: {
|
||||
make_id: makeId,
|
||||
model_id: modelId
|
||||
model_id: modelId,
|
||||
general: 1
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
@ -444,7 +445,6 @@ $(document).ready(function() {
|
||||
var makeAndModel = response.makeName + ' ' + response.modelName;
|
||||
$('#makeAndModel').val(makeAndModel);
|
||||
|
||||
console.log(response);
|
||||
productarray = response.product;
|
||||
|
||||
|
||||
@ -455,6 +455,7 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
productarray = [];
|
||||
console.error('Make ID or Model ID not found for the selected vehicle');
|
||||
}
|
||||
}
|
||||
@ -664,38 +665,43 @@ $(document).ready(function() {
|
||||
|
||||
// Event listener for "Add More Item" button
|
||||
$('#addItem').click(function() {
|
||||
// console.log(productarray);
|
||||
var newRow = '<tr>' +
|
||||
console.log(productarray.length);
|
||||
if (productarray.length > 0) {
|
||||
var newRow = '<tr>' +
|
||||
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
|
||||
|
||||
for (var i = 0; i < productarray.length; i++) {
|
||||
var product = productarray[i];
|
||||
// console.log("product",product);
|
||||
var value_ml ='';
|
||||
if (product.per == 'ml') {
|
||||
value_ml = " ("+product.ml+product.per+")";
|
||||
for (var i = 0; i < productarray.length; i++) {
|
||||
var product = productarray[i];
|
||||
// console.log("product",product);
|
||||
var value_ml ='';
|
||||
if (product.per == 'ml') {
|
||||
value_ml = " ("+product.ml+product.per+")";
|
||||
}
|
||||
newRow += '<option value="' + product.product_id + '" >' + product.product_name + value_ml + " - " + product.manufacturer_name+
|
||||
'</option>';
|
||||
}
|
||||
newRow += '<option value="' + product.product_id + '" >' + product.product_name + value_ml + " - " + product.manufacturer_name+
|
||||
'</option>';
|
||||
|
||||
newRow += '</select></td>' +
|
||||
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" readonly /></td>' +
|
||||
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" max="" name="quantity[]" onchange="updateThirdColumnValue(this); updateTaxAmount(this)" /></td>' +
|
||||
'<td style="width:10%;"><input type="text" class="form-control item-result" readonly /></td>' +
|
||||
'<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" readonly /></td>' +
|
||||
'<td style="width:8%;"><input type="text" class="form-control tax-amount" name="tax-amount[]" readonly /></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]"/></td>' +
|
||||
'<td hidden><input type="hidden"></td>' +
|
||||
'<td><center><i class="fa fa-trash remove-item"></i></center></td>' +
|
||||
'</tr>';
|
||||
|
||||
|
||||
$('#itemTable tbody').append(newRow);
|
||||
initializeSelect2();
|
||||
updateCalculations();
|
||||
initializeRowCalculations(row);
|
||||
|
||||
}else{
|
||||
toastr.warning("First Choose the Vehicle!");
|
||||
}
|
||||
|
||||
newRow += '</select></td>' +
|
||||
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" readonly /></td>' +
|
||||
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" max="" name="quantity[]" onchange="updateThirdColumnValue(this); updateTaxAmount(this)" /></td>' +
|
||||
'<td style="width:10%;"><input type="text" class="form-control item-result" readonly /></td>' +
|
||||
'<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" readonly /></td>' +
|
||||
'<td style="width:8%;"><input type="text" class="form-control tax-amount" name="tax-amount[]" readonly /></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]"/></td>' +
|
||||
'<td hidden><input type="hidden"></td>' +
|
||||
'<td><center><i class="fa fa-trash remove-item"></i></center></td>' +
|
||||
'</tr>';
|
||||
|
||||
|
||||
$('#itemTable tbody').append(newRow);
|
||||
initializeSelect2();
|
||||
updateCalculations();
|
||||
initializeRowCalculations(row);
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Event listener for removing item
|
||||
|
||||
Loading…
Reference in New Issue
Block a user