CHANGE_JOB_CAR_SERVICE_COMPLIANT_PRODUCT_REMOVE : AADHAVAN
This commit is contained in:
parent
4c6a88db01
commit
0ffaae5057
@ -657,6 +657,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const service_child_products = async (data,tr) => {
|
const service_child_products = async (data,tr) => {
|
||||||
|
console.log();
|
||||||
console.log(JSON.parse(data.product_id));
|
console.log(JSON.parse(data.product_id));
|
||||||
JSON.parse(data.product_id).forEach(async(element,index) => {
|
JSON.parse(data.product_id).forEach(async(element,index) => {
|
||||||
if(element == 0) return;
|
if(element == 0) return;
|
||||||
@ -669,7 +670,7 @@
|
|||||||
// Calculate total tax by adding CGST and SGST
|
// Calculate total tax by adding CGST and SGST
|
||||||
var tax = cgst + sgst;
|
var tax = cgst + sgst;
|
||||||
|
|
||||||
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;">';
|
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;">';
|
||||||
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>';
|
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>';
|
||||||
newRow += '</select></td>' +
|
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="number" class="form-control item-quantity" min="0" value="1" name="quantity[]" readonly/></td>' +
|
||||||
@ -774,7 +775,7 @@
|
|||||||
// Event listener for "Add More Item" button
|
// Event listener for "Add More Item" button
|
||||||
$(document).on('click', '#addProduct', function() {
|
$(document).on('click', '#addProduct', function() {
|
||||||
|
|
||||||
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;"><option value="">Select a Product</option>';
|
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>';
|
||||||
|
|
||||||
for (var i = 0; i < productarray.length; i++)
|
for (var i = 0; i < productarray.length; i++)
|
||||||
{
|
{
|
||||||
@ -802,7 +803,7 @@
|
|||||||
$('#addService').click(function() {
|
$('#addService').click(function() {
|
||||||
servicearray = <?php echo json_encode($service_1) ?>;
|
servicearray = <?php echo json_encode($service_1) ?>;
|
||||||
// console.log(servicearray);
|
// console.log(servicearray);
|
||||||
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 service" name="service_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Service</option>';
|
var newRow = '<tr class="service_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 service" name="service_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Service</option>';
|
||||||
|
|
||||||
for (var i = 0; i < servicearray.length; i++)
|
for (var i = 0; i < servicearray.length; i++)
|
||||||
{
|
{
|
||||||
@ -829,7 +830,7 @@
|
|||||||
$('#addcomplaint').click(function() {
|
$('#addcomplaint').click(function() {
|
||||||
complaint = <?php echo json_encode($complaint) ?>;
|
complaint = <?php echo json_encode($complaint) ?>;
|
||||||
// console.log(productarray);
|
// 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[]"></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++)
|
for (var i = 0; i < complaint.length; i++)
|
||||||
{
|
{
|
||||||
@ -865,7 +866,7 @@
|
|||||||
$('#addCustomComplaint').click(function() {
|
$('#addCustomComplaint').click(function() {
|
||||||
complaint = <?php echo json_encode($complaint) ?>;
|
complaint = <?php echo json_encode($complaint) ?>;
|
||||||
// console.log(productarray);
|
// console.log(productarray);
|
||||||
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"></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="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: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>' +
|
'<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" /></td>' +
|
||||||
@ -892,7 +893,24 @@
|
|||||||
|
|
||||||
// Event listener for removing item
|
// Event listener for removing item
|
||||||
$(document).on('click', '.remove-item', function() {
|
$(document).on('click', '.remove-item', function() {
|
||||||
|
|
||||||
|
console.log( );
|
||||||
|
|
||||||
|
var main_tr_to_remove = $(this).closest('tr').data('select2Id');
|
||||||
$(this).closest('tr').remove();
|
$(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
|
updateCalculations(); // Added for updating calculations when an item is removed
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user