From 2b1526b886090655571f5a2bd7c96b237418ca83 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 19 Feb 2025 07:10:51 +0000 Subject: [PATCH] table name changes : ps --- app/Controllers/Complaint.php | 14 +++++++------- app/Models/ComplaintModel.php | 10 +++++----- app/Views/complaint_list.php | 34 +++++++++++++++++----------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/app/Controllers/Complaint.php b/app/Controllers/Complaint.php index 0df4ae3..9a54a6d 100755 --- a/app/Controllers/Complaint.php +++ b/app/Controllers/Complaint.php @@ -20,10 +20,10 @@ class Complaint extends BaseController if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } $ComplaintModel = new ComplaintModel(); $complaint = $ComplaintModel->findAll(); - $cubiccentimeter = $ComplaintModel->getCubicCentimeterName(); + $cubiccapacity = $ComplaintModel->getCubicCapacityName(); $data['complaint']=$complaint; - $data['cubiccentimeter']=$cubiccentimeter; + $data['cubiccapacity']=$cubiccapacity; return view('complaint_list',$data); } @@ -32,13 +32,13 @@ class Complaint extends BaseController if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } try { $name = $this->request->getPost('name'); - $cubic_centimeter_id = $this->request->getPost('cubic_centimeter_id'); - // echo $cubic_centimeter_id; die; + $cubic_capacity_id = $this->request->getPost('cubic_capacity_id'); + // echo $cubic_capacity_id; die; $ComplaintModel = new ComplaintModel(); $conditions = ['name' => $name, 'isactive' => 1]; - if ($cubic_centimeter_id) { - $conditions['cubic_centimeter_id'] = $cubic_centimeter_id; + if ($cubic_capacity_id) { + $conditions['cubic_capacity_id'] = $cubic_capacity_id; } if ($complaint_id > 0) { @@ -59,7 +59,7 @@ class Complaint extends BaseController "cgst" => $this->request->getPost('tax')/2, "sgst" => $this->request->getPost('tax')/2, "tax" => $this->request->getPost('tax'), - "cubic_centimeter_id" => $this->request->getPost('cubic_centimeter_id') ? $this->request->getPost('cubic_centimeter_id') : 0, + "cubic_capacity_id" => $this->request->getPost('cubic_capacity_id') ? $this->request->getPost('cubic_capacity_id') : 0, ]; if (!$complaint_id) { diff --git a/app/Models/ComplaintModel.php b/app/Models/ComplaintModel.php index 208c69d..310f228 100755 --- a/app/Models/ComplaintModel.php +++ b/app/Models/ComplaintModel.php @@ -5,13 +5,13 @@ class ComplaintModel extends Model { protected $table = 'complaints'; protected $primaryKey = 'complaint_id'; - protected $allowedFields = ['complaint_id','business_id','name','labour_charge','cgst','sgst','tax','labour_cost_with_tax','isactive','cubic_centimeter_id']; + protected $allowedFields = ['complaint_id','business_id','name','labour_charge','cgst','sgst','tax','labour_cost_with_tax','isactive','cubic_capacity_id']; - public function getCubicCentimeterName() + public function getCubiccapacityName() { - return $this->db->table('cubic_centimeter') - ->select('cubic_centimeter.*') - ->where('cubic_centimeter.isactive', 1) + return $this->db->table('cubic_capacity') + ->select('cubic_capacity.*') + ->where('cubic_capacity.isactive', 1) ->get() ->getResultArray(); } diff --git a/app/Views/complaint_list.php b/app/Views/complaint_list.php index 96f25de..21d549a 100755 --- a/app/Views/complaint_list.php +++ b/app/Views/complaint_list.php @@ -33,16 +33,16 @@ if($value['isactive'] == 0){ $color ='red'; } - $cubiccentimeter_name = ''; // Default to empty if no match - // Loop through $cubiccentimeter to find a match - foreach ($cubiccentimeter as $cc) { - if ($cc['id'] == $value['cubic_centimeter_id']) { - $cubiccentimeter_name = ' ( '.$cc['value'].' )'; // Get the name of the matching cubiccentimeter + $cubiccapacity_name = ''; // Default to empty if no match + // Loop through $cubiccapacity to find a match + foreach ($cubiccapacity as $cc) { + if ($cc['id'] == $value['cubic_capacity_id']) { + $cubiccapacity_name = ' ( '.$cc['value'].' )'; // Get the name of the matching cubiccapacity break; } } ?> - + @@ -91,10 +91,10 @@
- - + + @@ -142,19 +142,19 @@ } function submitComplaint(params) { - // console.log(':)',$('#cubic_centimeter_id').val());return false; + // console.log(':)',$('#cubic_capacity_id').val());return false; if (!$('#name').val() || !$('#labour_charge').val()) { return false; } - console.log($('#cubic_centimeter_id').val()); + console.log($('#cubic_capacity_id').val()); var tax = parseFloat($("#tax").val()); var labour_cost_with_tax = parseFloat($("#labour_cost_with_tax").val()); if(labour_cost_with_tax == '' || tax == ''){ toastr.warning('Please select Tax', 'Warning'); return; } - // if($(!'#cubic_centimeter').val()){ - // toastr.warning('Please select Cubic Centimeter', 'Warning'); + // if($(!'#cubic_capacity').val()){ + // toastr.warning('Please select Cubic capacity', 'Warning'); // return; // } @@ -163,7 +163,7 @@ labour_charge: $('#labour_charge').val(), tax: tax, labour_cost_with_tax: labour_cost_with_tax, - cubic_centimeter_id: $('#cubic_centimeter').val(), + cubic_capacity_id: $('#cubic_capacity').val(), }; var complaint_id = $('#complaint_id').val(); if (!complaint_id) { @@ -216,7 +216,7 @@ $('#name').val(response.complaint[0].name); $('#labour_charge').val(response.complaint[0].labour_charge); $('#labour_cost_with_tax').val(response.complaint[0].labour_cost_with_tax); - var cc_id = response.complaint[0].cubic_centimeter_id; + var cc_id = response.complaint[0].cubic_capacity_id; var tax = parseFloat(response.complaint[0].cgst) + parseFloat(response.complaint[0].sgst); var selectElement = document.getElementById('tax'); @@ -227,7 +227,7 @@ break; } } - var selectElementForCC = document.getElementById('cubic_centimeter'); + var selectElementForCC = document.getElementById('cubic_capacity'); var ccOptions = selectElementForCC.options; for (var j = 0; j < ccOptions.length; j++) { if (ccOptions[j].value === cc_id) {