GWM : relationship tracking functionality in getEmployeePolicy API
This commit is contained in:
parent
e5a4f978d2
commit
c2958edcda
@ -1245,6 +1245,8 @@ class EmployeeRestController extends AdminController
|
||||
}else if($array->policy_type_id == 2 && $this->request->getGet('policy') == 'GMC' )
|
||||
{
|
||||
|
||||
$array->to_be_added_relationship = [];
|
||||
$array->existing_relationship = [];
|
||||
|
||||
|
||||
// Map family floaters that already exist in the employee table
|
||||
@ -1299,6 +1301,8 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
$temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
|
||||
array_push($array->existing_relationship,$temp['data']['relationship']);
|
||||
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
@ -1357,9 +1361,52 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
array_push($data,$temp2);
|
||||
|
||||
array_push($array->to_be_added_relationship,$temp2['data']['relationship']);
|
||||
$array->to_be_added_relationship = array_unique($array->to_be_added_relationship);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$array->relationship = [];
|
||||
foreach ($array->to_be_added_relationship as $value) {
|
||||
if($value == 'Spouse'){
|
||||
array_push($array->relationship,'Spouse');
|
||||
}else if($value == 'Child'){
|
||||
array_push($array->relationship, 'Son');
|
||||
array_push($array->relationship, 'Daughter');
|
||||
}else if($value == 'Parent'){
|
||||
$Father = array_search('Father',$array->existing_relationship);
|
||||
$Mother = array_search('Mother',$array->existing_relationship);
|
||||
if ($Father === false && $Mother === false) {
|
||||
array_push($array->relationship, 'Father');
|
||||
array_push($array->relationship, 'Mother');
|
||||
}else if ($Father !== false && $Mother === false) {
|
||||
array_push($array->relationship, 'Mother');
|
||||
} else if ($Mother !== false && $Father === false) {
|
||||
array_push($array->relationship, 'Father');
|
||||
}
|
||||
}else if($value == 'Parent in law'){
|
||||
$FatherinLaw = array_search('Father in Law',$array->existing_relationship);
|
||||
$MotherinLaw = array_search('Mother in Law',$array->existing_relationship);
|
||||
if ($FatherinLaw === false && $MotherinLaw === false) {
|
||||
array_push($array->relationship, 'Father in Law');
|
||||
array_push($array->relationship, 'Mother in Law');
|
||||
}else if ($FatherinLaw !== false && $MotherinLaw === false) {
|
||||
array_push($array->relationship, 'Mother in Law');
|
||||
} else if ($MotherinLaw !== false && $FatherinLaw === false) {
|
||||
array_push($array->relationship, 'Father in Law');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($array->existing_relationship);
|
||||
// print_r($array->to_be_added_relationship);
|
||||
// print_r($array->relationship);
|
||||
// die;
|
||||
|
||||
|
||||
$array->mapped_family_floaters = $data;
|
||||
$array->type = "GMC";
|
||||
$array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
|
||||
@ -1420,6 +1467,8 @@ class EmployeeRestController extends AdminController
|
||||
// return $employeeData;
|
||||
foreach ($GmcParrentsPolicy as $key => $array) {
|
||||
|
||||
$array->to_be_added_relationship = [];
|
||||
$array->existing_relationship = [];
|
||||
|
||||
|
||||
// Reset employee array
|
||||
@ -1511,6 +1560,7 @@ class EmployeeRestController extends AdminController
|
||||
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
$temp['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue);
|
||||
|
||||
array_push($array->existing_relationship,$temp['data']['relationship']);
|
||||
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
@ -1564,6 +1614,41 @@ class EmployeeRestController extends AdminController
|
||||
$temp2['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue);
|
||||
array_push($data,$temp2);
|
||||
|
||||
array_push($array->to_be_added_relationship,$temp2['data']['relationship']);
|
||||
$array->to_be_added_relationship = array_unique($array->to_be_added_relationship);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$array->relationship = [];
|
||||
foreach ($array->to_be_added_relationship as $value) {
|
||||
if($value == 'Spouse'){
|
||||
array_push($array->relationship,'Spouse');
|
||||
}else if($value == 'Child'){
|
||||
array_push($array->relationship, 'Son');
|
||||
array_push($array->relationship, 'Daughter');
|
||||
}else if($value == 'Parent'){
|
||||
$Father = array_search('Father',$array->existing_relationship);
|
||||
$Mother = array_search('Mother',$array->existing_relationship);
|
||||
if ($Father === false && $Mother === false) {
|
||||
array_push($array->relationship, 'Father');
|
||||
array_push($array->relationship, 'Mother');
|
||||
}else if ($Father !== false && $Mother === false) {
|
||||
array_push($array->relationship, 'Mother');
|
||||
} else if ($Mother !== false && $Father === false) {
|
||||
array_push($array->relationship, 'Father');
|
||||
}
|
||||
}else if($value == 'Parent in law'){
|
||||
$FatherinLaw = array_search('Father in Law',$array->existing_relationship);
|
||||
$MotherinLaw = array_search('Mother in Law',$array->existing_relationship);
|
||||
if ($FatherinLaw === false && $MotherinLaw === false) {
|
||||
array_push($array->relationship, 'Father in Law');
|
||||
array_push($array->relationship, 'Mother in Law');
|
||||
}else if ($FatherinLaw !== false && $MotherinLaw === false) {
|
||||
array_push($array->relationship, 'Mother in Law');
|
||||
} else if ($MotherinLaw !== false && $FatherinLaw === false) {
|
||||
array_push($array->relationship, 'Father in Law');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2012,6 +2097,10 @@ class EmployeeRestController extends AdminController
|
||||
$siArray = $this->getSiMappedArray($array['id'],$array['base_policy']);
|
||||
$responce['SlabRates'] = is_array($siArray) ? $siArray : $responce['SlabRates'];
|
||||
|
||||
|
||||
$array['to_be_added_relationship'] = [];
|
||||
$array['existing_relationship'] = [];
|
||||
|
||||
|
||||
// Map family floaters that already exist in the employee table
|
||||
$familyFloates = $policy_terms->family_floaters;
|
||||
@ -2050,7 +2139,9 @@ class EmployeeRestController extends AdminController
|
||||
$temp['data']['form_type'] = $dependent;
|
||||
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
$temp['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
$temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
$temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
|
||||
array_push($array['existing_relationship'],$temp['data']['relationship']);
|
||||
|
||||
array_push($data,$temp);
|
||||
unset($addOnEmployeeData[$key]);
|
||||
@ -2111,8 +2202,44 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
array_push($data,$temp2);
|
||||
|
||||
array_push($array['to_be_added_relationship'],$temp2['data']['relationship']);
|
||||
$array['to_be_added_relationship'] = array_unique($array['to_be_added_relationship']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$array['relationship'] = [];
|
||||
foreach ($array['to_be_added_relationship'] as $value) {
|
||||
if($value == 'Spouse'){
|
||||
array_push($array['relationship'],'Spouse');
|
||||
}else if($value == 'Child'){
|
||||
array_push($array['relationship'], 'Son');
|
||||
array_push($array['relationship'], 'Daughter');
|
||||
}else if($value == 'Parent'){
|
||||
$Father = array_search('Father',$array['existing_relationship']);
|
||||
$Mother = array_search('Mother',$array['existing_relationship']);
|
||||
if ($Father === false && $Mother === false) {
|
||||
array_push($array['relationship'], 'Father');
|
||||
array_push($array['relationship'], 'Mother');
|
||||
}else if ($Father !== false && $Mother === false) {
|
||||
array_push($array['relationship'], 'Mother');
|
||||
} else if ($Mother !== false && $Father === false) {
|
||||
array_push($array['relationship'], 'Father');
|
||||
}
|
||||
}else if($value == 'Parent in law'){
|
||||
$FatherinLaw = array_search('Father in Law',$array['existing_relationship']);
|
||||
$MotherinLaw = array_search('Mother in Law',$array['existing_relationship']);
|
||||
if ($FatherinLaw === false && $MotherinLaw === false) {
|
||||
array_push($array['relationship'], 'Father in Law');
|
||||
array_push($array['relationship'], 'Mother in Law');
|
||||
}else if ($FatherinLaw !== false && $MotherinLaw === false) {
|
||||
array_push($array['relationship'], 'Mother in Law');
|
||||
} else if ($MotherinLaw !== false && $FatherinLaw === false) {
|
||||
array_push($array['relationship'], 'Father in Law');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$responce['family_floaters_of_dependent_and_si_array'] = $data;
|
||||
$responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user