diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 3ca47517..80babc57 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -49,7 +49,7 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) { $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) { - $routes->match(['get','post'],'view','DashboardController::dashboard'); + $routes->get("view", "DashboardController::dashboard"); $routes->get('get-notification', 'DashboardController::getDashboardNotifications'); $routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1'); $routes->get('get-pending-action', 'PendingActionsController::getPendingActions'); @@ -146,7 +146,6 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) { $routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1"); $routes->get("test-rack-rate", "EmployeeController::testRackRate"); $routes->post("test-rack-rate", "EmployeeController::testRackRate"); - $routes->post("test-dependent", "EmployeeController::testCheckDependentConflict"); }); @@ -272,16 +271,11 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("get_policy_type_for_base_policy/(:any)", "ClientController::getPolicyTypeForBasePolicy/$1"); $routes->get("get_client_details/(:any)", "ClientController::getClientDetails/$1"); $routes->get("featch_dashboard_data/(:any)", "DashboardController::featch_dashboard_data/$1"); - $routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1"); - $routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1"); - $routes->get("send_manual_remainder/(:any)", "DashboardController::sendManualRemainder/$1"); - $routes->get("get_insurer_by_export_templete", "MasterController::getInsurerByExportTemplete"); - $routes->get("copy_insurer_templete/(:any)", "MasterController::copyInsurerTemplete/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); $routes->cli('cli/processjobs', 'JobWorker::processJobs'); -$routes->cli('cli/updatePolicyEnrollmentStatus', 'DashboardController::updatePolicyEnrollmentStatus'); +$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status'); $routes->get("processjob", "JobWorker::processJob"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 9f928ce0..af9c2f07 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1015,6 +1015,17 @@ class EmployeeRestController extends AdminController $self['data']['basic_cover_si'] = $employee_policy->basic_cover_si; $array->mapped_family_floaters = $self; + + + + $res = []; + array_push($res,$array); + $EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id); + if($EDLIPolicy){ array_push($res,$EDLIPolicy); } + $GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id); + if($GTLIPolicy){ array_push($res,$GTLIPolicy); } + return $this->respond(['status' => 'success','code' => 200,'data' => $res ], 200); + // Return result if($this->request->getGet('policy') == 'GPA') @@ -1133,8 +1144,8 @@ class EmployeeRestController extends AdminController $array->mapped_family_floaters = $data; $array->type = "Group Medical Coverage"; - $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, policies.id as PolicyId , client_policy.policy_type_id as policy_type_id, policies.name as Policy_Name , 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') - ->join('policies', 'client_policy.policy_id = policies.id', 'left') + $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , 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') + ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') ->where('client_policy.policy_type_id', 3 ) ->where('client_policy.is_addon', 1 ) ->where('client_policy.client_id', $this->request->getGet('client_id') ) @@ -1328,6 +1339,70 @@ class EmployeeRestController extends AdminController } + + public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id) + { + $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 ) + ->where('client_policy.is_addon', 1 ) + ->where('client_policy.client_id', $client_id ) + ->where('client_policy.client_branch_id', $client_branch_id ) + ->where('client_policy.is_active', 1 ) + ->get() + ->getResult(); + + if($checkPolicyExist){ + + foreach ($checkPolicyExist as $key => $array) { + + $decodedArray = json_decode($array->Policy_Terms); + $array->Policy_Terms = $decodedArray; + + + // 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(); + $policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow(); + $array->type = $policyTypeData->policy_type; + $array->Policy_Name = $policyTypeData->long_name; + if($employee_policy){ + + if($employee_policy->tpa_id != null){ + $array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string; + }else{ $array->eCardDownload = null; } + + $self['is_value_exist'] = true; + $self['data']['family_floater_key'] = 'self'; + $self['data']['employee_id'] = $selfData[0]['id']; + $self['data']['relationship'] = 'Self'; + $self['data']['name'] = $selfData[0]['name']; + $self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']); + $self['data']['mobile'] = $selfData[0]['mobile']; + $self['data']['client_policy_id'] = $array->ClientPolicyId; + $self['data']['basic_cover_si'] = $employee_policy->basic_cover_si; + $array->mapped_family_floaters = $self; + + if($array->enrolment_visibility == 1) + return $array; + else + return false; + + }else{ + return false; + } + + + + } + + } + } + + public function getGTLIPolicy($empData,$emp_code,$client_id,$client_branch_id) + { + + } + public function FloterConvertion($array){ $result = []; @@ -1473,8 +1548,9 @@ class EmployeeRestController extends AdminController } - - $responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name; + $policyTypeData = $this->policyTypeModel->where('id',$array['policy_type_id'])->get()->getRow(); + $responce['policy_name'] = $policyTypeData->long_name; + $responce['type'] = $policyTypeData->policy_type; $responce['SlabRates'] = $uniqueData; $responce['GridMaster'] = $getSlabAndGridData['grid_master']; $responce['client_id'] = $array['client_id']; @@ -1934,8 +2010,8 @@ class EmployeeRestController extends AdminController $data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0; $data['policyDetails'] = []; - $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id , client_policy.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ') - ->join('policies', 'client_policy.policy_id = policies.id', 'left') + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, 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 ') + ->where('client_policy.insurer_id', $value['insurerId'] ) ->where('client_policy.client_id', $this->request->getGet('client_id') ) ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) @@ -1945,8 +2021,9 @@ class EmployeeRestController extends AdminController // dd( $ClientPolicyData); foreach ($ClientPolicyData as $key => $value) { - - $value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type; + $policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow(); + $value['type'] = $policyTypeData->policy_type; + $value['policy_name'] = $policyTypeData->long_name; $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id')); $enrolledCount = 0; $draftCount = 0; diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index e0e29c14..e64a4d63 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -149,9 +149,9 @@ 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 , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables + ->select(' policy_type.long_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') + ->join('policy_type', 'policy_type.id = client_policy.policy_type_id') ->where('client_policy.policy_status', 1) ->where('employee_polices.employee_id', $id) ->get()