CHANGE_ Ecard download url added in all policy api : GWM

This commit is contained in:
bitbucket 2024-05-02 15:32:10 +05:30
parent b4cc2fb2a4
commit ca6eb4a872
2 changed files with 35 additions and 11 deletions

View File

@ -1029,7 +1029,7 @@ class EmployeeRestController extends AdminController
public function getEmployeePolicy()
{
try {
// try {
$id = $this->request->getGet('id');
$emp_code = $this->request->getGet('emp_code');
@ -1043,7 +1043,7 @@ public function getEmployeePolicy()
// Retrieve employee and dependents data by passing the employee code
$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) {
@ -1063,13 +1063,17 @@ public function getEmployeePolicy()
$array->SlabRates = $getSlabAndGridData['slab_rates'];
$array->GridMaster = $getSlabAndGridData['grid_master'];
if($array->tpa_id != null){
$array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
}else{ $array->eCardDownload = null; }
// Construct value for policy type GPA
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
// 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;
@ -1177,15 +1181,16 @@ public function getEmployeePolicy()
// $result[] = $array;
}
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
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);
// }
}
public function FloterConvertion($array){
@ -1273,7 +1278,7 @@ public function getAddOnPolicy()
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
->where('policy_status', 1)
->findAll();
// dd( $clientPolicy);
if(count($clientPolicy))
{
$PolicyData = [];
@ -1292,6 +1297,25 @@ public function getAddOnPolicy()
$responce['is_addon'] = $array['is_addon'];
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
$tpaArray = $this->employeeModel->select('employees.name as name , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string')
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employees.emp_code',$this->request->getGet('emp_code'))
->where('employees.is_active',1)
->where('employee_polices.client_policy_id',$array['id'])
->get()
->getResult();
if(count($tpaArray))
{
if($tpaArray[0]->tpa_id != null)
$responce['eCardDownload'] = base_url('download-e-card/') . $tpaArray[0]->rand_string;
else
$responce['eCardDownload'] = null;
}else{
$responce['eCardDownload'] = null;
}
if(count($getSlabAndGridData['slab_rates'])){
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1)
@ -1456,7 +1480,7 @@ public function getAddOnPolicy()
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);

View File

@ -132,7 +132,7 @@ class EmployeeModel extends Model
{
return $this->db->table('employee_polices')
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('policies', 'policies.id = client_policy.policy_id')
->where('client_policy.policy_status', 1)