From b4cc2fb2a4eb8515bace7007367f17d33560717c Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 2 May 2024 10:06:54 +0530 Subject: [PATCH] CHANGE_ in polict list openForEnrolemnt key and added policy_status key where in where condition : GWM --- app/Controllers/EmployeeRestController.php | 10 +++++++--- app/Models/EmployeeModel.php | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 33db711e..c0a77ef6 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1039,6 +1039,7 @@ public function getEmployeePolicy() $keysToRemove = ["removable_keys"]; // Retrieve employee policy data by passing the employee primary key $empPolicy = $this->employeeModel->getEmployeePolicy($id); + // Retrieve employee and dependents data by passing the employee code $employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id) ->where('is_active', 1 )->where('is_addon_value',0)->findAll(); @@ -1062,6 +1063,7 @@ public function getEmployeePolicy() $array->SlabRates = $getSlabAndGridData['slab_rates']; $array->GridMaster = $getSlabAndGridData['grid_master']; + // Construct value for policy type GPA if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){ @@ -1268,8 +1270,10 @@ public function getAddOnPolicy() $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',0)->findAll(); - $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll(); - // dd($clientPolicy); + $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id')) + ->where('policy_status', 1) + ->findAll(); + if(count($clientPolicy)) { $PolicyData = []; @@ -1286,7 +1290,7 @@ public function getAddOnPolicy() $responce['client_id'] = $array['client_id']; $responce['client_policy_id'] = $array['id']; $responce['is_addon'] = $array['is_addon']; - $responce['open_for_enrollment'] = $array['open_for_enrollment']; + $responce['OpenForEnrollment'] = $array['open_for_enrollment']; $responce['policy_terms'] = $decodedArray; if(count($getSlabAndGridData['slab_rates'])){ diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index fdd19e40..aea640c9 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -135,6 +135,7 @@ class EmployeeModel extends Model ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') ->join('policies', 'policies.id = client_policy.policy_id') + ->where('client_policy.policy_status', 1) ->where('employee_polices.employee_id', $id) ->get() ->getResult();