FEATURE_SERVICE:AADHAVAN
This commit is contained in:
parent
b0506e3efa
commit
11d3e2ab0b
@ -83,19 +83,21 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
|
||||
|
||||
|
||||
//---------------------- Make And Model
|
||||
//---------------------- Make And Model // Service
|
||||
// Make
|
||||
$routes->get('make_index', 'Make::index');
|
||||
$routes->post('create_make', 'Make::create_make');
|
||||
|
||||
|
||||
|
||||
// Model
|
||||
$routes->get('bike_model_index/(:any)', 'Model::index/$1');
|
||||
|
||||
$routes->post('create_model', 'Model::create_model');
|
||||
|
||||
$routes->post('status_model', 'Model::status_model');
|
||||
|
||||
|
||||
// Service
|
||||
|
||||
$routes->get('service_index', 'Service::service_index');
|
||||
$routes->get("new_service/(:any)", "Service::new_service/$1");
|
||||
$routes->post("add_service", "Service::add_service");
|
||||
$routes->post("get_models_service", "Service::get_models");
|
||||
$routes->get("delete_service/(:any)", "Service::delete_service/$1");
|
||||
|
||||
242
app/Controllers/Service.php
Normal file
242
app/Controllers/Service.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\ServiceModel;
|
||||
use App\Models\BikemakeModel;
|
||||
use App\Models\VendorModel;
|
||||
use App\Models\BikemodelsModel;
|
||||
|
||||
|
||||
class Service extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
}
|
||||
|
||||
public function service_index()
|
||||
{
|
||||
|
||||
$ServiceModel = new ServiceModel();
|
||||
$services = $ServiceModel->findAll();
|
||||
|
||||
foreach ($services as &$service) {
|
||||
// Convert JSON strings to arrays
|
||||
$makes_ids = json_decode($service['makes_id'], true) ?? [];
|
||||
$models_ids = json_decode($service['models_id'], true) ?? [];
|
||||
|
||||
// Fetch make names
|
||||
$makeNames = [];
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
|
||||
foreach ($makes_ids as $make_id) {
|
||||
if (!empty($make_id)) { // Check if $make_id is not null or empty
|
||||
$make = $BikemakeModel->find($make_id);
|
||||
if ($make) {
|
||||
$makeNames[] = $make['make'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch model names
|
||||
$modelNames = [];
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
|
||||
foreach ($models_ids as $model_id) {
|
||||
if (!empty($model_id)) { // Check if $model_id is not null or empty
|
||||
$model = $BikemodelsModel->find($model_id);
|
||||
if ($model) {
|
||||
$modelNames[] = $model['model_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace IDs with names
|
||||
$service['makes_names'] = implode(', ', $makeNames);
|
||||
$service['models_names'] = implode(', ', $modelNames);
|
||||
}
|
||||
|
||||
$data['services']=$services;
|
||||
return view('service_list',$data);
|
||||
}
|
||||
|
||||
|
||||
public function new_service($service_id)
|
||||
{
|
||||
|
||||
|
||||
if ($service_id === '0') {
|
||||
|
||||
$data['services'] = [];
|
||||
$ServiceModel = new ServiceModel();
|
||||
$tax=$ServiceModel->getTax();
|
||||
$data['tax']=$tax;
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data['make'] = $BikemakeModel->findAll();
|
||||
$data['models'] = [];
|
||||
$data['page_name']="Add Service";
|
||||
} else if ($service_id !== '0') {
|
||||
|
||||
$ServiceModel = new ServiceModel();
|
||||
$services=$ServiceModel->where('service_id', $service_id)->get()->getRowArray();
|
||||
|
||||
$services['models_id'] = json_decode($services['models_id'], true);
|
||||
$services['makes_id'] = json_decode($services['makes_id'], true);
|
||||
|
||||
$data['page_name']="Edit Service";
|
||||
|
||||
|
||||
$models = [];
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
|
||||
foreach ($services['makes_id'] as $make_id) {
|
||||
$models[] = $BikemodelsModel->where('make_id', $make_id)->findAll();
|
||||
}
|
||||
$data['models'] = $models;
|
||||
|
||||
// Load make data
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data['make'] = $BikemakeModel->findAll();
|
||||
|
||||
$tax=$ServiceModel->getTax();
|
||||
$data['tax']=$tax;
|
||||
|
||||
$data['services']=$services;
|
||||
|
||||
}
|
||||
$data['service_id'] = $service_id;
|
||||
// echo"<pre>";
|
||||
// print_r($data);die;
|
||||
echo view('service_form',$data);
|
||||
}
|
||||
|
||||
|
||||
public function add_service()
|
||||
{
|
||||
|
||||
$ServiceModel = new ServiceModel();
|
||||
|
||||
$tax= $this->request->getPost('tax')/2;
|
||||
|
||||
$make_ids = $this->request->getPost('make');
|
||||
$model_ids = $this->request->getPost('model');
|
||||
|
||||
|
||||
$model_json = json_encode($model_ids);
|
||||
$make_json = json_encode($make_ids);
|
||||
$data = [
|
||||
'service_name' => $this->request->getPost('servicename'),
|
||||
'price' => $this->request->getPost('price'),
|
||||
'cgst' => $tax,
|
||||
'igst' => $tax,
|
||||
'makes_id' => $make_json,
|
||||
'models_id' => $model_json,
|
||||
'description' => $this->request->getPost('description'),
|
||||
'isactive' => 1 ,
|
||||
];
|
||||
|
||||
$service_id = $this->request->getPost('service_id');
|
||||
|
||||
|
||||
if (!empty($service_id)) {
|
||||
|
||||
$ServiceModel->update($service_id, $data);
|
||||
} else {
|
||||
|
||||
$ServiceModel->insert($data);
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('service_index');
|
||||
}
|
||||
|
||||
public function delete_service($service_id)
|
||||
{
|
||||
$ServiceModel = new ServiceModel();
|
||||
$where = ['service_id' => $service_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database
|
||||
$existingService = $ServiceModel->where($where)->first();
|
||||
|
||||
if ($existingService) {
|
||||
$data['isactive'] = 0;
|
||||
|
||||
if ($ServiceModel->update($service_id, $data)) {
|
||||
session()->setFlashdata('success', 'Deleted successfully.');
|
||||
$this->logger->info("Users: has been Inactivated successfully. Inactivated ID = ".$service_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('service_index');
|
||||
}
|
||||
|
||||
// Retrieve the make_id from the AJAX request
|
||||
public function get_vendors_by_model()
|
||||
{
|
||||
$make_id = $this->request->getPost('make_id');
|
||||
$model_ids = $this->request->getPost('model_ids');
|
||||
// print_r( $model_ids);die;
|
||||
|
||||
// If make_id or model_ids is not provided, return an empty response
|
||||
|
||||
|
||||
// Create an instance of VendorModel
|
||||
$vendorModel = new VendorModel();
|
||||
|
||||
// Call the get_vendors_by_model method from the model
|
||||
$vendors = $vendorModel->get_vendors_by_model($make_id, $model_ids);
|
||||
// Return the response as JSON
|
||||
// return $this->response->setJSON(['success' => true, 'message' => 'Client saved successfully.']);
|
||||
if ($vendors) {
|
||||
// Return the retrieved vendors as JSON response
|
||||
return $this->response->setJSON($vendors);
|
||||
} else {
|
||||
// If no vendors were found, return an empty response or handle the error accordingly
|
||||
return $this->response->setJSON([]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_models()
|
||||
{
|
||||
$selected_makes = $this->request->getPost('selected_makes');
|
||||
|
||||
// Load the BikemakeModel to fetch models
|
||||
$BikemodelModel = new BikemodelsModel();
|
||||
|
||||
// Initialize an empty array to store formatted model data
|
||||
$formatted_models = [];
|
||||
|
||||
// Iterate over each selected make ID
|
||||
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();
|
||||
|
||||
// Iterate over each fetched model and format it as needed
|
||||
foreach ($models as $model) {
|
||||
// Create an associative array with 'model_id' and 'model_name' properties
|
||||
$formatted_model = [
|
||||
'make_id' => $model['make_id'],
|
||||
'model_id' => $model['model_id'],
|
||||
'model_name' => $model['model_name']
|
||||
// Add other properties if needed
|
||||
];
|
||||
|
||||
// Push the formatted model into the array
|
||||
$formatted_models[] = $formatted_model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send the formatted models as JSON response back to the client
|
||||
return $this->response->setJSON($formatted_models);
|
||||
}
|
||||
|
||||
}
|
||||
@ -77,7 +77,7 @@ class Vendor extends BaseController
|
||||
|
||||
// Convert model IDs to JSON format
|
||||
$model_json = json_encode($model_ids);
|
||||
$make_json=json_encode($make_ids);
|
||||
$make_json=json_encode($make_ids);
|
||||
$data = [
|
||||
'vendor_name' => $this->request->getPost('vendor_name'),
|
||||
'contact_name' => $this->request->getPost('contact_name'),
|
||||
|
||||
28
app/Models/ServiceModel.php
Normal file
28
app/Models/ServiceModel.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class ServiceModel extends Model
|
||||
{
|
||||
protected $table = 'services';
|
||||
protected $primaryKey = 'service_id';
|
||||
protected $allowedFields = ['service_id','service_name','price','cgst','igst','description','makes_id','models_id','isactive'];
|
||||
|
||||
|
||||
public function getTax()
|
||||
{
|
||||
// Get a database instance
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
// Query the tax table
|
||||
$query = $db->table('tax')->get();
|
||||
|
||||
// Check if query returned results
|
||||
if ($query->resultID->num_rows > 0) {
|
||||
return $query->getResultArray();
|
||||
} else {
|
||||
return []; // Return an empty array if no tax data found
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -1,9 +1,9 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Bike Model List - <?php echo $make_name; ?></h4>
|
||||
<h5 class="page-title">Bike Model List - <span style="font-weight: 500;"><?php echo $make_name; ?></span></h5>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="">
|
||||
@ -22,50 +22,44 @@
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">Business List</h4> -->
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Model Name</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($model as $item): ?>
|
||||
<tr>
|
||||
|
||||
<?php foreach ($model as $item): ?>
|
||||
<tr>
|
||||
<td><?php echo $item['model_name']; ?></td>
|
||||
<td>
|
||||
<?php if($item['isactive'] == 1) { ?>
|
||||
<span style="color:green" >Active</span>
|
||||
<?php } else if($item['isactive'] == 0) { ?>
|
||||
<span style="color:red">Inactive</span>
|
||||
<?php } ?>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
<span style="color:green">Active</span>
|
||||
<?php else: ?>
|
||||
<span style="color:red">Inactive</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($item['isactive'] == 1) { ?>
|
||||
<a style="color:red" data-id="<?php echo $item['model_id'];?>" data-isactive="<?php echo $item['isactive'];?>" title="Deactivate" onclick="statusChange(this)" class="fa fa-user-times" ></a>
|
||||
<?php } else if($item['isactive'] == 0) { ?>
|
||||
<a style="color:green" data-id="<?php echo $item['model_id'];?>" data-isactive="<?php echo $item['isactive'];?>" title="Activate" onclick="statusChange(this)" class="fa fa-user" ></a>
|
||||
<?php } ?>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
<a style="color:red" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this)" class="fa fa-user-times"></a>
|
||||
<?php else: ?>
|
||||
<a style="color:green" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this)" class="fa fa-user"></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end table-responsive-->
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -76,7 +70,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<Label>Add Models</Label>
|
||||
<h4>Add Models</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
@ -141,6 +141,13 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url('service_index') ?>">
|
||||
<i class="fas fa-wrench"></i>
|
||||
<span> Service </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager') { ?>
|
||||
<li>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bike Make</th>
|
||||
@ -37,7 +37,7 @@
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" class="add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this)">
|
||||
<i class="ri-add-line icon-large"></i>
|
||||
</a>
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="view-list-button" title="Model List">
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="view-list-button" title="Model List" style="margin-left: 16px;">
|
||||
<i class="ri-list-check-2 icon-large"></i>
|
||||
</a>
|
||||
</td>
|
||||
@ -57,7 +57,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<Label>Add Bike Make</Label>
|
||||
<h4>Add Bike Make</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
@ -85,7 +85,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<Label>Add Models</Label>
|
||||
<h4>Add Models</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
230
app/Views/service_form.php
Normal file
230
app/Views/service_form.php
Normal file
@ -0,0 +1,230 @@
|
||||
<?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">
|
||||
<h4 class="header-title">Service Details :</h4><br>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<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 -->
|
||||
<?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-4">
|
||||
<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>
|
||||
<?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-4">
|
||||
<label for="inputEmail4" class="col-form-label">Service Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="servicename" placeholder="Service Name" value="<?= isset($services['service_name']) ? $services['service_name'] : '' ?>" required>
|
||||
</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>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Price<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="price" placeholder="Price"value="<?= isset($services['price']) ? $services['price'] : '' ?>" 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
|
||||
$cgst = isset($services['cgst']) ? $services['cgst'] : 0; // CGST value (half of the tax amount)
|
||||
$igst = isset($services['igst']) ? $services['igst'] : 0; // IGST value (half of the tax amount)
|
||||
$tax = $cgst + $igst; // Total tax (sum of CGST and IGST)
|
||||
?>
|
||||
<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>
|
||||
</div><br>
|
||||
<h4 class="header-title">Description Details :</h4><br>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="inputPassword4" class="col-form-label">Description</label>
|
||||
<textarea class="form-control" name="description" placeholder="Description" required><?= isset($services['description']) ? $services['description'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">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;
|
||||
$.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 = $(this).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
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('get_vendors_by_model') ?>', // 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) {
|
||||
// Update vendor dropdown based on the response
|
||||
if (response) {
|
||||
// Clear existing options
|
||||
$('#vendor').empty();
|
||||
// Append new options
|
||||
$('#vendor').append('<option value>"hello"</option>');
|
||||
$.each(response, function(index, vendor) {
|
||||
$('#vendor').append('<option value="' + vendor.vendor_id + '">' + vendor.vendor_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>
|
||||
<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>
|
||||
67
app/Views/service_list.php
Normal file
67
app/Views/service_list.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Service List</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class=""> <a href="<?= base_url() . "new_service/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">Business List</h4> -->
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service Name</th>
|
||||
<th>Make List</th>
|
||||
<!-- <th>Model List</th> -->
|
||||
<th>Price</th>
|
||||
<th>Cgst</th>
|
||||
<th>Igst</th>
|
||||
<th>Description</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($services as $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<td><?= $value['service_name']; ?></td>
|
||||
<td><?= $value['makes_names']; ?></td>
|
||||
<!-- <td><?= $value['models_names']; ?></td> -->
|
||||
<td><?= $value['price']; ?></td>
|
||||
<td><?= $value['cgst']; ?></td>
|
||||
<td><?= $value['igst']; ?></td>
|
||||
<td><?= $value['description']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "new_service/" . $value['service_id']; ?>" class="edit-button">
|
||||
<i class="ri-pencil-line"></i>
|
||||
</a>
|
||||
<a href="<?= "delete_service/" . $value['service_id']; ?>" class="delete-button">
|
||||
<i class="ri-delete-bin-line"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end table-responsive-->
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712314543;_ci_previous_url|s:64:"http://localhost/the_mechanic/public/index.php/sales_order_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712306960;_ci_previous_url|s:60:"http://localhost/the_mechanic/public/index.php/new_product/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712307617;_ci_previous_url|s:60:"http://localhost/the_mechanic/public/index.php/new_product/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712304798;_ci_previous_url|s:61:"http://localhost/the_mechanic/public/index.php/business_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712309483;_ci_previous_url|s:60:"http://localhost/the_mechanic/public/index.php/new_product/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712307938;_ci_previous_url|s:57:"http://localhost/the_mechanic/public/index.php/new_sale/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712300415;_ci_previous_url|s:47:"http://localhost/the_mechanic/public/index.php/";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712308723;_ci_previous_url|s:60:"http://localhost/the_mechanic/public/index.php/new_product/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712305179;_ci_previous_url|s:59:"http://localhost/the_mechanic/public/index.php/client_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712303843;_ci_previous_url|s:47:"http://localhost/the_mechanic/public/index.php/";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712310681;_ci_previous_url|s:57:"http://localhost/the_mechanic/public/index.php/new_sale/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712309802;_ci_previous_url|s:64:"http://localhost/the_mechanic/public/index.php/sales_order_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712306111;_ci_previous_url|s:59:"http://localhost/the_mechanic/public/index.php/client_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712304392;_ci_previous_url|s:54:"http://localhost/the_mechanic/public/index.php/log_out";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712310116;_ci_previous_url|s:60:"http://localhost/the_mechanic/public/index.php/new_product/2";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712306659;_ci_previous_url|s:59:"http://localhost/the_mechanic/public/index.php/client_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712305539;_ci_previous_url|s:59:"http://localhost/the_mechanic/public/index.php/client_index";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712311493;_ci_previous_url|s:57:"http://localhost/the_mechanic/public/index.php/new_sale/0";logged_user|s:1:"1";logged_user_branch_id|s:1:"1";logged_user_business_id|s:1:"2";logged_user_role|s:13:"Store Manager";logged_user_name|s:9:"Sales Man";
|
||||
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1712299949;_ci_previous_url|s:47:"http://localhost/the_mechanic/public/index.php/";
|
||||
Loading…
Reference in New Issue
Block a user