CHANGE_MAKE_MODEL_COMPLAINT_MANUFACTOR_BUSINESS_ID_ADD : AADHAVAN
This commit is contained in:
parent
ab92431c81
commit
6cae917ebe
@ -109,6 +109,7 @@ $routes->get('vehicle_index/', 'Vehicle::vehicle_index');
|
||||
$routes->post("add_vehicle", "Vehicle::add_vehicle");
|
||||
$routes->get("new_vehicle/(:any)", "Vehicle::new_vehicle/$1");
|
||||
$routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1");
|
||||
$routes->post("get_models_vehicle", "Vehicle::get_models");
|
||||
//end Vehicle
|
||||
|
||||
|
||||
|
||||
@ -62,11 +62,12 @@ class Products extends BaseController
|
||||
$tax=$ProductModel->getTax();
|
||||
$data['tax']=$tax;
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data['make'] = $BikemakeModel->findAll();
|
||||
$data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
$VendorModel = new VendorModel();
|
||||
$data['vendors']=$VendorModel->findAll();
|
||||
$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['vendorsProduct'] =[];
|
||||
} else if ($product_id !== '0') {
|
||||
@ -81,7 +82,7 @@ class Products extends BaseController
|
||||
$data['products']=$products;
|
||||
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data['make'] = $BikemakeModel->findAll();
|
||||
$data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
$make_id = $products['make_id'];
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
@ -89,6 +90,7 @@ class Products extends BaseController
|
||||
$models = [];
|
||||
if( $products['make_id'] != null) {
|
||||
foreach ($products['make_id'] as $make_id) {
|
||||
// $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();
|
||||
$data['vendors']=$VendorModel->findAll();
|
||||
$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);
|
||||
|
||||
|
||||
@ -275,7 +277,7 @@ class Products extends BaseController
|
||||
if ($make_ids) {
|
||||
foreach ($make_ids as $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
|
||||
foreach ($models as $model) {
|
||||
|
||||
@ -36,7 +36,6 @@ class ReturnOrder extends BaseController
|
||||
|
||||
$return = $this->returnModel->findAll();
|
||||
$data['return']=$return;
|
||||
|
||||
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()); }
|
||||
$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('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'))
|
||||
|
||||
@ -76,7 +76,7 @@ class Service extends BaseController
|
||||
$tax=$ServiceModel->getTax();
|
||||
$data['tax']=$tax;
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data['make'] = $BikemakeModel->findAll();
|
||||
$data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
$data['models'] = [];
|
||||
$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;
|
||||
@ -111,7 +111,7 @@ class Service extends BaseController
|
||||
|
||||
// Load make data
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data['make'] = $BikemakeModel->findAll();
|
||||
$data['make'] = $BikemakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
|
||||
$tax=$ServiceModel->getTax();
|
||||
$data['tax']=$tax;
|
||||
@ -226,18 +226,22 @@ class Service extends BaseController
|
||||
public function get_product_by_models(){
|
||||
$make_id = $this->request->getPost('make_id');
|
||||
$model_ids = $this->request->getPost('model_ids');
|
||||
|
||||
|
||||
$ProductModel = new ProductModel();
|
||||
|
||||
$encodedModelId = json_encode($model_ids);
|
||||
// print_r("heloooo");
|
||||
// print_r($encodedModelId);die;
|
||||
|
||||
$product = $ProductModel->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->findAll();
|
||||
return $this->response->setJSON($product);
|
||||
$products = [];
|
||||
|
||||
foreach ($model_ids as $modelId) {
|
||||
$product = $ProductModel->where('JSON_CONTAINS(models_id, \'["' . $modelId . '"]\')', null, false)
|
||||
->findAll();
|
||||
$products = array_merge($products, $product);
|
||||
}
|
||||
|
||||
$products = array_unique($products, SORT_REGULAR);
|
||||
|
||||
return $this->response->setJSON($products);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_models()
|
||||
{
|
||||
@ -253,7 +257,7 @@ class Service extends BaseController
|
||||
if ($selected_makes) {
|
||||
foreach ($selected_makes as $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
|
||||
foreach ($models as $model) {
|
||||
|
||||
@ -63,7 +63,7 @@ class Vehicle extends BaseController
|
||||
$data['client']=$client;
|
||||
}
|
||||
$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);
|
||||
}
|
||||
@ -128,5 +128,29 @@ class Vehicle extends BaseController
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -40,12 +40,12 @@ class Vendor extends BaseController
|
||||
$data['vendor'] = [];
|
||||
$data['page_name'] = "Add Vendor";
|
||||
$ManufacturerModel = new ManufacturerModel();
|
||||
$data['manufacturers']=$ManufacturerModel->findAll();
|
||||
$data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||
} else {
|
||||
$VendorModel = new VendorModel();
|
||||
$vendor = $VendorModel->where('vendor_id', $vendor_id)->get()->getRowArray();
|
||||
$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['page_name'] = "Edit Vendor";
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ class BikemakeModel extends Model
|
||||
{
|
||||
protected $table = 'make';
|
||||
protected $primaryKey = 'make_id';
|
||||
protected $allowedFields = ['make_id','make','isactive'];
|
||||
protected $allowedFields = ['make_id','business_id','make','isactive'];
|
||||
|
||||
|
||||
}
|
||||
@ -5,5 +5,5 @@ class BikemodelsModel extends Model
|
||||
{
|
||||
protected $table = 'model';
|
||||
protected $primaryKey = 'model_id';
|
||||
protected $allowedFields = ['model_id','make_id','model_name','isactive'];
|
||||
protected $allowedFields = ['model_id','business_id','make_id','model_name','isactive'];
|
||||
}
|
||||
@ -5,5 +5,5 @@ class ComplaintModel extends Model
|
||||
{
|
||||
protected $table = 'complaints';
|
||||
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'];
|
||||
}
|
||||
@ -5,7 +5,7 @@ class ManufacturerModel extends Model
|
||||
{
|
||||
protected $table = 'manufacturer';
|
||||
protected $primaryKey = 'manufacturer_id';
|
||||
protected $allowedFields = ['manufacturer_id','manufacturer_name','isactive','quality'];
|
||||
protected $allowedFields = ['manufacturer_id','business_id','manufacturer_name','isactive','quality'];
|
||||
|
||||
|
||||
}
|
||||
@ -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');
|
||||
$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
|
||||
$this->join('purchase_order_child', 'purchase_order_child.purchase_order_id = purchase_order.purchase_order_id');
|
||||
|
||||
@ -73,9 +73,7 @@
|
||||
<div class="form-group">
|
||||
<label for="labour_charge">Tax </label>
|
||||
<select class="form-control status-select" id="tax" name="tax" required data-toggle="select2">
|
||||
<option value="0">0%</option>
|
||||
<option value="5" >5%</option>
|
||||
<option value="12">12%</option>
|
||||
<option value="0">Select Tax</option>
|
||||
<option value="18">18%</option>
|
||||
<option value="28" >28%</option>
|
||||
</select>
|
||||
|
||||
@ -196,20 +196,18 @@
|
||||
<input type="number" class="form-control" name="purchase_cost" placeholder="Purchase Cost"value="<?= isset($products['purchase_cost']) ? $products['purchase_cost'] : '' ?>" required>
|
||||
</div>
|
||||
<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">
|
||||
<?php
|
||||
$sgst = isset($products['sgst']) ? $products['sgst'] : 0; // SGST 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)
|
||||
?>
|
||||
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</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="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
|
||||
</select>
|
||||
</div>
|
||||
<label for="inputPassword4" class="col-form-label">Tax</label>
|
||||
<select class="form-control status-select" name="tax" required data-toggle="select2">
|
||||
<?php
|
||||
$sgst = isset($products['sgst']) ? $products['sgst'] : 0; // SGST 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)
|
||||
?>
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
<th>Contact Person Details</th>
|
||||
<!-- <th>Contact Person Mobile</th> -->
|
||||
<th>Items</th>
|
||||
<th>Qty</th>
|
||||
<th>Received Items</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
@ -71,6 +72,7 @@
|
||||
<td><?= $value['contact_person_name']; ?><br>
|
||||
<?= $value['contact_person_mobile']; ?>
|
||||
<td><?= $value['product_count']; ?></td>
|
||||
<td><?= $value['purchase_qty'] ?></td>
|
||||
<td><?= $value['selected_product_count']; ?></td>
|
||||
<td class="<?php
|
||||
if ($value['status'] == 'Cancel') {
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<th>Vendor Name</th>
|
||||
<!-- <th>Vendor Name</th>
|
||||
<th>Unit Price</th> -->
|
||||
<th>Qty</th>
|
||||
<th>Item</th>
|
||||
<!-- <th>Re-Order Level</th> -->
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<th>Contact Person Details</th>
|
||||
<!-- <th>Contact Person Mobile</th> -->
|
||||
<th>Items</th>
|
||||
|
||||
<th>Qty</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
@ -71,6 +71,7 @@
|
||||
<?= $value['contact_person_mobile']; ?>
|
||||
</td>
|
||||
<td><?= $value['return_count']; ?></td>
|
||||
<td><?= $value['return_qty']; ?></td>
|
||||
<td><?= $value['status']; ?></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>
|
||||
|
||||
@ -19,46 +19,50 @@
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"></h4>
|
||||
<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-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>
|
||||
<option value="">Select</option>
|
||||
<option value="0" <?= (isset($services['category']) && $services['category'] == 0) ? 'selected' : '' ?> >Custom</option>
|
||||
<option value="1" <?= (isset($services['category']) && $services['category'] == 1) ? 'selected' : '' ?> >Manual</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="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>
|
||||
<select class="form-control SelExample" id="make" name="make[]" required multiple>
|
||||
<!-- Options for make -->
|
||||
<!-- <option value="0">Custom</option> -->
|
||||
<?php foreach ($make as $value): ?>
|
||||
<option value="<?= $value['make_id'] ?>" <?= isset($services['makes_id']) && in_array($value['make_id'], $services['makes_id']) ? 'selected' : '' ?>><?= $value['make'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3" id="model_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
|
||||
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
||||
<!-- <option value="0">Custom</option> -->
|
||||
<?php foreach ($models as $make_models): ?>
|
||||
<?php foreach ($make_models as $model): ?>
|
||||
<option value="<?= $model['model_id'] ?>" <?= isset($services['models_id']) && in_array($model['model_id'], $services['models_id']) ? 'selected' : '' ?>><?= $model['model_name'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</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;"' : '' ?>>
|
||||
<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>
|
||||
<!-- Options for make -->
|
||||
<!-- <option value="0">Custom</option> -->
|
||||
<?php foreach ($make as $value): ?>
|
||||
<option value="<?= $value['make_id'] ?>" <?= isset($services['makes_id']) && in_array($value['make_id'], $services['makes_id']) ? 'selected' : '' ?>><?= $value['make'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3" id="model_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
|
||||
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
||||
<!-- <option value="0">Custom</option> -->
|
||||
<?php foreach ($models as $make_models): ?>
|
||||
<?php foreach ($make_models as $model): ?>
|
||||
<option value="<?= $model['model_id'] ?>" <?= isset($services['models_id']) && in_array($model['model_id'], $services['models_id']) ? 'selected' : '' ?>><?= $model['model_name'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</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<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="productSelect" name="product_id[]" required 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>
|
||||
<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 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' : '' ?>>
|
||||
@ -69,10 +73,10 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="model" class="col-form-label">Service<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" required multiple>
|
||||
<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>
|
||||
<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> -->
|
||||
<!-- <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 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' : '' ?>>
|
||||
@ -84,7 +88,7 @@
|
||||
</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><br>
|
||||
<h4 class="header-title">Pricing Information :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<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)
|
||||
$tax = $cgst + $sgst; // Total tax (sum of CGST and SGST)
|
||||
?>
|
||||
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option>
|
||||
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
|
||||
<option value="12" <?= ($tax == 12) ? 'selected' : '' ?>>12%</option>
|
||||
<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><br>
|
||||
<h4 class="header-title">Description Details :</h4><br>
|
||||
<h4 class="header-title">Description Details :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="inputPassword4" class="col-form-label">Description</label>
|
||||
@ -302,7 +304,7 @@ document.getElementById('category').addEventListener('change', function() {
|
||||
<script>
|
||||
data = <?php echo json_encode($product) ?>;
|
||||
$('#productSelect').change(function() {
|
||||
// console.log('jsfd');
|
||||
console.log('this.value',this.value);
|
||||
if(this.value != 0) {
|
||||
// Get the selected options
|
||||
var selectedOptions = this.selectedOptions;
|
||||
@ -320,14 +322,14 @@ document.getElementById('category').addEventListener('change', function() {
|
||||
|
||||
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);
|
||||
console.log("New value of #serviceCost:", add);
|
||||
$('#price').val(add);
|
||||
}
|
||||
else if(this.value == '') {
|
||||
else if(this.value == '' ) {
|
||||
$('#productCost').val(0);
|
||||
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
||||
add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) + labour_cost;
|
||||
// console.log("New value of #serviceCost:", add);
|
||||
console.log("New value of #serviceCostttt:", add);
|
||||
$('#price').val(add);
|
||||
}
|
||||
});
|
||||
|
||||
@ -250,34 +250,34 @@ $(document).ready(function() {
|
||||
|
||||
// Event listener for change in make select dropdown
|
||||
$("#make").on('change', function() {
|
||||
var selected_makes = $(this).val(); // Get an array of selected make IDs
|
||||
make_value = $('option:selected', this).text();
|
||||
$('#makeSelect').empty();
|
||||
$('#makeSelect').append('<option value="' + selected_makes + '">' + make_value + '</option>');
|
||||
$('#makeSelectMessage').hide();
|
||||
// AJAX request to fetch models based on selected make IDs
|
||||
$.ajax({
|
||||
url: '<?= base_url("fetch_models") ?>', // URL to your controller method for fetching models
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { selected_makes: [selected_makes] },
|
||||
success: function(response) {
|
||||
// Clear existing options in model select dropdown
|
||||
$("#model").empty();
|
||||
$("#model").append('<option value=""> Select a Model </option>');
|
||||
// Populate model select dropdown with fetched models
|
||||
$.each(response, function(index, model) {
|
||||
$("#model").append('<option value="' + model.model_id + '">' + model.model_name + '</option>');
|
||||
});
|
||||
var selected_makes = $(this).val(); // Get an array of selected make IDs
|
||||
make_value = $('option:selected', this).text();
|
||||
$('#makeSelect').empty();
|
||||
$('#makeSelect').append('<option value="' + selected_makes + '">' + make_value + '</option>');
|
||||
$('#makeSelectMessage').hide();
|
||||
// AJAX request to fetch models based on selected make IDs
|
||||
$.ajax({
|
||||
url: '<?= base_url("get_models_vehicle") ?>', // URL to your controller method for fetching models
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { selected_makes: [selected_makes] },
|
||||
success: function(response) {
|
||||
// Clear existing options in model select dropdown
|
||||
$("#model").empty();
|
||||
$("#model").append('<option value=""> Select a Model </option>');
|
||||
// Populate model select dropdown with fetched models
|
||||
$.each(response, function(index, model) {
|
||||
$("#model").append('<option value="' + model.model_id + '">' + model.model_name + '</option>');
|
||||
});
|
||||
|
||||
// Refresh select2 to reflect changes
|
||||
$("#model").trigger('change');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
}
|
||||
// Refresh select2 to reflect changes
|
||||
$("#model").trigger('change');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -412,7 +412,7 @@ $(document).ready(function() {
|
||||
$('#saveModelBtn').click(function() {
|
||||
var makeId = $('#makeSelect').val();
|
||||
var model = $('#modelInput').val();
|
||||
console.log(model);
|
||||
console.log(model);
|
||||
if (makeId != '' && model != '') {
|
||||
$.ajax({
|
||||
url: '<?php echo base_url().'save_model'?>',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user