FIX_remove_conflict:ss

This commit is contained in:
sriramv 2024-04-29 09:00:04 +05:30
commit e6f67575e1
19 changed files with 168 additions and 118 deletions

View File

@ -109,6 +109,7 @@ $routes->get('vehicle_index/', 'Vehicle::vehicle_index');
$routes->post("add_vehicle", "Vehicle::add_vehicle"); $routes->post("add_vehicle", "Vehicle::add_vehicle");
$routes->get("new_vehicle/(:any)", "Vehicle::new_vehicle/$1"); $routes->get("new_vehicle/(:any)", "Vehicle::new_vehicle/$1");
$routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1"); $routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1");
$routes->post("get_models_vehicle", "Vehicle::get_models");
//end Vehicle //end Vehicle

View File

@ -62,11 +62,12 @@ class Products extends BaseController
$tax=$ProductModel->getTax(); $tax=$ProductModel->getTax();
$data['tax']=$tax; $data['tax']=$tax;
$BikemakeModel = new BikemakeModel(); $BikemakeModel = new BikemakeModel();
$data['make'] = $BikemakeModel->findAll(); $data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$VendorModel = new VendorModel(); $VendorModel = new VendorModel();
$data['vendors']=$VendorModel->findAll(); $data['vendors']=$VendorModel->findAll();
$ManufacturerModel = new ManufacturerModel(); $ManufacturerModel = new ManufacturerModel();
$data['manufacturers']=$ManufacturerModel->findAll();
$data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$data['page_name']="Add Product"; $data['page_name']="Add Product";
$data['vendorsProduct'] =[]; $data['vendorsProduct'] =[];
} else if ($product_id !== '0') { } else if ($product_id !== '0') {
@ -81,7 +82,7 @@ class Products extends BaseController
$data['products']=$products; $data['products']=$products;
$BikemakeModel = new BikemakeModel(); $BikemakeModel = new BikemakeModel();
$data['make'] = $BikemakeModel->findAll(); $data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$BikemodelsModel = new BikemodelsModel(); $BikemodelsModel = new BikemodelsModel();
$make_id = $products['make_id']; $make_id = $products['make_id'];
$BikemodelsModel = new BikemodelsModel(); $BikemodelsModel = new BikemodelsModel();
@ -89,6 +90,7 @@ class Products extends BaseController
$models = []; $models = [];
if( $products['make_id'] != null) { if( $products['make_id'] != null) {
foreach ($products['make_id'] as $make_id) { foreach ($products['make_id'] as $make_id) {
// $models[] = $BikemodelsModel->where('make_id', $make_id)->findAll();
$models[] = $BikemodelsModel->where('make_id', $make_id)->findAll(); $models[] = $BikemodelsModel->where('make_id', $make_id)->findAll();
} }
} }
@ -99,7 +101,7 @@ class Products extends BaseController
$VendorModel = new VendorModel(); $VendorModel = new VendorModel();
$data['vendors']=$VendorModel->findAll(); $data['vendors']=$VendorModel->findAll();
$ManufacturerModel = new ManufacturerModel(); $ManufacturerModel = new ManufacturerModel();
$data['manufacturers']=$ManufacturerModel->findAll(); $data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$vendorIds = json_decode($products['vendor'], true); $vendorIds = json_decode($products['vendor'], true);
@ -275,7 +277,7 @@ class Products extends BaseController
if ($make_ids) { if ($make_ids) {
foreach ($make_ids as $make_id) { foreach ($make_ids as $make_id) {
// Fetch models based on the selected make ID // Fetch models based on the selected make ID
$models = $BikemodelsModel->where('make_id', $make_id)->findAll(); $models = $BikemodelsModel->where('make_id', $make_id)->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
// Iterate over each fetched model and format it as needed // Iterate over each fetched model and format it as needed
foreach ($models as $model) { foreach ($models as $model) {

View File

@ -36,7 +36,6 @@ class ReturnOrder extends BaseController
$return = $this->returnModel->findAll(); $return = $this->returnModel->findAll();
$data['return']=$return; $data['return']=$return;
return view('return_order_liist',$data); return view('return_order_liist',$data);
} }
@ -45,7 +44,7 @@ class ReturnOrder extends BaseController
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ReturnModel = new ReturnModel(); $ReturnModel = new ReturnModel();
$return_orders = $ReturnModel->select('return_order.*, vendor.vendor_name as vendor_name, COUNT(return_order_child.return_order_id) AS return_count') $return_orders = $ReturnModel->select('return_order.*, vendor.vendor_name as vendor_name, COUNT(return_order_child.return_order_id) AS return_count, SUM(return_order_child.qty) AS return_qty')
->join('vendor', 'vendor.vendor_id = return_order.vendor_id') ->join('vendor', 'vendor.vendor_id = return_order.vendor_id')
->join('return_order_child', 'return_order_child.return_order_id = return_order.return_order_id', 'left') ->join('return_order_child', 'return_order_child.return_order_id = return_order.return_order_id', 'left')
->where('return_order.branch_id', $this->session->get('logged_user_branch_id')) ->where('return_order.branch_id', $this->session->get('logged_user_branch_id'))

View File

@ -76,7 +76,7 @@ class Service extends BaseController
$tax=$ServiceModel->getTax(); $tax=$ServiceModel->getTax();
$data['tax']=$tax; $data['tax']=$tax;
$BikemakeModel = new BikemakeModel(); $BikemakeModel = new BikemakeModel();
$data['make'] = $BikemakeModel->findAll(); $data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$data['models'] = []; $data['models'] = [];
$service=$ServiceModel->where('isactive',1)->where('category','0')->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); $service=$ServiceModel->where('isactive',1)->where('category','0')->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
// echo $this->session->get('logged_user_branch_id');die; // echo $this->session->get('logged_user_branch_id');die;
@ -111,7 +111,7 @@ class Service extends BaseController
// Load make data // Load make data
$BikemakeModel = new BikemakeModel(); $BikemakeModel = new BikemakeModel();
$data['make'] = $BikemakeModel->findAll(); $data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$tax=$ServiceModel->getTax(); $tax=$ServiceModel->getTax();
$data['tax']=$tax; $data['tax']=$tax;
@ -228,16 +228,20 @@ class Service extends BaseController
$model_ids = $this->request->getPost('model_ids'); $model_ids = $this->request->getPost('model_ids');
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$products = [];
$encodedModelId = json_encode($model_ids); foreach ($model_ids as $modelId) {
// print_r("heloooo"); $product = $ProductModel->where('JSON_CONTAINS(models_id, \'["' . $modelId . '"]\')', null, false)
// print_r($encodedModelId);die;
$product = $ProductModel->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->findAll(); ->findAll();
return $this->response->setJSON($product); $products = array_merge($products, $product);
} }
$products = array_unique($products, SORT_REGULAR);
return $this->response->setJSON($products);
}
public function get_models() public function get_models()
{ {
@ -253,7 +257,7 @@ class Service extends BaseController
if ($selected_makes) { if ($selected_makes) {
foreach ($selected_makes as $make_id) { foreach ($selected_makes as $make_id) {
// Fetch models based on the selected make ID // Fetch models based on the selected make ID
$models = $BikemodelModel->where('make_id', $make_id)->findAll(); $models = $BikemodelModel->where('make_id', $make_id)->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
// Iterate over each fetched model and format it as needed // Iterate over each fetched model and format it as needed
foreach ($models as $model) { foreach ($models as $model) {

View File

@ -63,7 +63,7 @@ class Vehicle extends BaseController
$data['client']=$client; $data['client']=$client;
} }
$data['vehicle_id'] = $vehicle_id; $data['vehicle_id'] = $vehicle_id;
$data['makeData'] =$this->bikeMakeModel->findAll(); $data['makeData'] =$this->bikeMakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
return view('vehicle_form',$data); return view('vehicle_form',$data);
} }
@ -129,4 +129,28 @@ class Vehicle extends BaseController
return redirect()->to('vehicle_index'); return redirect()->to('vehicle_index');
} }
public function get_models()
{
$selected_makes = $this->request->getPost('selected_makes');
$BikemodelModel = new BikemodelsModel();
$formatted_models = [];
foreach ($selected_makes as $make_id) {
$models = $BikemodelModel->where('make_id', $make_id)->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
foreach ($models as $model) {
$formatted_model = [
'model_id' => $model['model_id'],
'model_name' => $model['model_name']
];
$formatted_models[] = $formatted_model;
}
}
return $this->response->setJSON($formatted_models);
}
} }

View File

@ -40,12 +40,12 @@ class Vendor extends BaseController
$data['vendor'] = []; $data['vendor'] = [];
$data['page_name'] = "Add Vendor"; $data['page_name'] = "Add Vendor";
$ManufacturerModel = new ManufacturerModel(); $ManufacturerModel = new ManufacturerModel();
$data['manufacturers']=$ManufacturerModel->findAll(); $data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
} else { } else {
$VendorModel = new VendorModel(); $VendorModel = new VendorModel();
$vendor = $VendorModel->where('vendor_id', $vendor_id)->get()->getRowArray(); $vendor = $VendorModel->where('vendor_id', $vendor_id)->get()->getRowArray();
$ManufacturerModel = new ManufacturerModel(); $ManufacturerModel = new ManufacturerModel();
$data['manufacturers']=$ManufacturerModel->findAll(); $data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
$data['vendor'] = $vendor; $data['vendor'] = $vendor;
$data['page_name'] = "Edit Vendor"; $data['page_name'] = "Edit Vendor";

View File

@ -5,7 +5,7 @@ class BikemakeModel extends Model
{ {
protected $table = 'make'; protected $table = 'make';
protected $primaryKey = 'make_id'; protected $primaryKey = 'make_id';
protected $allowedFields = ['make_id','make','isactive']; protected $allowedFields = ['make_id','business_id','make','isactive'];
} }

View File

@ -5,5 +5,5 @@ class BikemodelsModel extends Model
{ {
protected $table = 'model'; protected $table = 'model';
protected $primaryKey = 'model_id'; protected $primaryKey = 'model_id';
protected $allowedFields = ['model_id','make_id','model_name','isactive']; protected $allowedFields = ['model_id','business_id','make_id','model_name','isactive'];
} }

View File

@ -5,5 +5,5 @@ class ComplaintModel extends Model
{ {
protected $table = 'complaints'; protected $table = 'complaints';
protected $primaryKey = 'complaint_id'; protected $primaryKey = 'complaint_id';
protected $allowedFields = ['complaint_id','name','labour_charge','cgst','sgst','tax','isactive']; protected $allowedFields = ['complaint_id','business_id','name','labour_charge','cgst','sgst','tax','isactive'];
} }

View File

@ -5,7 +5,7 @@ class ManufacturerModel extends Model
{ {
protected $table = 'manufacturer'; protected $table = 'manufacturer';
protected $primaryKey = 'manufacturer_id'; protected $primaryKey = 'manufacturer_id';
protected $allowedFields = ['manufacturer_id','manufacturer_name','isactive','quality']; protected $allowedFields = ['manufacturer_id','business_id','manufacturer_name','isactive','quality'];
} }

View File

@ -10,7 +10,7 @@ class PurchaseOrderModel extends Model
public function getPurchaseOrdersWithProducts($logged_user_branch_id) public function getPurchaseOrdersWithProducts($logged_user_branch_id)
{ {
// Select required fields from both tables // Select required fields from both tables
$this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name'); $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 ');
// Join the sales_order_product table based on sales_order_id // 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'); $this->join('purchase_order_child', 'purchase_order_child.purchase_order_id = purchase_order.purchase_order_id');

View File

@ -73,9 +73,7 @@
<div class="form-group"> <div class="form-group">
<label for="labour_charge">Tax </label> <label for="labour_charge">Tax </label>
<select class="form-control status-select" id="tax" name="tax" required data-toggle="select2"> <select class="form-control status-select" id="tax" name="tax" required data-toggle="select2">
<option value="0">0%</option> <option value="0">Select Tax</option>
<option value="5" >5%</option>
<option value="12">12%</option>
<option value="18">18%</option> <option value="18">18%</option>
<option value="28" >28%</option> <option value="28" >28%</option>
</select> </select>

View File

@ -794,6 +794,7 @@ $(document).ready(async function() {
} }
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;
@ -806,7 +807,7 @@ $(document).ready(async function() {
// 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>' +
@ -910,7 +911,8 @@ $(document).ready(async function() {
// 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++)
{ {
@ -939,7 +941,7 @@ $(document).ready(async function() {
alert('dzfaf') alert('dzfaf')
servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>; servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>;
// 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++)
{ {
@ -966,7 +968,7 @@ $(document).ready(async function() {
$('#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++)
{ {
@ -1002,7 +1004,7 @@ $(document).ready(async function() {
$('#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>' +
@ -1030,7 +1032,24 @@ $(document).ready(async function() {
// 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
}); });
}); });

View File

@ -203,13 +203,11 @@
$cgst = isset($products['cgst']) ? $products['cgst'] : 0; // CGST value (half of the tax amount) $cgst = isset($products['cgst']) ? $products['cgst'] : 0; // CGST value (half of the tax amount)
$tax = $sgst + $cgst; // Total tax (sum of SGST and CGST) $tax = $sgst + $cgst; // Total tax (sum of SGST and CGST)
?> ?>
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option> <option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>Select Tax</option>
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
<option value="12" <?= ($tax == 12) ? 'selected' : '' ?>>12%</option>
<option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option> <option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option>
<option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option> <option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
</select> </select>
</div> </div>

View File

@ -55,6 +55,7 @@
<th>Contact Person Details</th> <th>Contact Person Details</th>
<!-- <th>Contact Person Mobile</th> --> <!-- <th>Contact Person Mobile</th> -->
<th>Items</th> <th>Items</th>
<th>Qty</th>
<th>Received Items</th> <th>Received Items</th>
<th>Status</th> <th>Status</th>
<th>Actions</th> <th>Actions</th>
@ -71,6 +72,7 @@
<td><?= $value['contact_person_name']; ?><br> <td><?= $value['contact_person_name']; ?><br>
<?= $value['contact_person_mobile']; ?> <?= $value['contact_person_mobile']; ?>
<td><?= $value['product_count']; ?></td> <td><?= $value['product_count']; ?></td>
<td><?= $value['purchase_qty'] ?></td>
<td><?= $value['selected_product_count']; ?></td> <td><?= $value['selected_product_count']; ?></td>
<td class="<?php <td class="<?php
if ($value['status'] == 'Cancel') { if ($value['status'] == 'Cancel') {

View File

@ -29,7 +29,7 @@
<th>Vendor Name</th> <th>Vendor Name</th>
<!-- <th>Vendor Name</th> <!-- <th>Vendor Name</th>
<th>Unit Price</th> --> <th>Unit Price</th> -->
<th>Qty</th> <th>Item</th>
<!-- <th>Re-Order Level</th> --> <!-- <th>Re-Order Level</th> -->
<th>Actions</th> <th>Actions</th>
</tr> </tr>

View File

@ -55,7 +55,7 @@
<th>Contact Person Details</th> <th>Contact Person Details</th>
<!-- <th>Contact Person Mobile</th> --> <!-- <th>Contact Person Mobile</th> -->
<th>Items</th> <th>Items</th>
<th>Qty</th>
<th>Status</th> <th>Status</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
@ -71,6 +71,7 @@
<?= $value['contact_person_mobile']; ?> <?= $value['contact_person_mobile']; ?>
</td> </td>
<td><?= $value['return_count']; ?></td> <td><?= $value['return_count']; ?></td>
<td><?= $value['return_qty']; ?></td>
<td><?= $value['status']; ?></td> <td><?= $value['status']; ?></td>
<td> <td>
<a href="<?= "edit_return_order/" . $value['return_order_id']; ?>" class="edit-button" title="Return"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="<?= "edit_return_order/" . $value['return_order_id']; ?>" class="edit-button" title="Return"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

View File

@ -19,20 +19,16 @@
<div class="card-body"> <div class="card-body">
<h4 class="header-title"></h4> <h4 class="header-title"></h4>
<form action="<?= base_url() . "add_service"; ?>" method="post"> <form action="<?= base_url() . "add_service"; ?>" method="post">
<h4 class="header-title">Service Details :</h4><br> <h4 class="header-title">Service Details :</h4>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Category<span class="text-danger">*</span></label> <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> <select class="form-control" id="category" name="category" style="height:32px" required>
<option value="">Select</option> <option value="">Select</option>
<option value="0" <?= (isset($services['category']) && $services['category'] == 0) ? 'selected' : '' ?> >Custom</option> <option value="0" <?= (isset($services['category']) && $services['category'] == 0) ? 'selected' : '' ?> >Common Service</option>
<option value="1" <?= (isset($services['category']) && $services['category'] == 1) ? 'selected' : '' ?> >Manual</option> <option value="1" <?= (isset($services['category']) && $services['category'] == 1) ? 'selected' : '' ?> >Standalone Service</option>
</select> </select>
</div> </div>
<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" id="make_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>> <div class="form-group col-md-3" id="make_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label> <label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="make" name="make[]" required multiple> <select class="form-control SelExample" id="make" name="make[]" required multiple>
@ -55,10 +51,18 @@
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="model" class="col-form-label">Product<span class="text-danger">*</span></label> <label for="inputEmail4" class="col-form-label">Service Name<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="productSelect" name="product_id[]" required multiple> <input type="text" class="form-control" name="servicename" style="height:32px" placeholder="Service Name" value="<?= isset($services['service_name']) ? $services['service_name'] : '' ?>" required>
<option value="">Select a Product</option> </div>
<option value="0" <?= isset($services['product_id']) && in_array(0, json_decode($services['product_id'])) ? 'selected' : '' ?>>None</option>
</div><br>
<h4 class="header-title">Select Item :</h4>
<div class="form-row">
<div class="form-group col-md-3">
<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> -->
<!-- <option value="0" <?= isset($services['product_id']) && in_array(0, json_decode($services['product_id'])) ? 'selected' : '' ?>>None</option> -->
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["product_id"] ?>" <?= isset($services['product_id']) && in_array($value['product_id'], json_decode($services['product_id'])) ? 'selected' : '' ?>> <option value="<?= $value["product_id"] ?>" <?= isset($services['product_id']) && in_array($value['product_id'], json_decode($services['product_id'])) ? 'selected' : '' ?>>
@ -69,10 +73,10 @@
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="model" class="col-form-label">Service<span class="text-danger">*</span></label> <label for="model" class="col-form-label">Service</label>
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" required multiple> <select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" multiple>
<option value="">Select a Service</option> <!-- <option value="">Select a Service</option> -->
<option value="0" <?= isset($services['sub_service_id']) && in_array(0, json_decode($services['sub_service_id'])) ? 'selected' : '' ?>>None</option> <!-- <option value="0" <?= isset($services['sub_service_id']) && in_array(0, json_decode($services['sub_service_id'])) ? 'selected' : '' ?>>None</option> -->
<?php foreach ($service as $value) : ?> <?php foreach ($service as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["service_id"] ?>" <?= isset($services['sub_service_id']) && in_array($value['sub_service_id'], json_decode($services['sub_service_id'])) ? 'selected' : '' ?>> <option value="<?= $value["service_id"] ?>" <?= isset($services['sub_service_id']) && in_array($value['sub_service_id'], json_decode($services['sub_service_id'])) ? 'selected' : '' ?>>
@ -84,7 +88,7 @@
</div> </div>
</div> </div>
<input type="hidden" id="service_id" name="service_id" value="<?= isset($services['service_id']) ? $services['service_id'] : '' ?>"><br> <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><br> <h4 class="header-title">Pricing Information :</h4>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Labour Cost<span class="text-danger">*</span></label> <label for="inputEmail4" class="col-form-label">Labour Cost<span class="text-danger">*</span></label>
@ -102,15 +106,13 @@
$sgst = isset($services['sgst']) ? $services['sgst'] : 0; // SGST 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) $tax = $cgst + $sgst; // Total tax (sum of CGST and SGST)
?> ?>
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option> <option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>Select Tax</option>
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
<option value="12" <?= ($tax == 12) ? 'selected' : '' ?>>12%</option>
<option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option> <option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option>
<option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option> <option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
</select> </select>
</div> </div>
</div><br> </div><br>
<h4 class="header-title">Description Details :</h4><br> <h4 class="header-title">Description Details :</h4>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="inputPassword4" class="col-form-label">Description</label> <label for="inputPassword4" class="col-form-label">Description</label>
@ -302,7 +304,7 @@ document.getElementById('category').addEventListener('change', function() {
<script> <script>
data = <?php echo json_encode($product) ?>; data = <?php echo json_encode($product) ?>;
$('#productSelect').change(function() { $('#productSelect').change(function() {
// console.log('jsfd'); console.log('this.value',this.value);
if(this.value != 0) { if(this.value != 0) {
// Get the selected options // Get the selected options
var selectedOptions = this.selectedOptions; var selectedOptions = this.selectedOptions;
@ -324,7 +326,7 @@ document.getElementById('category').addEventListener('change', function() {
$('#price').val(add); $('#price').val(add);
} }
else if(this.value == '') { else if(this.value == '' ) {
$('#productCost').val(0); $('#productCost').val(0);
// labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()); // labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) //+ labour_cost; add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) //+ labour_cost;

View File

@ -257,7 +257,7 @@ $(document).ready(function() {
$('#makeSelectMessage').hide(); $('#makeSelectMessage').hide();
// AJAX request to fetch models based on selected make IDs // AJAX request to fetch models based on selected make IDs
$.ajax({ $.ajax({
url: '<?= base_url("fetch_models") ?>', // URL to your controller method for fetching models url: '<?= base_url("get_models_vehicle") ?>', // URL to your controller method for fetching models
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
data: { selected_makes: [selected_makes] }, data: { selected_makes: [selected_makes] },
@ -412,7 +412,7 @@ $(document).ready(function() {
$('#saveModelBtn').click(function() { $('#saveModelBtn').click(function() {
var makeId = $('#makeSelect').val(); var makeId = $('#makeSelect').val();
var model = $('#modelInput').val(); var model = $('#modelInput').val();
console.log(model); console.log(model);
if (makeId != '' && model != '') { if (makeId != '' && model != '') {
$.ajax({ $.ajax({
url: '<?php echo base_url().'save_model'?>', url: '<?php echo base_url().'save_model'?>',