diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 2b2e017c..01735912 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -954,7 +954,7 @@ class EmployeeRestController extends AdminController public function getEmployeePolicy() { - // try { + try { $id = $this->request->getGet('id'); $emp_code = $this->request->getGet('emp_code'); @@ -1114,21 +1114,21 @@ class EmployeeRestController extends AdminController // Add family floter buttons placement data for FE validation if(count($floters)){ - foreach ($floters as $familyFloatesValue) { + foreach ($floters as $familyFloatesValue) { - $temp2['is_value_exist'] = false; - $temp2['data']['family_floater_key'] = $familyFloatesValue; - $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); - - - $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); + $temp2['is_value_exist'] = false; + $temp2['data']['family_floater_key'] = $familyFloatesValue; + $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); + + + $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); - array_push($data,$temp2); + array_push($data,$temp2); + } } - } $array->mapped_family_floaters = $data; $array->type = "Group Medical Coverage"; @@ -1164,9 +1164,9 @@ class EmployeeRestController extends AdminController }else{ return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200); } - // } catch (\Exception $e) { - // return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); - // } + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } } @@ -1178,6 +1178,7 @@ class EmployeeRestController extends AdminController ->where('client_branch_id',$client_branch_id) ->where('is_active', 1 ) ->where('is_addon_value',0)->findAll(); + // return $employeeData; foreach ($GmcParrentsPolicy as $key => $array) { @@ -1241,6 +1242,7 @@ class EmployeeRestController extends AdminController // Convert familyFloaters terms data to plain array $floters = $this->FloterConvertion($familyFloates); + $data = []; foreach ($floters as $familyFloatesValue) { $dependent = preg_replace('/\d/', '', $familyFloatesValue); @@ -1386,8 +1388,18 @@ class EmployeeRestController extends AdminController } } + + $first_two_chars = substr($result, 0, 3); + + if($first_two_chars == " +"){ + $modified_string = substr($result, 3); + return "Can Add ".$modified_string; + }else{ + return $result; + } + return substr($result, 0, 2) !== " +"; - return $result; + } public function getClientDetails()