CHANGE_ getEmployeePolicy API : GWM
This commit is contained in:
parent
ebe3ffb919
commit
9e1505e431
@ -1017,13 +1017,15 @@ public function getEmployeePolicy()
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
|
||||
// This is an array containing keys to be removed from the terms and conditions array
|
||||
$keysToRemove = ["removable_keys"];
|
||||
// Retrieve employee policy data by passing the employee primary key
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
// dd($empPolicy);
|
||||
|
||||
if ($empPolicy) {
|
||||
@ -1033,6 +1035,7 @@ public function getEmployeePolicy()
|
||||
// Reset employee array
|
||||
$empData = $employeeData;
|
||||
|
||||
|
||||
// Removes specific keys from the decoded array and assigns the result to $refusingData
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||
@ -1048,6 +1051,7 @@ public function getEmployeePolicy()
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
|
||||
$self['is_value_exist'] = true;
|
||||
$self['data']['family_floater_key'] = 'self';
|
||||
$self['data']['employee_id'] = $id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user