diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php index dbd49bc..99986e5 100644 --- a/app/Views/job_card_form.php +++ b/app/Views/job_card_form.php @@ -657,6 +657,7 @@ } 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; @@ -669,7 +670,7 @@ // Calculate total tax by adding CGST and SGST var tax = cgst + sgst; - var newRow = '' + '' + @@ -774,7 +775,7 @@ // Event listener for "Add More Item" button $(document).on('click', '#addProduct', function() { - var newRow = '' + + var newRow = ' ' + '' + '' + '' + @@ -892,7 +893,24 @@ // Event listener for removing item $(document).on('click', '.remove-item', function() { + + 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(); + + } + + updateCalculations(); // Added for updating calculations when an item is removed }); });