Merge branch 'main' of bitbucket.org:venbainformationtechnology/the_mechanic
This commit is contained in:
commit
52e4ab8ec0
@ -77,4 +77,25 @@ $routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1");
|
||||
|
||||
|
||||
//dashboard
|
||||
$routes->get('dashboard', 'Users::dashboard');
|
||||
$routes->get('dashboard', 'Users::dashboard');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------- Make And Model
|
||||
// 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');
|
||||
|
||||
|
||||
|
||||
|
||||
55
app/Controllers/Make.php
Normal file
55
app/Controllers/Make.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\BikemakeModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class Make extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->BikemakeModel = new BikemakeModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$make = $BikemakeModel->findAll();
|
||||
$data['make']=$make;
|
||||
|
||||
return view('make_list',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function create_make()
|
||||
{
|
||||
try {
|
||||
$make_name = $this->request->getPost('makename');
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
$data = [
|
||||
'make' => $make_name
|
||||
];
|
||||
$inserted = $BikemakeModel->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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
99
app/Controllers/Model.php
Normal file
99
app/Controllers/Model.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\BikemodelsModel;
|
||||
use App\Models\BikemakeModel;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class Model extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->BikemodelsModel = new BikemodelsModel();
|
||||
$this->BikemakeModel = new BikemakeModel();
|
||||
|
||||
}
|
||||
|
||||
public function index($make_id)
|
||||
{
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
|
||||
$make_value = $BikemakeModel->where('make_id',$make_id)->select('make_id,make')->find();
|
||||
$make_name= $make_value[0]['make'];
|
||||
$make_id= $make_value[0]['make_id'];
|
||||
|
||||
$model = $BikemodelsModel->where('make_id',$make_id)->findAll();
|
||||
$data['model']=$model;
|
||||
$data['make_name'] =$make_name;
|
||||
$data['make_id'] =$make_id;
|
||||
|
||||
return view('bike_model_list',$data);
|
||||
}
|
||||
|
||||
|
||||
public function create_model()
|
||||
{
|
||||
try {
|
||||
$make_id = $this->request->getPost('make_id');
|
||||
$model_name = $this->request->getPost('modelname');
|
||||
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
$data = [
|
||||
'make_id' => $make_id,
|
||||
'model_name' => $model_name
|
||||
];
|
||||
|
||||
$inserted = $BikemodelsModel->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 $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function status_model()
|
||||
{
|
||||
|
||||
try {
|
||||
$model_id = $this->request->getPost('model_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$BikemodelsModel = new BikemodelsModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
|
||||
$updated = $BikemodelsModel->update($model_id, $data);
|
||||
$model_list = $BikemodelsModel->findAll();
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $model_list],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -65,7 +65,7 @@ class Products extends BaseController
|
||||
$ProductModel = new ProductModel();
|
||||
|
||||
$tax= $this->request->getPost('tax')/2;
|
||||
|
||||
// print_r($this->request->getPost());die;
|
||||
$data = [
|
||||
'product_name' => $this->request->getPost('productname'),
|
||||
'product_category' => $this->request->getPost('productcategory'),
|
||||
@ -82,6 +82,8 @@ class Products extends BaseController
|
||||
'vendor' => $this->request->getPost('vendor'),
|
||||
'purchase_order_level' => $this->request->getPost('purchase_order_level'),
|
||||
'quality' => $this->request->getPost('quality'),
|
||||
'make_id' => $this->request->getPost('make'),
|
||||
'models_id' => json_encode($this->request->getPost('model')),
|
||||
'isactive' => 1 ,
|
||||
'branch_id' => $this->session->get('logged_user_branch_id')
|
||||
];
|
||||
@ -124,26 +126,17 @@ class Products extends BaseController
|
||||
// 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);
|
||||
// print_r($vendors);
|
||||
// Return the response as JSON
|
||||
// return $this->response->setJSON(['success' => true, 'message' => 'Client saved successfully.']);
|
||||
$vendors = $vendorModel->get_vendors_by_model( $model_ids);
|
||||
|
||||
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([]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ class ProductModel extends Model
|
||||
{
|
||||
protected $table = 'products';
|
||||
protected $primaryKey = 'product_id';
|
||||
protected $allowedFields = ['product_id','quality','product_name','branch_id','search_tag','product_category','mfr_part_no','purchase_order_level','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive'];
|
||||
protected $allowedFields = ['product_id','make_id','models_id','quality','product_name','branch_id','search_tag','product_category','mfr_part_no','purchase_order_level','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive'];
|
||||
|
||||
|
||||
public function getTax()
|
||||
|
||||
194
app/Views/bike_model_list.php
Normal file
194
app/Views/bike_model_list.php
Normal file
@ -0,0 +1,194 @@
|
||||
<?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">Bike Model List - <?php echo $make_name; ?></h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="">
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal_1" 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>Model Name</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?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 } ?>
|
||||
</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 } ?>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Start Bike Model Create Pop-UP -->
|
||||
<div id="bike_model_login-modal_1" 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">
|
||||
<Label>Add Models</Label>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" id="make_id" required="" value="<?php echo $make_id; ?>" placeholder="Make Name...." style="display:none;">
|
||||
<label for="makename">Make Name </label>
|
||||
<input class="form-control" type="text" id="makename" required="" value="<?php echo $make_name; ?>" 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="submitModels(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 submitModels(params) {
|
||||
console.log( $('#modelname').val());
|
||||
var formData = {
|
||||
make_id: $('#make_id').val(),
|
||||
modelname: $('#modelname').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."create_model"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
// Handle success response here
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal_1').modal('hide');
|
||||
$('#modelname').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var model_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
model_id: model_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_model"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
$('tbody').html('');
|
||||
|
||||
$.each(response.data, function(index, item) {
|
||||
var row = '<tr>' +
|
||||
'<td>' + item.model_name + '</td>' +
|
||||
'<td>';
|
||||
|
||||
if (item.isactive == 1) {
|
||||
row += '<span style="color:green">Active</span>';
|
||||
} else if (item.isactive == 0) {
|
||||
row += '<span style="color:red">Inactive</span>';
|
||||
}
|
||||
|
||||
row += '</td><td>';
|
||||
|
||||
// Check the isactive status and set the icon color accordingly
|
||||
if (item.isactive == 1) {
|
||||
row += '<a style="color:red" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)" class="fa fa-user-times"></a>';
|
||||
} else if (item.isactive == 0) {
|
||||
row += '<a style="color:green" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)" class="fa fa-user"></a>';
|
||||
}
|
||||
|
||||
row += '</td><td></td></tr>';
|
||||
|
||||
// Append the row to the tbody
|
||||
$('tbody').append(row);
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -21,6 +21,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
<form action="<?= base_url() . "add_client"; ?>" method="post">
|
||||
<h4 class="header-title">Client Details :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Client Name<span class="text-danger">*</span></label>
|
||||
@ -30,6 +31,16 @@
|
||||
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($client['mobile_no']) ? $client['mobile_no'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" required/>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control status-select" name="clienttype" required data-toggle="select2" >
|
||||
<!-- <option value="">Select a Type</option> -->
|
||||
<option value="Direct" <?= isset($client['client_type']) && $client['client_type'] === 'Direct' ? 'selected' : '' ?>>Direct</option>
|
||||
<option value="Mechanic" <?= isset($client['client_type']) && $client['client_type'] === 'Mechanic' ? 'selected' : '' ?>>Mechanic</option>
|
||||
<option value="Exp" <?= isset($client['client_type']) && $client['client_type'] === 'Exp' ? 'selected' : '' ?>>Exp</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Email</label>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email" value="<?= isset($client['email']) ? $client['email'] : '' ?>" >
|
||||
@ -38,23 +49,10 @@
|
||||
<label for="inputAddress" class="col-form-label">GST Number<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="gstnumber" placeholder="GST Number" value="<?= isset($client['gstnumber']) ? $client['gstnumber'] : '' ?>"pattern="[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[0-9]{1}[Z]{1}[0-9A-Z]{1}" title="Enter a valid GST Number" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control status-select" name="clienttype" required data-toggle="select2" >
|
||||
<!-- <option value="">Select a Status</option> -->
|
||||
<option value="Direct" <?= isset($client['client_type']) && $client['client_type'] === 'Direct' ? 'selected' : '' ?>>Direct</option>
|
||||
<option value="Mechanic" <?= isset($client['client_type']) && $client['client_type'] === 'Mechanic' ? 'selected' : '' ?>>Mechanic</option>
|
||||
<option value="Exp" <?= isset($client['client_type']) && $client['client_type'] === 'Exp' ? 'selected' : '' ?>>Exp</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<input type="hidden" id="client_id" name="client_id" value="<?= isset($client['client_id']) ? $client['client_id'] : '' ?>">
|
||||
<h4 class="header-title">Address Information :</h4>
|
||||
</br><h4 class="header-title">Address Information :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Address</label>
|
||||
|
||||
@ -38,6 +38,11 @@
|
||||
background-color: #2aa762 !important; /* Set background color to a solid color */
|
||||
opacity: 1 !important; /* Set opacity to 1 to remove transparency */
|
||||
}
|
||||
|
||||
.icon-large {
|
||||
font-size: 1.5em; /* Adjust the font size as needed */
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@ -128,7 +133,13 @@
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url('make_index') ?>">
|
||||
<i class="fas fa-bicycle"></i>
|
||||
<span> Make </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager') { ?>
|
||||
|
||||
177
app/Views/make_list.php
Normal file
177
app/Views/make_list.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?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">Make 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;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bike Make</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($make as $item): ?>
|
||||
<tr>
|
||||
<td><?php echo $item['make']; ?></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">
|
||||
<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">
|
||||
<Label>Add Bike Make</Label>
|
||||
</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">
|
||||
<Label>Add Models</Label>
|
||||
</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>
|
||||
@ -26,6 +26,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="make" name="make" required>
|
||||
<option value="">Select a Make</option>
|
||||
<!-- Options for make -->
|
||||
<?php foreach ($make as $value): ?>
|
||||
<option value="<?= $value['make_id'] ?>" <?= isset($vendor['make_ids']) && in_array($value['make_id'], $vendor['make_ids']) ? 'selected' : '' ?>><?= $value['make'] ?></option>
|
||||
@ -43,23 +44,23 @@
|
||||
<input type="text" class="form-control" name="productname" placeholder="Product Name" value="<?= isset($products['product_name']) ? $products['product_name'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="vendor" class="col-form-label">Vendor<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="vendor" name="vendor" required>
|
||||
<!-- Placeholder option -->
|
||||
<option value="">Select Vendor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="vendor" class="col-form-label">Quality<span class="text-danger">*</span></label>
|
||||
<select class="form-control " name="quality" required data-toggle="select2" >
|
||||
<!-- <option value="">Select a Status</option> -->
|
||||
<option value="Q1" <?= isset($products['quality']) && $products['quality'] === 'Q1' ? 'selected' : '' ?>>Q1</option>
|
||||
<option value="Q2" <?= isset($products['quality']) && $products['quality'] === 'Q2' ? 'selected' : '' ?>>Q2 </option>
|
||||
<option value="Q3" <?= isset($products['quality']) && $products['quality'] === 'Q3' ? 'selected' : '' ?>>Q3</option>
|
||||
<option value="Q4" <?= isset($products['quality']) && $products['quality'] === 'Q4' ? 'selected' : '' ?>>Q4</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="vendor" class="col-form-label">Vendor<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="vendor" name="vendor" required>
|
||||
<!-- Placeholder option -->
|
||||
<option value="">Select Vendor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="vendor" class="col-form-label">Quality<span class="text-danger">*</span></label>
|
||||
<select class="form-control " name="quality" required data-toggle="select2" >
|
||||
<!-- <option value="">Select a Status</option> -->
|
||||
<option value="Q1" <?= isset($products['quality']) && $products['quality'] === 'Q1' ? 'selected' : '' ?>>Q1</option>
|
||||
<option value="Q2" <?= isset($products['quality']) && $products['quality'] === 'Q2' ? 'selected' : '' ?>>Q2 </option>
|
||||
<option value="Q3" <?= isset($products['quality']) && $products['quality'] === 'Q3' ? 'selected' : '' ?>>Q3</option>
|
||||
<option value="Q4" <?= isset($products['quality']) && $products['quality'] === 'Q4' ? 'selected' : '' ?>>Q4</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">Manfacturer Part Number</label>
|
||||
<input type="text" class="form-control" name="mfr_part_no" placeholder="Manfacturer Part Number" value="<?= isset($products['mfr_part_no']) ? $products['mfr_part_no'] : '' ?>" >
|
||||
@ -200,6 +201,7 @@ $(document).ready(function() {
|
||||
// Clear existing options
|
||||
$('#model').empty();
|
||||
// Append new options
|
||||
$("#model").append('<option value=""> Select a Model </option>');
|
||||
$.each(response, function(index, model) {
|
||||
$('#model').append('<option value="' + model.model_id + '">' + model.model_name + '</option>');
|
||||
});
|
||||
@ -218,7 +220,7 @@ $(document).ready(function() {
|
||||
|
||||
$(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
|
||||
console.log(model_ids);
|
||||
|
||||
@ -227,14 +229,14 @@ console.log(model_ids);
|
||||
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
|
||||
data: { 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>');
|
||||
$('#vendor').append('<option value>Select Vendor</option>');
|
||||
$.each(response, function(index, vendor) {
|
||||
$('#vendor').append('<option value="' + vendor.vendor_id + '">' + vendor.vendor_name + '</option>');
|
||||
});
|
||||
|
||||
@ -20,10 +20,10 @@
|
||||
|
||||
<form action="<?= base_url() . "add_vehicle"; ?>" method="post">
|
||||
|
||||
<h4 class="header-title">Vehicle Details :</h4><br>
|
||||
<h4 class="header-title">Vehicle Details :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Make</label>
|
||||
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" name="make" id="make" <?= isset($vehicle['make']) ? '' : 'required' ?>>
|
||||
<?= isset($vehicle['make']) ? '' : '<option value="">Select a Make</option>' ?>
|
||||
<?php foreach ($makeData as $value) : ?>
|
||||
@ -36,7 +36,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Model</label>
|
||||
<label for="inputPassword4" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" name="model" id="model" <?= isset($vehicle['model']) ? '' : 'required' ?>>
|
||||
<?php if (isset($vehicle["model_name"])) : ?>
|
||||
<option value="<?= $vehicle["model"] ?>" >
|
||||
@ -46,7 +46,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Reg Number</label>
|
||||
<label for="inputPassword4" class="col-form-label">Reg Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="regno" id="regno" placeholder="Reg Number"value="<?= isset($vehicle['reg_no']) ? $vehicle['reg_no'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -58,10 +58,11 @@
|
||||
<input type="text" class="form-control" name="colour" placeholder="Colour"value="<?= isset($vehicle['colour']) ? $vehicle['colour'] : '' ?>" >
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="header-title">Client Details :</h4><br>
|
||||
</br>
|
||||
<h4 class="header-title">Client Details :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Client Name</label>
|
||||
<label for="inputEmail4" class="col-form-label">Client Name<span class="text-danger">*</span></label>
|
||||
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addClientModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addClientModal" title="Add Client"></i>' ?>
|
||||
<select class="form-control cleint-select SelExample" id="clientData" name="client_name" required data-toggle="select2" >
|
||||
<option value="">Select a Client</option>
|
||||
@ -74,14 +75,15 @@
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($vehicle['mobile_no']) ? $vehicle['mobile_no'] : '' ?>" required maxlength="10" minlength="10">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Email</label>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email" value="<?= isset($vehicle['email']) ? $vehicle['email'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">Mobile</label>
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($vehicle['mobile_no']) ? $vehicle['mobile_no'] : '' ?>" required maxlength="10" minlength="10">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Address</label>
|
||||
<input type="text" class="form-control" name="address" placeholder="Address"value="<?= isset($vehicle['address']) ? $vehicle['address'] : '' ?>" >
|
||||
|
||||
Loading…
Reference in New Issue
Block a user