575 lines
28 KiB
PHP
Executable File
575 lines
28 KiB
PHP
Executable File
<?php include('layout/header.php'); ?>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box page-title-box-alt">
|
|
<h4 class="page-title"><?php echo $page_name?></h4>
|
|
<div class="page-title-right">
|
|
<a href="<?= base_url() . "service_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
|
<ol class="breadcrumb m-0">
|
|
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
|
<li class="breadcrumb-item active">Datatables</li> -->
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="header-title"></h4>
|
|
<form action="<?= base_url() . "add_service"; ?>" method="post" id="serviceForm">
|
|
<h4 class="header-title">Service Details :</h4>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label for="inputEmail4" class="col-form-label">Service Name<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="servicename" style="height:32px" placeholder="Service Name" value="<?= isset($services['service_name']) ? $services['service_name'] : '' ?>" required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="inputEmail4" class="col-form-label">Type<span class="text-danger">*</span></label>
|
|
<select class="form-control" id="category" name="category" style="height:32px" required>
|
|
<option value="">Select</option>
|
|
<option value="0" <?= (isset($services['category']) && $services['category'] == 0) ? 'selected' : '' ?> >Common Service</option>
|
|
<option value="1" <?= (isset($services['category']) && $services['category'] == 1) ? 'selected' : '' ?> >Standalone Service</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-3" id="cc_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
|
|
<label for="cubiccapacity" class="col-form-label">Cubic Capacity<span class="text-danger">*</span></label>
|
|
<select class="form-control" id="cubiccapacity" name="cubiccapacity" style="height:32px">
|
|
<option value="">Select</option>
|
|
<?php foreach ($cubiccapacity as $item): ?>
|
|
<option value="<?= $item['id'] ?>" <?php if (isset($services['cubic_capacity_id']) && (($services['cubic_capacity_id'] === $item['id']))) echo "selected"; ?>><?= $item['value'] ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div><br>
|
|
<h4 class="header-title">Select Items :</h4>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="model" class="col-form-label">Product</label>
|
|
<select class="form-control SelExample" id="productSelect" name="product_id[]" multiple>
|
|
<option value="">Select a Product</option>
|
|
<?php if(isset($product)){ foreach ($product as $value) { ?>
|
|
<?php if ((int)$value["isactive"] === 1) : ?>
|
|
<option value="<?= $value["product_id"] ?>" <?= isset($services['product_id']) && is_array(json_decode($services['product_id'])) && in_array($value['product_id'], json_decode($services['product_id'])) ? 'selected' : '' ?>>
|
|
<?= $value["product_name"].($value["manufacturer_name"] ? ' - '.$value["manufacturer_name"] : ''); ?>
|
|
</option>
|
|
<?php endif; ?>
|
|
<?php } }?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-6" id="service_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
|
|
<label for="model" class="col-form-label">Service</label>
|
|
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" multiple>
|
|
<option value="">Select a Service</option>
|
|
<?php foreach ($service as $value) : ?>
|
|
<?php if ((int)$value["isactive"] === 1) : ?>
|
|
<option value="<?= $value["service_id"] ?>" <?= isset($services['sub_service_id']) && is_array(json_decode($services['sub_service_id'])) && in_array($value['service_id'], json_decode($services['sub_service_id'])) ? 'selected' : '' ?>>
|
|
<?= $value["service_name"]; ?>
|
|
</option>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" id="service_id" name="service_id" value="<?= isset($services['service_id']) ? $services['service_id'] : '' ?>"><br>
|
|
<h4 class="header-title">Pricing Information :</h4>
|
|
<div class="form-row">
|
|
<?php
|
|
$cgst = isset($services['cgst']) ? $services['cgst'] : 0; // CGST value (half of the tax amount)
|
|
$sgst = isset($services['sgst']) ? $services['sgst'] : 0; // SGST value (half of the tax amount)
|
|
$tax = $cgst + $sgst; // Total tax (sum of CGST and SGST)
|
|
?>
|
|
<div class="form-group col-md-4">
|
|
<label for="inputPassword4" class="col-form-label">Tax<span class="text-danger">*</span></label>
|
|
<select class="form-control status-select" name="tax" data-toggle="select2" required>
|
|
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>Select Tax</option>
|
|
<option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option>
|
|
<option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-4"></div>
|
|
<div class="form-group col-md-4"></div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<!-- <label for="inputPassword4" class="col-form-label">Unit Price (Including Tax) with General<span class="text-danger">*</span></label> -->
|
|
<label for="inputPassword4" class="col-form-label">Unit Price (Including Tax) General<span class="text-danger">*</span></label>
|
|
<input type="number" class="form-control" name="wg_price_withtax" id="PriceWithTaxAndGeneral" placeholder="Total Price" step="0.01" min="0" value="<?= isset($services['wg_price']) ? $services['wg_price'] : '' ; ?>" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<!-- <label for="inputEmail4" class="col-form-label">Labour Cost with General <span class="text-danger">*</span></label> -->
|
|
<label for="inputEmail4" class="col-form-label">Labour Cost General <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="wg_labour_cost" id="labour_cost" placeholder="Labour Cost" value="<?= isset($services['wg_labour_cost']) ? $services['wg_labour_cost'] : '' ?>" required readonly>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4"></div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<!-- <label for="inputPassword4" class="col-form-label">Unit Price (Including Tax) without General<span class="text-danger">*</span></label> -->
|
|
<label for="inputPassword4" class="col-form-label">Unit Price (Including Tax) Complaints<span class="text-danger">*</span></label>
|
|
<input type="number" class="form-control" name="wog_price_withtax" id="PriceWithOutTaxWithGeneral" placeholder="Total Price" step="0.01" min="0" value="<?= isset($services['wog_price']) ? $services['wog_price'] : ''; ?>" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<!-- <label for="inputEmail4" class="col-form-label">Labour Cost without General <span class="text-danger">*</span></label> -->
|
|
<label for="inputEmail4" class="col-form-label">Labour Cost Complaints <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="wog_labour_cost" id="labour_cost" placeholder="Labour Cost" value="<?= isset($services['wog_labour_cost']) ? $services['wog_labour_cost'] : '' ?>" required readonly>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4"></div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<!-- <label for="inputPassword4" class="col-form-label">Total Price<span class="text-danger">*</span></label> -->
|
|
<!-- <input type="hidden" class="form-control" name="price" id="price" placeholder="Price" value="<?= isset($services['price']) ? $services['price'] : 0 ?>"> -->
|
|
<input type="hidden" class="form-control" name="productCost" id="productCost" placeholder="ProductCost" value="0">
|
|
<input type="hidden" class="form-control" name="serviceCost" id="serviceCost" placeholder="ServiceCost" value="0">
|
|
</div>
|
|
</div>
|
|
<br>
|
|
|
|
|
|
|
|
<h4 class="header-title">Description Details :</h4>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label for="description" class="col-form-label">Description</label>
|
|
<textarea class="form-control" name="description" placeholder="Description" ><?= isset($services['description']) ? $services['description'] : '' ?></textarea>
|
|
</div>
|
|
</div>
|
|
<button id="service_form_submit" type="submit" class="btn btn-primary" style="float:right;">Submit</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php include('layout/footer.php'); ?>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
// Check SGST checkbox by default
|
|
$('#sgstCheckbox').prop('checked', true);
|
|
$('#sgstValue').removeClass('d-none');
|
|
|
|
// Check CGST checkbox by default
|
|
$('#cgstCheckbox').prop('checked', true);
|
|
$('#cgstValue').removeClass('d-none');
|
|
|
|
// Handle change event for SGST checkbox
|
|
$('#sgstCheckbox').change(function() {
|
|
if ($(this).is(":checked")) {
|
|
$('#sgstValue').removeClass('d-none');
|
|
} else {
|
|
$('#sgstValue').addClass('d-none');
|
|
}
|
|
});
|
|
|
|
// Handle change event for CGST checkbox
|
|
$('#cgstCheckbox').change(function() {
|
|
if ($(this).is(":checked")) {
|
|
$('#cgstValue').removeClass('d-none');
|
|
} else {
|
|
$('#cgstValue').addClass('d-none');
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet">
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
// Initialize select2
|
|
$(".SelExample").select2();
|
|
});
|
|
</script>
|
|
<script>
|
|
|
|
|
|
$(document).ready(function() {
|
|
// $('#make').change(function() {
|
|
// var selected_makes = $(this).val(); // Get the selected make ID
|
|
|
|
// console.log(selected_makes);
|
|
// var models_id = $('#model').val();
|
|
// // AJAX request to get models based on the selected make ID
|
|
// $.ajax({
|
|
// url: '<?php // echo base_url('get_models_service') ?>', // URL to your CodeIgniter controller method
|
|
// type: 'POST',
|
|
// dataType: 'json',
|
|
// data: { selected_makes: selected_makes }, // Send the selected make ID to the controller
|
|
// success: function(response) {
|
|
// // console.log(response);
|
|
// // Update models dropdown based on the response
|
|
// if (response.length > 0) {
|
|
// // Clear existing options
|
|
// $('#model').empty();
|
|
// // Iterate through response and models_id
|
|
// $.each(response, function(index, model) {
|
|
// var count =0;
|
|
// // $('#model').empty();
|
|
// $.each(models_id, function(index, model_id) {
|
|
// if (model.model_id == model_id) {
|
|
// // Append option for the model
|
|
// $('#model').append('<option value="' + model.model_id + '" selected>' + model.model_name + '</option>');
|
|
// count =1;
|
|
// }
|
|
|
|
// });
|
|
// if (count == 0) {
|
|
// $('#model').append('<option value="' + model.model_id + '">' + model.model_name + '</option>');
|
|
// }
|
|
|
|
// });
|
|
// } else {
|
|
// // Handle case when no models are found
|
|
// $('#model').empty().append('<option value="">No models found</option>');
|
|
// }
|
|
// },
|
|
// error: function(xhr, status, error) {
|
|
// // Handle error
|
|
// console.error(xhr.responseText);
|
|
// }
|
|
// });
|
|
// });
|
|
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
// $('#model').change(function() {
|
|
// var make_id = $('#make').val(); // Get the selected make ID
|
|
// var model_ids = $('#model').val(); // Get the selected model IDs
|
|
|
|
// // AJAX request to get vendors based on the selected model ID
|
|
// console.log(model_ids);
|
|
// if (model_ids.length > 0) {
|
|
// $.ajax({
|
|
// url: '<?php // echo base_url('get_product_by_models') ?>', // URL to your CodeIgniter controller method
|
|
// type: 'POST',
|
|
// dataType: 'json',
|
|
// data: { make_id: make_id, model_ids: model_ids }, // Send the selected make ID and model IDs to the controller
|
|
// success: function(response) {
|
|
// console.log(response);
|
|
// // Update vendor dropdown based on the response
|
|
// if (response) {
|
|
// // Clear existing options
|
|
// $('#productSelect').empty();
|
|
// // Append new options
|
|
// $('#productSelect').append('<option value>Select Product</option>');
|
|
// $.each(response, function(index, product) {
|
|
// $('#productSelect').append('<option value="' + product.product_id + '">' + product.product_name +' - '+ product.manufacturer_name + '</option>');
|
|
// });
|
|
// } else {
|
|
// // Handle case when no vendors are found for the selected model
|
|
// console.log('No vendors found for the selected model');
|
|
// }
|
|
// },
|
|
// error: function(xhr, status, error) {
|
|
// // Handle error
|
|
// console.error(xhr.responseText);
|
|
// }
|
|
// });
|
|
// }
|
|
// });
|
|
|
|
$('#cubiccapacity').change(function() {
|
|
var cc_id = $(this).val();
|
|
$('#productSelect').empty();
|
|
$('#productSelect').append('<option value="0"> Select Product</option>');
|
|
|
|
if (cubiccapacity) {
|
|
$.ajax({
|
|
url: '<?php echo base_url('get_product_by_cc') ?>',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
data: { cc_id: cc_id }, // Send the selected make ID and model IDs to the controller
|
|
success: function(response) {
|
|
console.log(response);
|
|
// Update vendor dropdown based on the response
|
|
if (response) {
|
|
$.each(response, function(index, product) {
|
|
$('#productSelect').append('<option value="' + product.product_id + '">' +
|
|
product.product_name +
|
|
(product.manufacturer_name ? ' - ' + product.manufacturer_name : '') +
|
|
'</option>');
|
|
});
|
|
} else {
|
|
// Handle case when no vendors are found for the selected model
|
|
console.log('No vendors found for the selected cc');
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
// Handle error
|
|
console.error(xhr.responseText);
|
|
|
|
}
|
|
});
|
|
}else{
|
|
console.log('No vendors found for the selected cc');
|
|
}
|
|
});
|
|
|
|
data = <?php echo json_encode($product) ?>;
|
|
servicedata = <?php echo json_encode($service) ?>;
|
|
if (service_id != 0) {
|
|
|
|
var category = <?php echo isset($services['category']) ? json_encode($services['category']) : 'null'; ?>;
|
|
if (parseInt(category) == 1) {
|
|
$('#cc_hide').css('display', 'block');
|
|
$('#service_hide').css('display' ,'block');
|
|
$('#cubiccapacity').attr('required', true).attr('readonly', false);
|
|
// $('#serviceSelected').attr('required', true).attr('readonly', false);
|
|
} else {
|
|
$('#cc_hide').css('display', 'none');
|
|
$('#service_hide').css('display' ,'none');
|
|
$('#cubiccapacity').attr('required', false).attr('readonly', true);
|
|
$('#serviceSelected').attr('required', false);
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
<script>
|
|
document.getElementById('category').addEventListener('change', function() {
|
|
// var customFields = document.getElementById('customFields');
|
|
// var makeSelect = document.getElementById('make');
|
|
// var modelSelect = document.getElementById('model');
|
|
var ccSelect = document.getElementById('cubiccapacity');
|
|
var serviceSelected = document.getElementById('serviceSelected');
|
|
var productSelect = document.getElementById('productSelect');
|
|
if (parseInt(this.value) == 1) {
|
|
// 1 ==> Standalone
|
|
// customFields.style.display = 'block';
|
|
// $('#make_hide').css('display' , 'block');
|
|
// $('#model_hide').css('display' ,'block');
|
|
$('#cc_hide').css('display' , 'block');
|
|
$('#service_hide').css('display' ,'block');
|
|
$('#cubiccapacity').val('');
|
|
$('#productSelect').empty();
|
|
$('#cubiccapacity').attr('required', true).attr('readonly', false);
|
|
// makeSelect.setAttribute('required', 'required');
|
|
// modelSelect.setAttribute('required', 'required');
|
|
// serviceSelected.setAttribute('required', 'required');
|
|
} else { // 0 ==> Common
|
|
// customFields.style.display = 'none';
|
|
// $('#make_hide').css('display' , 'none');
|
|
// $('#model_hide').css('display' ,'none');
|
|
$('#cc_hide').css('display' , 'none');
|
|
$('#service_hide').css('display' ,'none');
|
|
$('#cubiccapacity').val('');
|
|
$('#productSelect').empty();
|
|
$('#cubiccapacity').attr('required', false).attr('readonly', true);
|
|
$('#serviceSelected').attr('required', false);
|
|
// makeSelect.removeAttribute('required');
|
|
// modelSelect.removeAttribute('required');
|
|
$.ajax({
|
|
url: '<?php echo base_url('product_list_for_service') ?>', // URL to your CodeIgniter controller method
|
|
type: 'GET',
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
console.log(response);
|
|
// Update vendor dropdown based on the response
|
|
if (response) {
|
|
// Clear existing options
|
|
$('#productSelect').empty();
|
|
// Append new options
|
|
$('#productSelect').append('<option value>Select Product</option>');
|
|
$.each(response, function(index, product) {
|
|
$('#productSelect').append('<option value="' + product.product_id + '">' + product.product_name + (product.manufacturer_name ? ' - ' + product.manufacturer_name : '') + '</option>');
|
|
});
|
|
} else {
|
|
// Handle case when no vendors are found for the selected model
|
|
console.log('No vendors found for the selected model');
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
// Handle error
|
|
console.error(xhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
// $('#productSelect').change(function() {
|
|
// console.log('this.value',this.value);
|
|
// if(this.value != 0) {
|
|
// // Get the selected options
|
|
// var selectedOptions = this.selectedOptions;
|
|
|
|
// // Initialize sum
|
|
// var sum = 0;
|
|
|
|
// for (var i = 0; i < selectedOptions.length; i++) {
|
|
// var productId = selectedOptions[i].value;
|
|
// var price = getPriceForProductId(productId);
|
|
// sum += parseInt(price);
|
|
// }
|
|
// $('#productCost').val(parseInt(sum));
|
|
// // console.log(sum);
|
|
|
|
// labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
|
// add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val()) + labour_cost;
|
|
// console.log("New value of #serviceCost:", add);
|
|
|
|
// $('#price').val(add);
|
|
// }
|
|
// else if(this.value == '' ) {
|
|
// $('#productCost').val(0);
|
|
// // labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
|
// labour_cost = ($('#PriceWithTaxAndGeneral').val() == '') ? 0 : parseInt($('#PriceWithTaxAndGeneral').val());
|
|
// add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) + labour_cost;
|
|
// console.log("New value of #serviceCost:", add);
|
|
|
|
// $('#price').val(add);
|
|
// }
|
|
// });
|
|
|
|
// Function to fetch the price for a product
|
|
// function getPriceForProductId(productId) {
|
|
// for (var i = 0; i < data.length; i++) {
|
|
// if (data[i].product_id === productId) {
|
|
// // Return the purchase_cost if the product_id matches
|
|
// return data[i].unit_price;
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// $('#serviceSelected').change(function() {
|
|
// // console.log(this.value);
|
|
// if(this.value != 0) {
|
|
// // Get the selected options
|
|
// var selectedOptions = this.selectedOptions;
|
|
// // Initialize sum
|
|
// var ssum = 0;
|
|
|
|
// for (var i = 0; i < selectedOptions.length; i++) {
|
|
// var serviceId = selectedOptions[i].value;
|
|
// var sprice = getPriceForServiceId(serviceId);
|
|
// ssum += parseInt(sprice);
|
|
// }
|
|
// $('#serviceCost').val(parseInt(ssum));
|
|
// // console.log(ssum);
|
|
|
|
// // labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
|
|
// add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
|
|
// // console.log("New value of #serviceCost:", add);
|
|
// $('#price').val(add);
|
|
// }
|
|
// else if(this.value == '') {
|
|
// $('#serviceCost').val(0);
|
|
// // labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
|
|
// add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
|
|
// // console.log("New value of #serviceCost:", add);
|
|
// $('#price').val(add);
|
|
// }
|
|
// });
|
|
|
|
// Function to fetch the price for a product
|
|
// function getPriceForServiceId(serviceId) {
|
|
// // console.log(serviceId);
|
|
// for (var i = 0; i < servicedata.length; i++) {
|
|
// if (servicedata[i].service_id === serviceId) {
|
|
// // Return the purchase_cost if the product_id matches
|
|
// return servicedata[i].price;
|
|
// }
|
|
// }
|
|
// }
|
|
</script>
|
|
|
|
<script>
|
|
$('#labour_cost').on('keyup change', function() {
|
|
var newValue = ($(this).val() == '') ? 0 : $(this).val();
|
|
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val()) + parseInt(newValue);
|
|
$('#price').val(add);
|
|
});
|
|
|
|
|
|
$(document).ready(function() {
|
|
function unitPriceWithGeneralReverseCalculation() {
|
|
var tax = parseFloat($("select[name='tax']").val());
|
|
if(tax == ''){
|
|
toastr.warning('Please select Tax', 'Warning');
|
|
}else{
|
|
var wg_price_withtax = parseFloat($("input[name='wg_price_withtax']").val());
|
|
var wg_labour_cost = wg_price_withtax / parseFloat((tax / 100) + 1);
|
|
if (!isNaN(wg_labour_cost)) {
|
|
$("input[name='wg_labour_cost']").val(wg_labour_cost.toFixed(2));
|
|
}
|
|
}
|
|
}
|
|
|
|
function unitPriceWithoutGeneralReverseCalculation() {
|
|
var tax = parseFloat($("select[name='tax']").val());
|
|
if(tax == ''){
|
|
toastr.warning('Please select Tax', 'Warning');
|
|
}else{
|
|
var wog_price_withtax = parseFloat($("input[name='wog_price_withtax']").val());
|
|
var wog_labour_cost = wog_price_withtax / parseFloat((tax / 100) + 1);
|
|
if (!isNaN(wog_labour_cost)) {
|
|
$("input[name='wog_labour_cost']").val(wog_labour_cost.toFixed(2));
|
|
}
|
|
}
|
|
}
|
|
|
|
$("input[name='wg_price_withtax'], select[name='tax']").change(function() {
|
|
unitPriceWithGeneralReverseCalculation();
|
|
});
|
|
|
|
$("input[name='wog_price_withtax'], select[name='tax']").change(function() {
|
|
unitPriceWithoutGeneralReverseCalculation();
|
|
});
|
|
});
|
|
|
|
$('#service_form_submit').click(function (event) {
|
|
|
|
// if(!$('#PriceWithTaxAndGeneral').val()){
|
|
// // event.preventDefault();
|
|
|
|
// $('form').serialize();
|
|
// }
|
|
|
|
})
|
|
// Prevent multiple submissions by disabling the button on first click
|
|
document.querySelector('#serviceForm').addEventListener('submit', function (e) {
|
|
const submitButton = this.querySelector('button[type="submit"]');
|
|
var labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
|
var add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val()) + labour_cost;
|
|
$('#price').val(add);
|
|
submitButton.disabled = true; // Disable the button
|
|
submitButton.textContent = 'Processing...'; // Optional: Show loading text
|
|
});
|
|
</script>
|
|
|
|
|
|
<style>
|
|
.select2-container .select2-selection--multiple .select2-selection__choice{
|
|
padding: 5px 7px 5px 0 !important;
|
|
color: #000000;
|
|
|
|
}
|
|
.select2-container--default .select2-results__option--highlighted[aria-selected]{
|
|
color:#ffffff;
|
|
background-color: #526dee;
|
|
}
|
|
.select2-container--default .select2-results__option{
|
|
border-bottom: 1px solid #dddddd;
|
|
}
|
|
.select2-container--default .select2-results__option[aria-selected=true]{
|
|
color: #000000;
|
|
background-color: #3efba4;
|
|
font-weight: 500;
|
|
border-bottom: 1px solid #747474;
|
|
}
|
|
|
|
|
|
</style>
|
|
|