Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev Srinivas
This commit is contained in:
commit
7f7dee16b0
@ -1078,7 +1078,8 @@ class EmployeeRestController extends AdminController
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
$login_by_hr = $this->request->getGet('login_by_hr');
|
||||
|
||||
// This is an array containing keys to be removed from the terms and conditions array
|
||||
$keysToRemove = ["removable_keys"];
|
||||
@ -1121,9 +1122,12 @@ class EmployeeRestController extends AdminController
|
||||
if($array->policy_type_id == 1 && $this->request->getGet('policy') == 'GPA')
|
||||
{
|
||||
|
||||
$si_value = 0;
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
|
||||
$self['is_value_exist'] = true;
|
||||
$self['data']['family_floater_key'] = 'self';
|
||||
@ -1137,14 +1141,15 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$array->mapped_family_floaters = $self;
|
||||
$array->type = 'GPA';
|
||||
$array->si_value = $si_value;
|
||||
|
||||
|
||||
|
||||
$res = [];
|
||||
array_push($res,$array);
|
||||
$EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id);
|
||||
$EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id,$login_by_hr);
|
||||
if($EDLIPolicy){ array_push($res,$EDLIPolicy); }
|
||||
$GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id);
|
||||
$GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id,$login_by_hr);
|
||||
if($GTLIPolicy){ array_push($res,$GTLIPolicy); }
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $res ], 200);
|
||||
|
||||
@ -1481,7 +1486,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id)
|
||||
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id,$login_by_hr)
|
||||
{
|
||||
$checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.enrolment_visibility')
|
||||
->where('client_policy.policy_type_id', $policy_type )
|
||||
@ -1498,14 +1503,19 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$array->Policy_Terms = $decodedArray;
|
||||
|
||||
$si_value = 0;
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
|
||||
|
||||
$array->type = $policyTypeData->policy_type;
|
||||
$array->Policy_Name = $policyTypeData->long_name;
|
||||
$array->si_value = $si_value;
|
||||
|
||||
|
||||
if($employee_policy){
|
||||
|
||||
if($employee_policy->tpa_id != null){
|
||||
@ -1523,10 +1533,20 @@ class EmployeeRestController extends AdminController
|
||||
$self['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
$array->mapped_family_floaters = $self;
|
||||
|
||||
if($array->enrolment_visibility == 1)
|
||||
|
||||
if (isset($login_by_hr) && $login_by_hr == true)
|
||||
{
|
||||
return $array;
|
||||
else
|
||||
return false;
|
||||
}else{
|
||||
|
||||
if($array->enrolment_visibility == 1)
|
||||
return $array;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user