CHNAGE_MAKE_EDIT : AADHAVAN

This commit is contained in:
aadhavan valli 2024-04-24 15:27:02 +05:30
parent 9da2c550b9
commit 0332f2c2dd
8 changed files with 171 additions and 190 deletions

View File

@ -117,35 +117,42 @@ $routes->get('dashboard', 'Users::dashboard');
//---------------------- Make And Model | Service | Manufacturer | Inventory->Purchase | Complaint
// Make
$routes->get('make_index', 'Make::index');
$routes->post('create_make', 'Make::create_make');
// Model
//---------------------- Make And Model | Service | Manufacturer | Inventory->Purchase
//---------------------- Reorder Level | Return Order | Complaint
// Make //
$routes->get('make_index', 'Make::index');
$routes->post('create_make/(:any)', 'Make::create_make/$1');
// Make End's //
// Model //
$routes->get('bike_model_index/(:any)', 'Model::index/$1');
$routes->post('create_model', 'Model::create_model');
$routes->post('status_model', 'Model::status_model');
// Model End's//
// Service
// 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");
// Service End's//
//Spare manufacturer
//Spare manufacturer//
$routes->get('spare_manufacturer_index', 'Manufacturer::index');
$routes->post('create_manufacturer', 'Manufacturer::create_manufacturer');
//Spare manufacturer End's//
// Purchase
// Purchase//
$routes->get('purchase_index', 'Purchase::purchase_index');
$routes->get("new_purchase/(:any)", "Purchase::new_purchase/$1");
$routes->get('get_vendor/(:any)', 'Purchase::get_vendor/$1');
@ -155,10 +162,14 @@ $routes->post("getVendorProducts", "Purchase::getVendorProducts");
$routes->post("delete_purchase_product", "Purchase::delete_purchase_product");
$routes->get("download_purchase_invoice/(:any)", "Purchase::download_purchase_invoice/$1");
$routes->get("reorder_purchase/(:any)", "Purchase::reorder_purchase/$1");
// Purchase End's//
// Reorder Level//
$routes->get('reorder_level_index', 'Reorderlevel::reorder_level_index');
$routes->get('rise_order/(:any)', 'Reorderlevel::rise_order/$1');
// Reorder Level//
// Return Order//
$routes->get('return_order_index', 'ReturnOrder::return_order_index');
@ -166,9 +177,8 @@ $routes->get('return_order', 'ReturnOrder::return_order');
$routes->get("new_return/(:any)", "ReturnOrder::new_return/$1");
$routes->post("add_return_purchase", "ReturnOrder::add_return_purchase");
$routes->get('get_vendor/(:any)', 'Purchase::get_vendor/$1');
$routes->get('edit_return_order/(:any)', 'ReturnOrder::edit_return_order/$1');
// Return Order End's//
// Complaint
@ -176,3 +186,4 @@ $routes->get('complaint_index', 'Complaint::complaint_index');
$routes->post('create_complaint/(:any)', 'Complaint::create_complaint/$1');
$routes->get('edit_complaint/(:any)', 'Complaint::edit_complaint/$1');
$routes->get("delete_complaint/(:any)", "Complaint::delete_complaint/$1");
// Complaint End's//

View File

@ -5,33 +5,26 @@ namespace App\Controllers;
use App\Models\ComplaintModel;
use CodeIgniter\API\ResponseTrait;
class Complaint extends BaseController
{
public $session;
use ResponseTrait;
public function __construct()
{
$this->session = session();
}
public function complaint_index()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ComplaintModel = new ComplaintModel();
$complaint = $ComplaintModel->findAll();
$data['complaint']=$complaint;
return view('complaint_list',$data);
}
public function create_complaint($complaint_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
@ -65,23 +58,16 @@ class Complaint extends BaseController
}
}
public function edit_complaint($complaint_id)
{
$complaintModel = new ComplaintModel();
$complaint = $complaintModel->where('complaint_id',$complaint_id)->findAll();
$data['page_name']= 'Edit Complaint';
$complaintModel = new ComplaintModel();
$complaint = $complaintModel->where('complaint_id',$complaint_id)->findAll();
$data['complaint']=$complaint;
return json_encode($data);
}
public function delete_complaint($complaint_id)
{
@ -98,6 +84,5 @@ class Complaint extends BaseController
// Return error response if deletion fails
return $this->response->setJSON(['success' => false]);
}
}
?>

View File

