Merge branch 'main' of bitbucket.org:venbainformationtechnology/the_mechanic
This commit is contained in:
commit
92bafab52d
@ -85,7 +85,7 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
|
||||
|
||||
|
||||
//---------------------- Make And Model // Service
|
||||
//---------------------- Make And Model | Service | Spare Manufacturer and Category
|
||||
// Make
|
||||
$routes->get('make_index', 'Make::index');
|
||||
$routes->post('create_make', 'Make::create_make');
|
||||
@ -103,3 +103,16 @@ $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");
|
||||
|
||||
|
||||
|
||||
//Spare manufacturer
|
||||
|
||||
$routes->get('spare_manufacturer_index', 'SpareManufacturer::index');
|
||||
$routes->post('create_spare_manufacturer', 'SpareManufacturer::create_make');
|
||||
|
||||
//Spare category
|
||||
|
||||
$routes->get('spare_category_index/(:any)', 'SpareCategory::index/$1');
|
||||
$routes->post('create_model', 'SpareCategory::create_model');
|
||||
$routes->post('status_model', 'SpareCategory::status_model');
|
||||
55
app/Controllers/SpareManufacturer.php
Normal file
55
app/Controllers/SpareManufacturer.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\SpareManufacturerModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class SpareManufacturer extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->SpareManufacturerModel = new SpareManufacturerModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$SpareManufacturerModel = new SpareManufacturerModel();
|
||||
$spare_manufacturer = $SpareManufacturerModel->findAll();
|
||||
$data['spare_manufacturer']=$spare_manufacturer;
|
||||
|
||||
return view('spare_manufacturer_list',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function create_make()
|
||||
{
|
||||
try {
|
||||
$make_name = $this->request->getPost('makename');
|
||||
$SpareManufacturerModel = new SpareManufacturerModel();
|
||||
$data = [
|
||||
'make' => $make_name
|
||||
];
|
||||
$inserted = $SpareManufacturerModel->insert($data);
|
||||
if ($inserted) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
app/Models/SpareManufacturerModel.php
Normal file
11
app/Models/SpareManufacturerModel.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class SpareManufacturerModel extends Model
|
||||
{
|
||||
protected $table = 'spare_manufacturer';
|
||||
protected $primaryKey = 'spare_manufacturer_id';
|
||||
protected $allowedFields = ['spare_manufacturer_id','manufacturer_name','isactive','quantity'];
|
||||
|
||||
|
||||
}
|
||||
@ -90,29 +90,24 @@
|
||||
<ul id="side-menu">
|
||||
|
||||
<li class="menu-title">Navigation</li>
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager' ||
|
||||
session()->get('logged_user_role') == 'Store Manager') { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url('client_index') ?>">
|
||||
<i class="mdi mdi-clipboard-account"></i>
|
||||
<span> Client </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager' ||
|
||||
session()->get('logged_user_role') == 'Store Manager') { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url('vehicle_index') ?>">
|
||||
<i class="mdi mdi-motorbike"></i>
|
||||
<span> Vehicle </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarLayouts1" data-toggle="collapse">
|
||||
<i class="mdi mdi-sale"></i>
|
||||
<span> Sales </span>
|
||||
<span class="menu-arrow"></span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarLayouts1">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?php echo base_url('sales_order_index') ?>">Sales Order</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="#sidebarLayouts" data-toggle="collapse">
|
||||
<i class="ri-shopping-cart-fill"></i>
|
||||
@ -125,7 +120,7 @@
|
||||
<a href="<?php echo base_url('product_index') ?>">Products</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('sales_order_index') ?>">Sales Order</a>
|
||||
<a href="<?php echo base_url('service_index') ?>">Services</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('vendor_index') ?>">Vendor</a>
|
||||
@ -133,21 +128,59 @@
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url('make_index') ?>">
|
||||
<i class="fas fa-bicycle"></i>
|
||||
<span> Make </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager' ||
|
||||
session()->get('logged_user_role') == 'Store Manager') { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url('vehicle_index') ?>">
|
||||
<i class="mdi mdi-motorbike"></i>
|
||||
<span> Vehicle </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager' ||
|
||||
session()->get('logged_user_role') == 'Store Manager') { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url('client_index') ?>">
|
||||
<i class="mdi mdi-clipboard-account"></i>
|
||||
<span> Client </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <li>
|
||||
<a href="<?php echo base_url('service_index') ?>">
|
||||
<i class="fas fa-wrench"></i>
|
||||
<span> Service </span>
|
||||
</a>
|
||||
</li> -->
|
||||
|
||||
<li class="menu-title">Masters</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('make_index') ?>">
|
||||
<i class="fas fa-bicycle"></i>
|
||||
<span> Make & Models</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<li>
|
||||
<a href="<?php echo base_url('spare_manufacturer_index') ?>">
|
||||
<i class="fas fa-cogs"></i>
|
||||
<span> Spare </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager') { ?>
|
||||
<li>
|
||||
|
||||
179
app/Views/spare_manufacturer_list.php
Normal file
179
app/Views/spare_manufacturer_list.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?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">Spare Manufacturer List</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="">
|
||||
<a href="#" data-toggle="modal" data-target="#bike_make_login-modal" 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">
|
||||
<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>Spare Manufacturer </th>
|
||||
<th>Quantity</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($spare_manufacturer as $item): ?>
|
||||
<tr>
|
||||
<td><?php echo $item['manufacturer_name']; ?></td>
|
||||
<td><?php echo $item['quantity']; ?></td>
|
||||
<td>
|
||||
<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" style="margin-left: 16px;">
|
||||
<i class="ri-list-check-2 icon-large"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Start Bike Make Create Pop-UP -->
|
||||
<div id="bike_make_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4>Add Bike Make</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="makename">Make Name </label>
|
||||
<input class="form-control" type="text" id="bike_make_name" required="" placeholder="Make Name....">
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitMake(this)">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<!-- End Bike Make Create Pop-UP -->
|
||||
|
||||
<!-- Start Bike Model Create Pop-UP -->
|
||||
<div id="bike_model_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4>Add Models</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" id="make_id" required="" placeholder="Make Name...." style="display:none;">
|
||||
<label for="makename">Make Name </label>
|
||||
<input class="form-control" type="text" id="makename" required="" placeholder="Make Name...." disabled>
|
||||
<label for="modelname">Model Name </label>
|
||||
<input class="form-control" type="text" id="modelname" required="" placeholder="Model Name....">
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitModel(this)">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<!-- End Bike Model Create Pop-UP -->
|
||||
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function setMakeName(params) {
|
||||
|
||||
$('#make_id').val(params.getAttribute('data-id'));
|
||||
$('#makename').val(params.getAttribute('data-value'));
|
||||
}
|
||||
|
||||
|
||||
function submitModel(params) {
|
||||
console.log( $('#modelname').val());
|
||||
var formData = {
|
||||
make_id: $('#make_id').val(),
|
||||
modelname: $('#modelname').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'create_model',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
// Handle success response here
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#modelname').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function submitMake(params) {
|
||||
var formData = {
|
||||
makename: $('#bike_make_name').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'create_make',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user