From c78945fee622b5ce6b97ef4e909e006f2a7a33bb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Jun 2024 13:18:54 +0530 Subject: [PATCH] CHANGE_DATATABLE_EDITED_ONE_HIGHLIGHT : AADHAVAN --- app/Controllers/Jobcard.php | 1 + app/Controllers/Purchase.php | 14 ++- app/Controllers/Vehicle.php | 64 +++++------ app/Models/VehicleModel.php | 2 +- app/Views/bike_model_list.php | 118 +++++++++++--------- app/Views/client_list.php | 146 ++++++++++++------------ app/Views/complaint_list.php | 115 ++++++++++--------- app/Views/job_card_form.php | 1 + app/Views/jobs_list.php | 131 ++++++++++++---------- app/Views/layout/footer.php | 1 + app/Views/layout/header.php | 6 +- app/Views/make_list.php | 117 +++++++++++--------- app/Views/manufacturer_list.php | 72 +++++++++++- app/Views/outsourcing_list.php | 111 ++++++++++--------- app/Views/product_list.php | 190 ++++++++++++++++---------------- app/Views/purchase_form.php | 26 +++-- app/Views/purchase_list.php | 114 ++++++++++--------- app/Views/return_list.php | 109 ++++++++++-------- app/Views/sales_list.php | 117 +++++++++++--------- app/Views/sales_order_form.php | 1 + app/Views/service_list.php | 111 ++++++++++--------- app/Views/user_list.php | 110 +++++++++--------- app/Views/vehicle_form.php | 59 +++++++--- app/Views/vehicle_list.php | 112 ++++++++++--------- app/Views/vendor_list.php | 109 +++++++++--------- 25 files changed, 1096 insertions(+), 861 deletions(-) diff --git a/app/Controllers/Jobcard.php b/app/Controllers/Jobcard.php index 4c9527d..e01ed45 100644 --- a/app/Controllers/Jobcard.php +++ b/app/Controllers/Jobcard.php @@ -524,6 +524,7 @@ class Jobcard extends BaseController $vehicles = $VehicleModel->where('isactive',1)->where('vehicle_id',$jobs['vehicle_id']) ->where('branch_id',$this->session->get('logged_user_branch_id')) ->first(); + // print_r($jobs['vehicle_id']);die; $makeId = $vehicles['make']; $modelId = $vehicles['model']; diff --git a/app/Controllers/Purchase.php b/app/Controllers/Purchase.php index 6fc80f1..f20b3d0 100644 --- a/app/Controllers/Purchase.php +++ b/app/Controllers/Purchase.php @@ -45,6 +45,8 @@ class Purchase extends BaseController public function new_purchase($purchase_order_id) { if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } + $ProductModel = new ProductModel(); + if ($purchase_order_id === '0') { $data['purchase'] = []; @@ -62,7 +64,6 @@ class Purchase extends BaseController $BusinessModel = new BusinessModel(); $branch = $BranchModel->where('branch_id', $this->session->get('logged_user_branch_id'))->get()->getRowArray(); $business = $BusinessModel->where('business_id', $this->session->get('logged_user_business_id'))->get()->getRowArray(); - $ProductModel = new ProductModel(); $product=$ProductModel->where('isactive',1) ->where('branch_id',$this->session->get('logged_user_branch_id')) ->findAll(); @@ -99,14 +100,14 @@ class Purchase extends BaseController // print_r($vendor);die; $vendorId=$purchase['vendor_id']; $encodedVendorId = json_encode([$vendorId]); - $productModel = new ProductModel(); // Query the database to find the product based on make_id and model_id - $product = $productModel->select('products.*, manufacturer.manufacturer_name') + $product = $ProductModel->select('products.*, manufacturer.manufacturer_name') ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') ->where('JSON_CONTAINS(vendor, \'' . $encodedVendorId . '\')', null, false) ->findAll(); $data['product']=$product; + // print_r($product);die; @@ -116,7 +117,11 @@ class Purchase extends BaseController $data['purchase_product']=$purchase_product; } - + $productAll= $ProductModel->select('products.*, manufacturer.manufacturer_name') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->where('products.isactive',1) + ->findAll(); + $data['productAll']= json_encode($productAll); echo view('purchase_form',$data); } @@ -388,6 +393,7 @@ public function getVendorProducts() $product = $productModel->select('products.*, manufacturer.manufacturer_name') ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') ->where('JSON_CONTAINS(vendor, \'' . $encodedVendorId . '\')', null, false) + ->where('products.isactive',1) ->findAll(); // print_r($product);die; diff --git a/app/Controllers/Vehicle.php b/app/Controllers/Vehicle.php index 1373240..4c16c34 100644 --- a/app/Controllers/Vehicle.php +++ b/app/Controllers/Vehicle.php @@ -74,40 +74,40 @@ class Vehicle extends BaseController { if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } $VehicleModel = new VehicleModel(); + $reg_no = $this->request->getPost('regno'); + $vehicle = $VehicleModel->where('reg_no',$reg_no)->first(); + // if(!$vehicle){ + $data = [ + 'client_id' => $this->request->getPost('client_name'), + 'email' => $this->request->getPost('email'), + 'gstnumber' => $this->request->getPost('gstnumber'), + 'address' => $this->request->getPost('address'), + 'mobile_no' => $this->request->getPost('mobile_no'), + 'city' => $this->request->getPost('city'), + 'state' => $this->request->getPost('state'), + 'postal_code' => $this->request->getPost('postalcode'), + 'make' => $this->request->getPost('make'), + 'model' => $this->request->getPost('model'), + 'reg_no' => $reg_no, + 'colour' => $this->request->getPost('colour'), + 'year_of_manufacturing' => $this->request->getPost('year_of_manufacturing'), + 'branch_id' => $this->session->get('logged_user_branch_id'), + 'specific' => $this->request->getPost('specific'), + 'isactive' => 1 // Assuming this is a default value or handled separately + ]; + $vehicle_id = $this->request->getPost('vehicle_id'); + if (!empty($vehicle_id)) { + $VehicleModel->update($vehicle_id, $data); + } else { + $VehicleModel->insert($data); + } + return redirect()->to('vehicle_index'); + // }else{ + // $this->session->setFlashdata('error', 'Vehicle with this registration number already exists.'); + // return redirect()->back()->withInput(); + // } - $data = [ - 'client_id' => $this->request->getPost('client_name'), - 'email' => $this->request->getPost('email'), - 'address' => $this->request->getPost('address'), - 'mobile_no' => $this->request->getPost('mobile_no'), - 'city' => $this->request->getPost('city'), - 'state' => $this->request->getPost('state'), - 'postal_code' => $this->request->getPost('postalcode'), - 'make' => $this->request->getPost('make'), - 'model' => $this->request->getPost('model'), - 'reg_no' => $this->request->getPost('regno'), - 'colour' => $this->request->getPost('colour'), - 'year_of_manufacturing' => $this->request->getPost('year_of_manufacturing'), - 'branch_id' => $this->session->get('logged_user_branch_id'), - 'specific' => $this->request->getPost('specific'), - 'isactive' => 1 // Assuming this is a default value or handled separately - ]; - - - $vehicle_id = $this->request->getPost('vehicle_id'); - - - if (!empty($vehicle_id)) { - - $VehicleModel->update($vehicle_id, $data); - } else { - - $VehicleModel->insert($data); - } - - - return redirect()->to('vehicle_index'); } public function delete_vehicle($vehicle_id) diff --git a/app/Models/VehicleModel.php b/app/Models/VehicleModel.php index 2cff2fd..f5c1455 100644 --- a/app/Models/VehicleModel.php +++ b/app/Models/VehicleModel.php @@ -7,7 +7,7 @@ class VehicleModel extends Model protected $table = 'vehicle'; protected $primaryKey = 'vehicle_id'; - protected $allowedFields = ['branch_id','vehicle_id','make','model','reg_no','year_of_manufacturing','colour','client_id','address','country','state','city','email','postal_code','mobile_no','specific','isactive']; + protected $allowedFields = ['branch_id','vehicle_id','make','model','reg_no','year_of_manufacturing','colour','client_id','address','country','state','city','gstnumber','email','postal_code','mobile_no','specific','isactive']; public function getCustomerandVehicle($branch_id) { diff --git a/app/Views/bike_model_list.php b/app/Views/bike_model_list.php index 672e630..a0dbb94 100644 --- a/app/Views/bike_model_list.php +++ b/app/Views/bike_model_list.php @@ -21,7 +21,7 @@
- +
@@ -30,8 +30,8 @@ - - + $item): ?> + ' + @@ -214,7 +214,8 @@ row += ''; // Append the row to the tbody - $('tbody').append(row); + // $('tbody').append(row); + window.location.reload(); }); } }, @@ -269,50 +270,59 @@ \ No newline at end of file diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 21dcb8a..1006aae 100644 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -17,44 +17,38 @@
-
Model Name
@@ -45,12 +45,12 @@ @@ -186,7 +186,7 @@ success: function(response) { if (response.status == "success") { - $('tbody').html(''); + // $('tbody').html(''); response.data.forEach(function(item) { var row = '
+
- - - + - - - - $value) : if ($value['isactive'] == 1) : ?> - - - - - + + + + - - + + + + + -
Client Name Mobile Email Actions
-
+ - +
@@ -65,50 +59,62 @@ \ No newline at end of file diff --git a/app/Views/complaint_list.php b/app/Views/complaint_list.php index 87b2394..41fba01 100644 --- a/app/Views/complaint_list.php +++ b/app/Views/complaint_list.php @@ -16,7 +16,7 @@
- +
@@ -28,8 +28,8 @@ - - + $value) : ?> + @@ -45,8 +45,8 @@ @@ -185,51 +185,62 @@ $('#form_add_edit').text('Add Complaint'); $('#model_form_data')[0].reset(); } - - $(document).ready(function() { - $('#datatable-buttons-2').DataTable({ - "order": [[2, 'desc']], // Set initial sorting to descending on the first column - "dom": 'Bfrtip', // Show export buttons - "buttons": [ { - extend: 'pdfHtml5', - title: 'Complaint', // Set your custom PDF title here - text: 'PDF', - customize: function(doc) { - // You can further customize the PDF here if needed - // doc.content[1].table.body.forEach(function(row) { - // row.splice(0, 1); // Remove the first column (ID column) - // }); - } - }, - { - extend: 'print', - title: 'Complaint', // Set your custom print title here - text: 'Print', - customize: function(win) { - // You can further customize the print output here if needed - // $(win.document.body).find('table').find('th:first-child, td:first-child').remove(); - } - }, - { - extend: 'copy', - text: 'Copy', // Set the title for the Copy button - titleAttr: 'Copy', // Set the tooltip for the Copy button - exportOptions: { - // columns: ':not(:first-child)' // Exclude the first column (ID column) - } - }, - { - extend: 'csv', - text: 'CSV', // Set the title for the CSV button - title: 'Complaint', // Set your custom print title here - exportOptions: { - // columns: ':not(:first-child)' // Exclude the first column (ID column) - } - }], // Enable export options - "language": { - "search": "Search: " // Customize search label - }, - "ordering": false - }); - }); + + + \ No newline at end of file diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php index 54a69a0..4374ca1 100644 --- a/app/Views/job_card_form.php +++ b/app/Views/job_card_form.php @@ -1962,6 +1962,7 @@ $closestTR.remove(); // Event listener for customer selection change $('.vehicle-select').change(function() { + $('tbody').empty(); var vehicleId = $(this).val(); if (vehicleId !== '') { // Find the selected client in the client data diff --git a/app/Views/jobs_list.php b/app/Views/jobs_list.php index 6d3bcec..308ef1d 100644 --- a/app/Views/jobs_list.php +++ b/app/Views/jobs_list.php @@ -48,7 +48,7 @@ -
Complaint
@@ -65,26 +65,26 @@ - - + $value) : if ($value['isactive'] == 1) : ?> + + if ($value['status'] == 'Issued') { + echo 'issued-status'; + } elseif ($value['status'] == 'Created') { + echo 'created-status'; + } elseif ($value['status'] == 'Paid') { + echo 'paid-status'; + } + ?>">