@ -31,7 +31,7 @@ class Make extends BaseController
public function create_make()
public function create_make($make_id)
{
try {
$make_name = $this->request->getPost('makename');
@ -39,6 +39,7 @@ class Make extends BaseController
$data = [
'make' => $make_name
];
if (!$make_id) {
$inserted = $BikemakeModel->insert($data);
if ($inserted) {
$result = $data;
@ -47,6 +48,16 @@ class Make extends BaseController
$result = "No Match's";
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
}
}else{
$updated = $BikemakeModel->update($make_id,$data);
if ($updated) {
$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);
}

View File

@ -21,7 +21,6 @@
<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;text-align: center;width: 100%;">
<thead>
<tr>
@ -30,7 +29,6 @@
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($model as $item): ?>
<tr>
@ -55,9 +53,7 @@
<?php endforeach; ?>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
@ -65,7 +61,6 @@
<!-- 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">

View File

@ -6,8 +6,7 @@
<h4 class="page-title">Complaints List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="#" data-toggle="modal" data-target="#complaint-add-modal" class="btn btn-primary waves-effect" onclick="clearDetials(this)"> <i class="ri-add-line"></i></a>
</li>
<li class=""> <a href="#" data-toggle="modal" data-target="#complaint-add-modal" class="btn btn-primary waves-effect" onclick="clearDetials(this)"> <i class="ri-add-line"></i></a></li>
</ol>
</div>
</div>
@ -17,8 +16,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;">
<thead>
<tr>
<th> Name</th>
@ -43,21 +41,18 @@
<td>
<a data-toggle="modal" data-target="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this)" class="delete-button"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_complaint/" . $value['complaint_id']; ?>" class="delete-button"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<?php endforeach; ?>
</tr>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
</div>
<!-- /.modal -->
<div id="complaint-add-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
@ -65,9 +60,7 @@
<div class="text-center mt-2 mb-4">
<h4 id="form_add_edit">Add Complaint</h4>
</div>
<form id="model_form_data" class="px-3">
<div class="form-group">
<label for="name">Name </label>
<input class="form-control" type="text" id="complaint_id" hidden>
@ -77,25 +70,18 @@
<label for="labour_charge">Labour Charge </label>
<input class="form-control" type="text" id="labour_charge" required="" placeholder="Labour Charge....">
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitComplaint(this)">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php include('layout/footer.php'); ?>
<script>
function submitComplaint(params) {
if (!$('#name').val() || !$('#labour_charge').val()) {
return false;
}
@ -103,13 +89,10 @@
name: $('#name').val(),
labour_charge: $('#labour_charge').val(),
};
var complaint_id = $('#complaint_id').val();
if (!complaint_id) {
complaint_id = 0;
}
$.ajax({
type: 'POST',
url: '<?php echo base_url()."create_complaint/"?>' + complaint_id,
@ -129,12 +112,8 @@
}
function editComplaint(params) {
var complaint_id = $(params).data('value');
$.ajax({
type: 'GET',
url: '<?php echo base_url()."edit_complaint/"?>' + complaint_id,
@ -156,6 +135,6 @@
function clearDetials(params) {
$('#form_add_edit').text('Add Complaint');
}
</script>

View File

@ -34,7 +34,7 @@
<tr>
<td class="make"><?php echo $item['make']; ?></td>
<td>
<a data-toggle="modal" data-target="#bike_make_login-modal" value="<?php echo $item['make_id']; ?>" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line"></i></a>
<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="<?php echo $item['make_id']; ?>" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line"></i></a>
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" style="margin-left: 12px;" 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>
@ -66,6 +66,7 @@
<div class="form-group">
<label for="makename">Make Name </label>
<input type="text" id="edit_make_id" hidden>
<input class="form-control" type="text" id="bike_make_name" required="" placeholder="Make Name....">
</div>
@ -155,9 +156,15 @@
makename: $('#bike_make_name').val()
};
var edit_make_id = $('#edit_make_id').val();
if (!edit_make_id) {
edit_make_id =0;
}
$.ajax({
type: 'POST',
url: 'create_make',
url: 'create_make/'+edit_make_id,
data: formData,
dataType: 'json',
success: function(response) {
@ -174,6 +181,8 @@
function editMake(params) {
$('#edit_make_id').val($(params).data('value'));
$('#form_add_edit').text('Edit Bike Make');
var full_div = $(params).parent().parent()[0];

View File

@ -6,9 +6,7 @@
<h4 class="page-title">Vehicle List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="<?= base_url() . "new_vehicle/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a>
</li>
<li class=""> <a href="<?= base_url() . "new_vehicle/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a></li>
</ol>
</div>
</div>
@ -19,15 +17,9 @@
<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>Reg No</th>
<th>Make & Model</th>
@ -39,7 +31,6 @@
</tr>
</thead>
<tbody>
<?php foreach ($vehicle as $value) :
if ($value['isactive'] == 1) : ?>