diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 497ecd21..f7e66844 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -231,7 +231,6 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){ $routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1"); $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile"); - $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->get("relationshipList", "EmployeeRestController::relationshipList"); @@ -246,6 +245,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy"); $routes->get("getClientDetails", "EmployeeRestController::getClientDetails"); $routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy"); + $routes->get("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn"); }); $routes->post("sendEmail", "EmployeeRestController::send_email"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 1adc1a7e..c22adea1 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -294,14 +294,23 @@ class EmployeeRestController extends AdminController public function getClientPolicy() { try { - $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name') - ->join('policies', 'client_policy.policy_id = policies.id', 'left') - ->where('client_policy.client_id', $this->request->getGet('client_id') ) - ->findAll(); - - $result[] = $ClientPolicyData[0]; - $result[] = $ClientPolicyData[2]; - // You probably meant to check $result, not $data + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon') + ->join('policies', 'client_policy.policy_id = policies.id', 'left') + ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->findAll(); + $result = []; + foreach ($ClientPolicyData as $key => $value) { + $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']); + if($value['is_addon'] == 1){ + $value['type'] = 'Add-On'; + }else{ + $value['type'] = $getSlabAndGridData['grid_master']['policy_type']; + } + + array_push($result,$value); + + + } if ($ClientPolicyData) { return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200); } else { @@ -1041,8 +1050,10 @@ public function getAddOnPolicy() $addOnEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll(); $GMCEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll(); + $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll(); + // dd($clientPolicy); if(count($clientPolicy)) { $PolicyData = []; @@ -1055,7 +1066,7 @@ public function getAddOnPolicy() if($array['is_addon'] == 1) { - + $responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name; $responce['SlabRates'] = $getSlabAndGridData['slab_rates']; $responce['GridMaster'] = $getSlabAndGridData['grid_master']; $responce['client_id'] = $array['client_id']; @@ -1063,6 +1074,7 @@ public function getAddOnPolicy() $responce['is_addon'] = $array['is_addon']; $responce['open_for_enrollment'] = $array['open_for_enrollment']; $responce['policy_terms'] = $decodedArray; + // Map family floaters that already exist in the employee table @@ -1202,6 +1214,9 @@ public function getAddOnPolicy() } } - +public function iAgreeForAddOn() +{ + return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200); +} } \ No newline at end of file