diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 3c8a145d..b49b37d6 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -960,7 +960,7 @@ public function getEmployeePolicy() // Construct value for policy type GPA - if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){ + if($getSlabAndGridData['grid_master']['policy_type'] == "GPA" && $this->request->getGet('policy') == 'GPA'){ // Filter employee data where the family_floater_key is 'self' $selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self'); @@ -985,7 +985,7 @@ public function getEmployeePolicy() } // Construct value for policy type GMC - }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){ + }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC" && $this->request->getGet('policy') == 'GMC' ){ @@ -1035,7 +1035,7 @@ public function getEmployeePolicy() } } } - // dd($data); + // Remove Unwanted floter key from floters array based on either-parents-pil term value @@ -1064,6 +1064,9 @@ public function getEmployeePolicy() $temp2['data']['client_policy_id'] = $array->ClientPolicyId; $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue); + $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); + + $temp2['data']['age_validation'] = $decodedArray->age_ratio->$ageKey; array_push($data,$temp2); @@ -1229,7 +1232,9 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id) $temp2['data']['client_policy_id'] = $array->ClientPolicyId; $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue); - + $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); + + $temp2['data']['age_validation'] = $array->Policy_Terms->age_ratio->$ageKey; array_push($data,$temp2); } @@ -1487,6 +1492,9 @@ public function getAddOnPolicy() $temp2['data']['client_policy_id'] = $array['id']; $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue); + $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); + + $temp2['data']['age_validation'] = $decodedArray->age_ratio->$ageKey; array_push($data,$temp2);