From 5c0fdef4a74f71e08db66388546d36cf1d45bce8 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 25 Feb 2025 11:50:03 +0000 Subject: [PATCH] fixes : ps --- app/Controllers/Service.php | 67 ++++++++++++++++++++----------------- app/Views/service_list.php | 6 ++-- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/app/Controllers/Service.php b/app/Controllers/Service.php index e4fea91..9941141 100755 --- a/app/Controllers/Service.php +++ b/app/Controllers/Service.php @@ -40,42 +40,49 @@ class Service extends BaseController public function service_index() { - - $services = $this->ServiceModel->where('branch_id',$this->session->get('logged_user_branch_id'))->orderBy('service_name','ASC')->findAll(); + $services = $this->ServiceModel->select('services.*,cubic_capacity.value') + ->join('cubic_capacity', 'cubic_capacity.id = services.cubic_capacity_id','left') + ->where('services.branch_id',$this->session->get('logged_user_branch_id')) + ->orderBy('services.service_name','ASC')->findAll(); - foreach ($services as &$service) { - // Convert JSON strings to arrays - $makes_ids = json_decode($service['makes_id'], true) ?? []; - $models_ids = json_decode($service['models_id'], true) ?? []; - // Fetch make names - $makeNames = []; + + - foreach ($makes_ids as $make_id) { - if (!empty($make_id)) { // Check if $make_id is not null or empty - $make = $this->BikemakeModel->find($make_id); - if ($make) { - $makeNames[] = $make['make']; - } - } - } + + // foreach ($services as &$service) { + // // Convert JSON strings to arrays + // $makes_ids = json_decode($service['makes_id'], true) ?? []; + // $models_ids = json_decode($service['models_id'], true) ?? []; --> - // Fetch model names - $modelNames = []; + // // Fetch make names + // $makeNames = []; - foreach ($models_ids as $model_id) { - if (!empty($model_id)) { // Check if $model_id is not null or empty - $model = $this->BikemodelsModel->find($model_id); - if ($model) { - $modelNames[] = $model['model_name']; - } - } - } + // foreach ($makes_ids as $make_id) { + // if (!empty($make_id)) { // Check if $make_id is not null or empty + // $make = $this->BikemakeModel->find($make_id); + // if ($make) { + // $makeNames[] = $make['make']; + // } + // } + // } - // Replace IDs with names - $service['makes_names'] = implode(', ', $makeNames); - $service['models_names'] = implode(', ', $modelNames); - } + // // Fetch model names + // $modelNames = []; + + // foreach ($models_ids as $model_id) { + // if (!empty($model_id)) { // Check if $model_id is not null or empty + // $model = $this->BikemodelsModel->find($model_id); + // if ($model) { + // $modelNames[] = $model['model_name']; + // } + // } + // } + + // // Replace IDs with names + // $service['makes_names'] = implode(', ', $makeNames); + // $service['models_names'] = implode(', ', $modelNames); + // } $data['services']=$services; return view('service_list',$data); diff --git a/app/Views/service_list.php b/app/Views/service_list.php index 72ba325..390ed66 100755 --- a/app/Views/service_list.php +++ b/app/Views/service_list.php @@ -36,9 +36,11 @@ $color = ''; if($value['isactive'] == 0){ $color ='red'; - }?> + } + $name = $value['value'] ? " ( ". $value['value']." ) " : "" + ?> - +