|
|
|
|
@ -21,6 +21,7 @@
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<form id="form-submit" action="<?= base_url() . "add_jobs"; ?>" method="post">
|
|
|
|
|
<input type="hidden" id="product_response" name="products" value="">
|
|
|
|
|
<input type="hidden" id="delete_items" name="delete_items" value="">
|
|
|
|
|
<!-- <h4 class="header-title">Sales Order Details :</h4><br> -->
|
|
|
|
|
|
|
|
|
|
<div class="form-row">
|
|
|
|
|
@ -278,13 +279,12 @@
|
|
|
|
|
$(document).ready(async function() {
|
|
|
|
|
/** SERVICE */
|
|
|
|
|
var edit_service_data = <?php echo isset($editservicedata) ? json_encode($editservicedata) : 0 ?>;
|
|
|
|
|
// console.log(edit_service_data);
|
|
|
|
|
if(edit_service_data.length > 0) {
|
|
|
|
|
for (const value of edit_service_data) {
|
|
|
|
|
servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>;
|
|
|
|
|
// console.log(servicearray);
|
|
|
|
|
var newRow = `<tr><td hidden style="width:10%;">
|
|
|
|
|
<input type="number" class="form-control labour-cost" name="labour_cost[]"></td>
|
|
|
|
|
var newRow = `<tr class="service_class"><td hidden style="width:10%;">
|
|
|
|
|
<input type="number" class="form-control labour_cost" name="labour_cost" value="${value.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>`;
|
|
|
|
|
|
|
|
|
|
@ -320,7 +320,7 @@ $(document).ready(async function() {
|
|
|
|
|
for (const value of edit_complaint_data) {
|
|
|
|
|
complaint = <?php echo json_encode($complaint) ?>;
|
|
|
|
|
// console.log(productarray);
|
|
|
|
|
var newRow = '<tr><td hidden style="width:10%;"> <input type="number" class="form-control labour-cost" name="labour_cost[]"></td><td><select class="form-control book-select SelExample complaint" id="complaint_detail" name="complaint_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Complaint</option>';
|
|
|
|
|
var newRow = '<tr class="complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost" value="'+value.labour_cost+'"></td><td><select class="form-control book-select SelExample complaint" id="complaint_detail" name="complaint_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Complaint</option>';
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < complaint.length; i++)
|
|
|
|
|
{
|
|
|
|
|
@ -356,11 +356,10 @@ $(document).ready(async function() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** CUSTOM COMPLAINT */
|
|
|
|
|
var edit_ccomplaint_data = <?php echo isset($editcomplaintdata) ? json_encode($editccomplaintdata) : 0 ?>;
|
|
|
|
|
console.log(edit_ccomplaint_data);
|
|
|
|
|
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><td hidden style="width:10%;"> <input type="number" class="form-control labour-cost" name="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 style="width:10%;"> <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>' +
|
|
|
|
|
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>' +
|
|
|
|
|
'<td style="width:10%;"><input type="text" class="form-control item-rate" value="'+value.amount+'" name="unit-price[]" /></td>' +
|
|
|
|
|
'<td style="width:8%;"><input type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" /></td>' +
|
|
|
|
|
@ -383,12 +382,12 @@ $(document).ready(async function() {
|
|
|
|
|
initializeSelect2();
|
|
|
|
|
/** APPEND CHILD PRODUCT */
|
|
|
|
|
await edit_product_data(value.product);
|
|
|
|
|
// editlabourcost(value.product)
|
|
|
|
|
editlabourcost(value.labour_cost)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function editlabourcost(data) {
|
|
|
|
|
var newRow = '<tr class="dummy"><td hidden style="width:10%;"><input type="number" class="form-control labour-cost" name="labour_cost[]"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour-cost" value="Labour Cost"></td>' +
|
|
|
|
|
var newRow = '<tr class="dummy"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
|
|
|
|
'<td style="width:10%;"></td>' +
|
|
|
|
|
'<td style="width:10%;"></td>' +
|
|
|
|
|
'<td style="width:8%;"></td>' +
|
|
|
|
|
@ -406,7 +405,7 @@ $(document).ready(async function() {
|
|
|
|
|
function edit_product_data(products) {
|
|
|
|
|
|
|
|
|
|
for (const product of products) {
|
|
|
|
|
var newRow = `<tr><td hidden style="width:10%;"><input type="number" class="form-control labour-cost" name="labour_cost"></td>
|
|
|
|
|
var newRow = `<tr><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td>
|
|
|
|
|
<td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i>
|
|
|
|
|
<select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;">`;
|
|
|
|
|
|
|
|
|
|
@ -515,11 +514,6 @@ $(document).ready(async function() {
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
function validateProductAdded() {
|
|
|
|
|
var rowCount = $('#itemTable tbody tr').length;
|
|
|
|
|
// if (rowCount < 1) {
|
|
|
|
|
// toastr.warning("Please add at least one product.");
|
|
|
|
|
// alert("Please add at least one product.");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -600,7 +594,7 @@ $(document).ready(async function() {
|
|
|
|
|
else if(className.includes("custom-comp"))
|
|
|
|
|
{
|
|
|
|
|
mapTable = "custom-comp";
|
|
|
|
|
dataMapArray[0].custom_complaint.push({ 'id': id, 'complaint_id' : selectedValue , 'quality' : quality, 'tax': tax, 'amount': amount });
|
|
|
|
|
dataMapArray[0].custom_complaint.push({ 'id': id, 'labour_cost': labour_cost, 'complaint_id' : selectedValue , 'quality' : quality, 'tax': tax, 'amount': amount });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -631,6 +625,7 @@ $(document).ready(async function() {
|
|
|
|
|
// Prevent the default form submission
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
data_contruction_for_save();
|
|
|
|
|
$("#delete_items").val(JSON.stringify(delete_items_id));
|
|
|
|
|
$('#form-submit').submit();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
@ -662,6 +657,17 @@ $(document).ready(async function() {
|
|
|
|
|
|
|
|
|
|
// Event listener for product selection
|
|
|
|
|
$(document).on('change', 'select[name="service_details[]"]', async function() {
|
|
|
|
|
|
|
|
|
|
/*** REMOVE SUBPRODUCT ONCHANGE */
|
|
|
|
|
var $closestTR = $(this).closest('tr');
|
|
|
|
|
while ($closestTR.next().length > 0 && $closestTR.attr('class') != "product") {
|
|
|
|
|
if ($closestTR.next().hasClass('service_class') || $closestTR.next().hasClass('complaint_class') || $closestTR.next().hasClass('custom_complaint_class')) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// Remove the next row
|
|
|
|
|
$closestTR.next().remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get class name of the select element
|
|
|
|
|
var className = $(this).attr('class');
|
|
|
|
|
var productId = $(this).val();
|
|
|
|
|
@ -763,7 +769,7 @@ $(document).ready(async function() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const labourcost = async (data,tr) => {
|
|
|
|
|
var newRow = '<tr class="dummy"><td hidden style="width:10%;"><input type="number" class="form-control labour-cost" name="labour_cost[]"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour-cost" value="Labour Cost"></td>' +
|
|
|
|
|
var newRow = '<tr class="dummy"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
|
|
|
|
'<td style="width:10%;"></td>' +
|
|
|
|
|
'<td style="width:10%;"></td>' +
|
|
|
|
|
'<td style="width:8%;"></td>' +
|
|
|
|
|
@ -779,8 +785,6 @@ $(document).ready(async function() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const service_child_products = async (data,tr) => {
|
|
|
|
|
console.log();
|
|
|
|
|
console.log(JSON.parse(data.product_id));
|
|
|
|
|
JSON.parse(data.product_id).forEach(async(element,index) => {
|
|
|
|
|
if(element == 0) return;
|
|
|
|
|
var product = products.find(function(item) {
|
|
|
|
|
@ -792,13 +796,13 @@ $(document).ready(async function() {
|
|
|
|
|
// Calculate total tax by adding CGST and SGST
|
|
|
|
|
var tax = cgst + sgst;
|
|
|
|
|
|
|
|
|
|
var newRow = '<tr class="service_product_'+$(tr).data('select2Id')+'"><td hidden style="width:10%;"><input type="number" class="form-control labour-cost" name="labour_cost[]"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;">';
|
|
|
|
|
var newRow = '<tr class="product"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;">';
|
|
|
|
|
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>';
|
|
|
|
|
newRow += '</select></td>' +
|
|
|
|
|
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" value="1" name="quantity[]" readonly/></td>' +
|
|
|
|
|
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" value="' + product.unit_price + '" readonly /></td>' +
|
|
|
|
|
'<td style="width:8%;"> <input type="text" class="form-control item-tax" name="item-tax[]" value="' + tax + '" readonly /></td>' +
|
|
|
|
|
'<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]" value="' + product.unit_price + '" readonly/></td>' +
|
|
|
|
|
'<td style="width:12%;"><input type="text" class="form-control item-amount1" name="amount1[]" value="' + product.unit_price + '" readonly/></td>' +
|
|
|
|
|
'<td hidden><input type="hidden"></td>' +
|
|
|
|
|
'<td hidden><input type="hidden" name="id" value=""></td>' +
|
|
|
|
|
'</tr>';
|
|
|
|
|
@ -813,29 +817,25 @@ $(document).ready(async function() {
|
|
|
|
|
|
|
|
|
|
// Event listener for quantity change
|
|
|
|
|
$(document).on('input change', '.item-quantity', async function() {
|
|
|
|
|
// let promise = new Promise((resolve,reject) => {
|
|
|
|
|
calculateAmount($(this).closest('tr'));
|
|
|
|
|
// resolve()
|
|
|
|
|
// })
|
|
|
|
|
// promise.then(() => {
|
|
|
|
|
updateCalculations(); // Added for updating calculations when quantity changes
|
|
|
|
|
// });
|
|
|
|
|
updateCalculations();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).on('click', '.item-quantity', async function() {
|
|
|
|
|
updateCalculations();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Function to calculate subtotal
|
|
|
|
|
function calculateSubtotal() {
|
|
|
|
|
|
|
|
|
|
var subtotal = 0;
|
|
|
|
|
$('.item-amount').each(function() {
|
|
|
|
|
subtotal += parseFloat($(this).val()) || 0;
|
|
|
|
|
});
|
|
|
|
|
return subtotal;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Function to calculate total tax
|
|
|
|
|
function calculateTax() {
|
|
|
|
|
|
|
|
|
|
var tax = 0;
|
|
|
|
|
$('.item-tax').each(function() {
|
|
|
|
|
var taxPercentage = parseFloat($(this).val()) || 0;
|
|
|
|
|
@ -844,11 +844,8 @@ $(document).ready(async function() {
|
|
|
|
|
tax += taxValue;
|
|
|
|
|
});
|
|
|
|
|
return tax;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Function to calculate total discount
|
|
|
|
|
function calculateDiscount() {
|
|
|
|
|
var totalDiscount = 0;
|
|
|
|
|
@ -868,14 +865,12 @@ $(document).ready(async function() {
|
|
|
|
|
|
|
|
|
|
// Function to calculate total
|
|
|
|
|
function calculateTotal() {
|
|
|
|
|
|
|
|
|
|
var subtotal = calculateSubtotal();
|
|
|
|
|
var tax = calculateTax();
|
|
|
|
|
var discount = calculateDiscount();
|
|
|
|
|
var total = subtotal + tax - discount;
|
|
|
|
|
// return total;
|
|
|
|
|
return Math.round(total);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update subtotal, tax, and total
|
|
|
|
|
@ -902,7 +897,7 @@ $(document).ready(async function() {
|
|
|
|
|
console.log(productarray);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var newRow = '<tr class="complaint_product_'+$(this).closest('tr').data('select2Id')+'"><td hidden style="width:10%;"><input type="number" class="form-control labour-cost" name="labour_cost[]"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
|
|
|
|
|
var newRow = '<tr class="product"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" 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++)
|
|
|
|
|
{
|
|
|
|
|
@ -957,7 +952,7 @@ $(document).ready(async function() {
|
|
|
|
|
$('#addcomplaint').click(function() {
|
|
|
|
|
complaint = <?php echo json_encode($complaint) ?>;
|
|
|
|
|
// console.log(productarray);
|
|
|
|
|
var newRow = '<tr class="complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost[]"></td><td><select class="form-control book-select SelExample complaint" id="complaint_detail" name="complaint_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Complaint</option>';
|
|
|
|
|
var newRow = '<tr class="complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><select class="form-control book-select SelExample complaint" id="complaint_detail" name="complaint_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Complaint</option>';
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < complaint.length; i++)
|
|
|
|
|
{
|
|
|
|
|
@ -993,7 +988,7 @@ $(document).ready(async function() {
|
|
|
|
|
$('#addCustomComplaint').click(function() {
|
|
|
|
|
complaint = <?php echo json_encode($complaint) ?>;
|
|
|
|
|
// console.log(productarray);
|
|
|
|
|
var newRow = '<tr class="custom_complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour-cost" name="labour_cost[]"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5"></textarea></td>' +
|
|
|
|
|
var newRow = '<tr class="custom_complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5"></textarea></td>' +
|
|
|
|
|
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" value="1" name="quantity[]" readonly/></td>' +
|
|
|
|
|
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" /></td>' +
|
|
|
|
|
'<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" /></td>' +
|
|
|
|
|
@ -1012,35 +1007,63 @@ $(document).ready(async function() {
|
|
|
|
|
'<td hidden><input type="hidden" name="id" value=""></td>' +
|
|
|
|
|
'</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newRow += '<tr class="dummy"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
|
|
|
|
'<td style="width:10%;"></td>' +
|
|
|
|
|
'<td style="width:10%;"></td>' +
|
|
|
|
|
'<td style="width:8%;"></td>' +
|
|
|
|
|
'<td style="width:12%;"><input type="text" class="form-control item-amount item_dummy" name="amount[]" value="0"/></td>' +
|
|
|
|
|
'<td hidden></td>' +
|
|
|
|
|
'<td hidden></td>' +
|
|
|
|
|
'</tr>';
|
|
|
|
|
$('#productItemTable tbody').append(newRow);
|
|
|
|
|
initializeSelect2();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Event listener for removing item
|
|
|
|
|
$(document).on('input', '.item_dummy', function() {
|
|
|
|
|
var row = $(this).closest('tr');
|
|
|
|
|
var labourCostInput = row.prevAll('.custom_complaint_class:first').find('.labour_cost');
|
|
|
|
|
var dummyValue = $(this).val();
|
|
|
|
|
labourCostInput.val(dummyValue);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/** REMOVE ITEMS FROM THE TABLE **/
|
|
|
|
|
delete_items_id = [{ 'service': [], 'complaint': [], 'custom_complaint': [] }];
|
|
|
|
|
$(document).on('click', '.remove-item', function() {
|
|
|
|
|
var $closestTR = $(this).closest('tr');
|
|
|
|
|
|
|
|
|
|
console.log( );
|
|
|
|
|
|
|
|
|
|
var main_tr_to_remove = $(this).closest('tr').data('select2Id');
|
|
|
|
|
$(this).closest('tr').remove();
|
|
|
|
|
|
|
|
|
|
if ($(this).closest('tr').attr('class') == 'complaint_class') {
|
|
|
|
|
$('.complaint_product_'+main_tr_to_remove).remove();
|
|
|
|
|
|
|
|
|
|
}else if($(this).closest('tr').attr('class') == 'service_class'){
|
|
|
|
|
$('.service_product_'+main_tr_to_remove).remove();
|
|
|
|
|
|
|
|
|
|
}else if($(this).closest('tr').attr('class') == 'custom_complaint_class'){
|
|
|
|
|
$('.service_product_'+main_tr_to_remove).remove();
|
|
|
|
|
|
|
|
|
|
if($closestTR.attr('class') == "service_class")
|
|
|
|
|
{
|
|
|
|
|
id = $closestTR.find('input[name="id"]').val();
|
|
|
|
|
delete_items_id[0].service.push(id);
|
|
|
|
|
console.log(delete_items_id);
|
|
|
|
|
}
|
|
|
|
|
else if($closestTR.attr('class') == "complaint_class")
|
|
|
|
|
{
|
|
|
|
|
id = $closestTR.find('input[name="id"]').val();
|
|
|
|
|
delete_items_id[0].complaint.push(id);
|
|
|
|
|
console.log(delete_items_id);
|
|
|
|
|
}
|
|
|
|
|
else if($closestTR.attr('class') == "custom_complaint_class")
|
|
|
|
|
{
|
|
|
|
|
id = $closestTR.find('input[name="id"]').val();
|
|
|
|
|
delete_items_id[0].complaint.push(id);
|
|
|
|
|
console.log(delete_items_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateCalculations(); // Added for updating calculations when an item is removed
|
|
|
|
|
while ($closestTR.next().length > 0 && $closestTR.attr('class') != "product") {
|
|
|
|
|
if ($closestTR.next().hasClass('service_class') || $closestTR.next().hasClass('complaint_class') || $closestTR.next().hasClass('custom_complaint_class')) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// Remove the next row
|
|
|
|
|
$closestTR.next().remove();
|
|
|
|
|
}
|
|
|
|
|
// Remove the clicked row
|
|
|
|
|
$closestTR.remove();
|
|
|
|
|
updateCalculations();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|