CHANGE_TRACKER_ISSUE_RESOLVED : AADHAVAN
This commit is contained in:
parent
e591304bcb
commit
0df5e1a01f
@ -214,4 +214,6 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
$routes->get('outsourcing_index', 'Outsourcing::outsourcing_index');
|
||||
$routes->post('create_os', 'Outsourcing::create_os');
|
||||
$routes->get('edit_os/(:any)', 'Outsourcing::edit_OS/$1');
|
||||
$routes->get("delete_outsource/(:any)", "Outsourcing::delete_outsource/$1");
|
||||
|
||||
// Complaint End's
|
||||
|
||||
@ -75,5 +75,21 @@ class Outsourcing extends BaseController
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
public function delete_outsource($id)
|
||||
{
|
||||
|
||||
if (!empty($id)) {
|
||||
$OutsourceModel = new OutsourceModel();
|
||||
$data['is_active'] = 0;
|
||||
if ($OutsourceModel->update($id, $data)) {
|
||||
// Return success response
|
||||
return redirect()->to('outsourcing_index');
|
||||
}
|
||||
}
|
||||
|
||||
// Return error response if deletion fails
|
||||
return $this->response->setJSON(['success' => false]);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -429,7 +429,12 @@ class Products extends BaseController
|
||||
|
||||
public function product_list_for_service(){
|
||||
$ProductModel = new ProductModel();
|
||||
$products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||
// Assuming you have a model for products and one for manufacturers
|
||||
$products = $ProductModel
|
||||
->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('products.branch_id', $this->session->get('logged_user_branch_id'))
|
||||
->findAll();
|
||||
|
||||
return $this->response->setJSON($products);
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ class ReturnOrder extends BaseController
|
||||
$return = $this->returnModel->findAll();
|
||||
$data['return']=$return;
|
||||
|
||||
// echo "<pre>";
|
||||
// dd($data);
|
||||
return view('return_order_liist',$data);
|
||||
}
|
||||
@ -97,7 +98,7 @@ class ReturnOrder extends BaseController
|
||||
$purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->where('received_qty >', 0)->where('is_selected', 1)->findAll();
|
||||
$data['purchase_product'] = $purchase_product;
|
||||
|
||||
|
||||
|
||||
echo view('return_order_form',$data);
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ class Sales extends BaseController
|
||||
->join('manufacturer', 'products.manufacturer_id = manufacturer.manufacturer_id')
|
||||
->where('products.isactive', 1)
|
||||
->where('products.branch_id', $this->session->get('logged_user_branch_id'))
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
// echo "<pre>";
|
||||
// print_r($product);die;
|
||||
@ -111,6 +112,7 @@ class Sales extends BaseController
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId1 . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId1 . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive',1)
|
||||
->findAll();
|
||||
$product = array_merge($common_product, $makemodelproduct);
|
||||
|
||||
@ -477,6 +479,7 @@ public function getProducts()
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
|
||||
$encodedMakeId = json_encode(['0']);
|
||||
@ -487,6 +490,7 @@ public function getProducts()
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
$product = array_merge($common_product, $makeproduct);
|
||||
|
||||
|
||||
@ -239,8 +239,15 @@ class Service extends BaseController
|
||||
$products = [];
|
||||
array_push($model_ids,'0');
|
||||
foreach ($model_ids as $modelId) {
|
||||
$product = $ProductModel->where('JSON_CONTAINS(models_id, \'["' . $modelId . '"]\')', null, false)
|
||||
->findAll();
|
||||
// Assuming $ProductModel is your Product model class
|
||||
// and you have a Manufacturer model class for the manufacturers table
|
||||
|
||||
$product = $ProductModel->select('products.*, manufacturer.manufacturer_name AS manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('products.isactive', 1)
|
||||
->where('JSON_CONTAINS(products.models_id, \'["' . $modelId . '"]\')', null, false)
|
||||
->findAll();
|
||||
|
||||
$products = array_merge($products, $product);
|
||||
}
|
||||
|
||||
@ -282,7 +289,7 @@ class Service extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($formatted_models);die;
|
||||
// Send the formatted models as JSON response back to the client
|
||||
return $this->response->setJSON($formatted_models);
|
||||
}
|
||||
|
||||
@ -62,8 +62,9 @@ class Vehicle extends BaseController
|
||||
$client=$ClientModel->where('branch_id', $this->session->get('logged_user_branch_id'))->findAll();
|
||||
$data['client']=$client;
|
||||
}
|
||||
// dd($vehicle);
|
||||
$data['vehicle_id'] = $vehicle_id;
|
||||
$data['makeData'] =$this->bikeMakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
$data['makeData'] =$this->bikeMakeModel->where('make_id', $vehicle['make'])->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
|
||||
return view('vehicle_form',$data);
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ class PurchaseOrderModel extends Model
|
||||
public function getPurchaseOrdersWithProducts($logged_user_branch_id)
|
||||
{
|
||||
// Select required fields from both tables
|
||||
$this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name,SUM(purchase_order_child.qty) AS purchase_qty ');
|
||||
$this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name,SUM(purchase_order_child.qty) AS purchase_qty, purchase_order_child.received_qty');
|
||||
|
||||
// Join the sales_order_product table based on sales_order_id
|
||||
$this->join('purchase_order_child', 'purchase_order_child.purchase_order_id = purchase_order.purchase_order_id');
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
<td style="width:10%;">
|
||||
|
||||
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;" readonly>
|
||||
<option value="">Select a Product</option>
|
||||
<!-- <option value="">Select a Product</option> -->
|
||||
<?php foreach ($product as $value) : ?>
|
||||
<?php if ($value['per'] == 'ml') {
|
||||
$value_ml = ' ('.$value['ml'].$value['per'].')';
|
||||
@ -133,7 +133,7 @@
|
||||
$value_ml = '';
|
||||
}
|
||||
?>
|
||||
<?php if ((int)$value["isactive"] === 1) : ?>
|
||||
<?php if ((int)$value["isactive"] === 1 && $purchasechild['product_id'] == $value["product_id"]) : ?>
|
||||
<option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>>
|
||||
<?= $value["product_name"].$value_ml. ' - '.$value['manufacturer_name']; ?>
|
||||
</option>
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<!-- Start Biake Mnufacturer Create Pop-UP -->
|
||||
<div id="manufacturer_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div id="manufacturer_modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
@ -83,7 +83,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitManufacturer(this)">Submit</button>
|
||||
<button class="btn btn-rounded btn-primary" id="manufacturer_submit" type="submit" onclick="submitManufacturer(this)">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@ -117,7 +117,7 @@
|
||||
if (!$('#manufacturer_name').val() || !$('#quality').val()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#manufacturer_submit').attr('disabled','true');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."create_manufacturer/"?>'+edit_manufacturer_id,
|
||||
@ -125,7 +125,7 @@
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#manufacturer_modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a data-toggle="modal" data-target="#os-add-modal" data-value="<?php echo $value['id']; ?>" onclick="editOS(this)" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_complaint/" . $value['id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "delete_outsource/" . $value['id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -70,7 +70,7 @@
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4 id="form_add_edit">Add Outsourcing</h4>
|
||||
</div>
|
||||
<form id="model_form_data" class="px-3">
|
||||
<form id="outsource_form" class="px-3">
|
||||
<div class="form-group">
|
||||
<label for="name">Name </label>
|
||||
<input class="form-control" type="text" id="id" hidden>
|
||||
@ -80,14 +80,14 @@
|
||||
<div class="form-group">
|
||||
<label for="labour_charge">Tax </label>
|
||||
<select class="form-control status-select" id="tax" name="tax" required data-toggle="select2" onchange="ReverseCalculation()">
|
||||
<option value="0">Select Tax</option>
|
||||
<option value="">Select Tax</option>
|
||||
<option value="18">18%</option>
|
||||
<option value="28" >28%</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cost_with_tax">Labour Charge + Tax</label>
|
||||
<input class="form-control" type="text" id="cost_with_tax" placeholder="Labour Charge + Tax" onkeyup="ReverseCalculation()" required>
|
||||
<input class="form-control" type="text" id="cost_with_tax" name="cost_with_tax" placeholder="Labour Charge + Tax" onkeyup="ReverseCalculation()" required="">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="labour_cost">Labour Cost </label>
|
||||
@ -98,7 +98,7 @@
|
||||
<input class="form-control" type="text" id="description" placeholder="Description" >
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitComplaint(this)">Submit</button>
|
||||
<button class="btn btn-rounded btn-primary" type="submit" id="outsource_submit_button" onclick="submitComplaint(this, event)">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -125,10 +125,14 @@
|
||||
}
|
||||
|
||||
|
||||
function submitComplaint(params) {
|
||||
if (!$('#name').val() || !$('#labour_cost').val()) {
|
||||
function submitComplaint(params, event) {
|
||||
if (!$('#name').val() || !$('#labour_cost').val() ) {
|
||||
return false;
|
||||
}
|
||||
if(!$('#cost_with_tax').val()){
|
||||
return false;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
id: $('#id').val(),
|
||||
name: $('#name').val(),
|
||||
@ -137,16 +141,17 @@
|
||||
cost_with_tax: $('#cost_with_tax').val(),
|
||||
description: $('#description').val(),
|
||||
};
|
||||
|
||||
$('#outsource_submit_button').attr('disabled', 'true');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."create_os"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
// $('#outsource_submit_button').removeAttr('disabled');
|
||||
console.log(response);
|
||||
// Reload the page after successful submission
|
||||
// window.location.reload();
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
@ -190,7 +195,7 @@
|
||||
|
||||
function clearDetials(params) {
|
||||
$('#form_add_edit').text('Add Complaint');
|
||||
$('#model_form_data')[0].reset();
|
||||
$('#outsource_form')[0].reset();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
<input type="text" class="form-control" name="hsn_sac" placeholder="HSN/SAC" value="<?= isset($products['hsn_sac']) ? $products['hsn_sac'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputEmail4" class="col-form-label">Product Category<span class="text-danger"></span></label>
|
||||
<label for="inputEmail4" class="col-form-label">Product Category<span class="text-danger">*</span></label>
|
||||
<select class="form-control status-select SelExample" name="productcategory" required data-toggle="select2">
|
||||
<option value="" >Select Category</option>
|
||||
<option value="Bearings" <?= (isset($products['product_category']) && $products['product_category'] == 'Tanks') ? 'selected' : '' ?>>Tanks</option>
|
||||
|
||||
@ -167,7 +167,7 @@
|
||||
<tr>
|
||||
<td style="width:10%;">
|
||||
|
||||
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
|
||||
<select class="form-control book-select SelExample purchase_order_product_edit" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;" readonly>
|
||||
<option value="">Select a Product</option>
|
||||
<?php foreach ($product as $value) : ?>
|
||||
<?php if ($value['per'] == 'ml') {
|
||||
@ -343,7 +343,7 @@ $(document).ready(function() {
|
||||
// Access unit price from product and set it as rate
|
||||
var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary
|
||||
$(this).closest('tr').find('.item-rate').val(unitPrice);
|
||||
|
||||
$(quantity).attr('max', product.qty_stock);
|
||||
// Calculate amount and update amount input field
|
||||
calculateAmount($(this).closest('tr'));
|
||||
});
|
||||
@ -424,19 +424,28 @@ $(document).ready(function() {
|
||||
// Event listener for "Add More Item" button
|
||||
$('#addItem').click(function() {
|
||||
if ($('#vendor_id').val() != 0) {
|
||||
// console.log(productarray);
|
||||
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>';
|
||||
console.log(productarray);
|
||||
|
||||
var valuesArray = $('.purchase_order_product').map(function() {
|
||||
return $(this).val();
|
||||
}).get();
|
||||
|
||||
console.log(valuesArray);
|
||||
var newRow = '<tr>' + '<td><select class="form-control book-select SelExample purchase_order_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++)
|
||||
{
|
||||
var product = productarray[i];
|
||||
|
||||
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>';
|
||||
}
|
||||
if (valuesArray.indexOf(product.product_id.toString()) === -1) {
|
||||
|
||||
newRow += '<option value="' + product.product_id + '">' + product.product_name + value_ml +" - " + product.manufacturer_name + '</option>';
|
||||
}
|
||||
}
|
||||
newRow += '</select></td>' +
|
||||
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" name="quantity[]"/></td>' +
|
||||
|
||||
@ -610,6 +619,17 @@ $('#editaddbutton').click(function(event) {
|
||||
$(this).prev('input[type="hidden"]').val('unchecked'); // Set value to '0'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(".purchase_order_product_edit").next(".select2-container").css({
|
||||
'pointer-events': 'none',
|
||||
});
|
||||
// $('#select2-insurer-container').css({
|
||||
// 'background-color': '#ebebe0',
|
||||
// });
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -546,10 +546,9 @@ $('#editaddbutton').click(function(event) {
|
||||
$('#vendor_id').prop('disabled', false);
|
||||
|
||||
if ($('.return_order_product:checked').length > 0) {
|
||||
alert('At least one checkbox is checked.');
|
||||
} else {
|
||||
event.preventDefault();
|
||||
alert('No checkboxes are checked.');
|
||||
toastr.warning("Please Check at least one Product.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($purchase as $value) :
|
||||
if ($value['status'] =='Received') : ?>
|
||||
if ($value['status'] =='Received' && $value['received_qty'] > 0) : ?>
|
||||
<tr>
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
@ -86,8 +86,8 @@
|
||||
|
||||
<td>
|
||||
<a href="<?= "new_return/" . $value['purchase_order_id']; ?>" class="edit-button" title="Create Purchase Return"><i class="fa fa-plus-circle" style="font-size: 20px;"></i></a>
|
||||
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button" title="Delete"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>
|
||||
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button" title="Download"><i class="ri-download-2-fill" style="font-size: 20px;"></i></a>
|
||||
<!-- <a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button" title="Delete"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a> -->
|
||||
<!-- <a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button" title="Download"><i class="ri-download-2-fill" style="font-size: 20px;"></i></a> -->
|
||||
</td>
|
||||
|
||||
<?php endif?>
|
||||
|
||||
@ -450,7 +450,7 @@ $(document).ready(function() {
|
||||
general: 1
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
// console.log(response);
|
||||
// Populate make and model in the input field
|
||||
var makeAndModel = response.makeName + ' ' + response.modelName;
|
||||
$('#makeAndModel').val(makeAndModel);
|
||||
@ -571,12 +571,13 @@ $(document).ready(function() {
|
||||
var quantity = $(this).closest('tr').find('.item-quantity').val(1);
|
||||
|
||||
|
||||
|
||||
console.log(products);
|
||||
console.log(productId);
|
||||
// Find product details from JSON
|
||||
var product = products.find(function(item) {
|
||||
return item.product_id == productId;
|
||||
});
|
||||
|
||||
console.log(product);
|
||||
var cgst = parseInt(product.cgst);
|
||||
var sgst = parseInt(product.sgst);
|
||||
var totalTax = cgst + sgst;
|
||||
@ -699,7 +700,7 @@ $(document).ready(function() {
|
||||
var rowProductid = $(this).val();
|
||||
selected_pr.push(rowProductid);
|
||||
});
|
||||
|
||||
console.log(productarray);
|
||||
if(productarray == 'No Product'){
|
||||
toastr.warning("First Add the Product!");
|
||||
}else if (productarray.length > 0) {
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
</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[]" require multiple>
|
||||
<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) : ?>
|
||||
@ -91,13 +91,13 @@
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Tax</label>
|
||||
<select class="form-control status-select" name="tax" required data-toggle="select2">
|
||||
<select class="form-control status-select" name="tax" data-toggle="select2" required>
|
||||
<?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)
|
||||
?>
|
||||
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>Select Tax</option>
|
||||
<option value="" <?= ($tax == 0) ? 'selected' : '' ?>>Select Tax</option>
|
||||
<option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option>
|
||||
<option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
|
||||
</select>
|
||||
@ -109,12 +109,12 @@
|
||||
|
||||
if(isset($services['labour_cost'])){
|
||||
$labour_cost = ($services['labour_cost'] / 100) * $tax;
|
||||
$labour_cost = $labour_cost + $services['labour_cost'];
|
||||
$labour_cost = round($labour_cost + $services['labour_cost']);
|
||||
}else{
|
||||
$labour_cost = 0;
|
||||
$labour_cost = '';
|
||||
}
|
||||
?>
|
||||
<input type="number" class="form-control" name="labour_cost_With_Tax" id="LabourCostWithTax" placeholder="Labour Cost + Tax" value="<?= round($labour_cost); ?>" required>
|
||||
<input type="text" class="form-control" name="labour_cost_With_Tax" id="LabourCostWithTax" placeholder="Labour Cost + Tax" value="<?= $labour_cost; ?>" required="">
|
||||
</div>
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Total Price<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="price" id="price" placeholder="Price"value="<?= isset($services['price']) ? $services['price'] : '' ?>" required>
|
||||
<input type="number" class="form-control" name="price" id="price" placeholder="Price"value="<?= isset($services['price']) ? $services['price'] : '' ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@ -141,7 +141,7 @@
|
||||
<textarea class="form-control" name="description" placeholder="Description" ><?= isset($services['description']) ? $services['description'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<button id="service_form_submit" type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -197,7 +197,7 @@ $(document).ready(function() {
|
||||
$('#make').change(function() {
|
||||
var selected_makes = $(this).val(); // Get the selected make ID
|
||||
|
||||
// console.log(selected_makes);
|
||||
console.log(selected_makes);
|
||||
var models_id = $('#model').val();
|
||||
// AJAX request to get models based on the selected make ID
|
||||
$.ajax({
|
||||
@ -214,6 +214,7 @@ $(document).ready(function() {
|
||||
// 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
|
||||
@ -247,7 +248,9 @@ $(document).ready(function() {
|
||||
var model_ids = $('#model').val(); // Get the selected model IDs
|
||||
|
||||
// AJAX request to get vendors based on the selected model ID
|
||||
$.ajax({
|
||||
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',
|
||||
@ -273,6 +276,7 @@ $(document).ready(function() {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -292,7 +296,7 @@ document.getElementById('category').addEventListener('change', function() {
|
||||
$('#service_hide').css('display' ,'block');
|
||||
makeSelect.setAttribute('required', 'required');
|
||||
modelSelect.setAttribute('required', 'required');
|
||||
serviceSelected.setAttribute('required', 'required');
|
||||
// serviceSelected.setAttribute('required', 'required');
|
||||
} else {
|
||||
// customFields.style.display = 'none';
|
||||
$('#make_hide').css('display' , 'none');
|
||||
@ -315,7 +319,7 @@ document.getElementById('category').addEventListener('change', function() {
|
||||
// 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 + '</option>');
|
||||
$('#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
|
||||
@ -456,6 +460,16 @@ document.getElementById('category').addEventListener('change', function() {
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#service_form_submit').click(function (event) {
|
||||
|
||||
// if(!$('#LabourCostWithTax').val()){
|
||||
// // event.preventDefault();
|
||||
|
||||
// $('form').serialize();
|
||||
// }
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@ -478,5 +492,7 @@ document.getElementById('category').addEventListener('change', function() {
|
||||
font-weight: 500;
|
||||
border-bottom: 1px solid #747474;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($vehicle['mobile_no']) ? $vehicle['mobile_no'] : '' ?>" required maxlength="10" minlength="10">
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($vehicle['mobile_no']) ? $vehicle['mobile_no'] : '' ?>" required maxlength="17" minlength="6">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Email</label>
|
||||
@ -443,14 +443,22 @@ $('#saveModelBtn').click(function() {
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var vehicle = <?php echo json_encode($vehicle); ?>;
|
||||
console.log(vehicle);
|
||||
|
||||
if (vehicle && vehicle.reg_no) {
|
||||
$('#regno').val(vehicle.reg_no).attr('readonly', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#form_submit_button').click(function () {
|
||||
// var isValid = $('#vehicle_add_form_id')[0].checkValidity();
|
||||
|
||||
var register_number = $('#regno').val();
|
||||
|
||||
if (register_number) {
|
||||
if(!$('#vehicle_id').val()){
|
||||
if (register_number) {
|
||||
$.ajax({
|
||||
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for fetching models
|
||||
type: 'POST',
|
||||
@ -469,7 +477,7 @@ $('#saveModelBtn').click(function() {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user