From 17e03bde4624d0166a7a84bcc48d65c9bb9356ac Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 30 Apr 2024 09:14:13 +0530 Subject: [PATCH 1/6] CHANGE_ calculatePremium route : GWM --- app/Config/Routes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 744e04a0..34c19b5b 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -269,6 +269,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData"); $routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData"); + + $routes->post("calculatePremium", "EmployeeRestController::calculatePremium"); }); $routes->post("sendEmail", "EmployeeRestController::send_email"); From b4cc2fb2a4eb8515bace7007367f17d33560717c Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 2 May 2024 10:06:54 +0530 Subject: [PATCH 2/6] CHANGE_ in polict list openForEnrolemnt key and added policy_status key where in where condition : GWM --- app/Controllers/EmployeeRestController.php | 10 +++++++--- app/Models/EmployeeModel.php | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 33db711e..c0a77ef6 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1039,6 +1039,7 @@ public function getEmployeePolicy() $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('client_id',$client_id) ->where('is_active', 1 )->where('is_addon_value',0)->findAll(); @@ -1062,6 +1063,7 @@ public function getEmployeePolicy() $array->SlabRates = $getSlabAndGridData['slab_rates']; $array->GridMaster = $getSlabAndGridData['grid_master']; + // Construct value for policy type GPA if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){ @@ -1268,8 +1270,10 @@ public function getAddOnPolicy() $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',0)->findAll(); - $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll(); - // dd($clientPolicy); + $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id')) + ->where('policy_status', 1) + ->findAll(); + if(count($clientPolicy)) { $PolicyData = []; @@ -1286,7 +1290,7 @@ public function getAddOnPolicy() $responce['client_id'] = $array['client_id']; $responce['client_policy_id'] = $array['id']; $responce['is_addon'] = $array['is_addon']; - $responce['open_for_enrollment'] = $array['open_for_enrollment']; + $responce['OpenForEnrollment'] = $array['open_for_enrollment']; $responce['policy_terms'] = $decodedArray; if(count($getSlabAndGridData['slab_rates'])){ diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index fdd19e40..aea640c9 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -135,6 +135,7 @@ class EmployeeModel extends Model ->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 ->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) ->where('employee_polices.employee_id', $id) ->get() ->getResult(); From ca6eb4a872edc5fba0b4449fc75e01f535057599 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 2 May 2024 15:32:10 +0530 Subject: [PATCH 3/6] CHANGE_ Ecard download url added in all policy api : GWM --- app/Controllers/EmployeeRestController.php | 44 +++++++++++++++++----- app/Models/EmployeeModel.php | 2 +- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index c0a77ef6..02ad65bc 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -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); diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index aea640c9..2824f4e1 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -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) From f3d0127e3a9aa0290ef0663d0810ce63cdd9fac8 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Fri, 3 May 2024 10:58:12 +0530 Subject: [PATCH 4/6] CHANGE_ base policy related changes in getAddOnPolicy API : GWM --- app/Controllers/EmployeeRestController.php | 15 +++++++++++---- app/Views/layout/header.php | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 02ad65bc..49bd9a77 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1272,7 +1272,7 @@ public function getAddOnPolicy() try { $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',1)->findAll(); - $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',0)->findAll(); + $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id')) @@ -1327,7 +1327,7 @@ public function getAddOnPolicy() } - if($array['is_addon'] == 3) + if($array['is_addon'] == 3)//dependent add on policy { @@ -1437,14 +1437,21 @@ public function getAddOnPolicy() } //array_push($PolicyData, $responce); - }else if($array['is_addon'] == 2){ + + }else if($array['is_addon'] == 2)//Topup policy + { + $getAddOnType = $this->clientPolicyModel->where('id',$array['base_policy'])->where('policy_status', 1)->get()->getRow(); + $basePolicyAddOnType = $getAddOnType->is_addon; + // if is_addon value is 1 it is GMC if not it is one of the Add On policy + if($basePolicyAddOnType == 1){ $is_addon_value = 0; }else{ $is_addon_value = 1; } $only_si_array = []; $only_si_value = 0; $only_si_premium_value = 0; $only_si_gst_value = 0; - foreach ($GMCEmployeeData as $key => $value) { + $BasePolicyEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',$is_addon_value)->findAll(); + foreach ($BasePolicyEmployeeData as $key => $value) { $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow(); if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; } diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index dc06d7c0..f07176f8 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -607,7 +607,7 @@ $currentUrl = base_url(); $parsedUrl = parse_url($currentUrl); $baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/'; - $redirectUrl = $baseUrl . 'nhanceTicket/staff/login_done?' . http_build_query(['token' => $sessionData]); + $redirectUrl = $baseUrl . 'Ticketing/nhance_login?' . http_build_query(['token' => $sessionData]); ?> From 312f9a50c7e7c6f0d5c529f0c7687f20ce6337fb Mon Sep 17 00:00:00 2001 From: bitbucket Date: Fri, 3 May 2024 14:29:00 +0530 Subject: [PATCH 5/6] CHANGE_ in getCashDepositData API : GWM --- app/Controllers/EmployeeRestController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 49bd9a77..182a0151 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1589,6 +1589,7 @@ public function getCashDepositData() $ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name') ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->where('client_policy.is_active', 1 ) ->groupBy('client_policy.insurer_id') ->findAll(); $result = []; @@ -1604,13 +1605,15 @@ public function getCashDepositData() $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,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon') + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon') ->join('policies', 'client_policy.policy_id = policies.id', 'left') ->where('client_policy.insurer_id', $value['insurerId'] ) ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->where('client_policy.is_active', 1 ) ->findAll(); foreach ($ClientPolicyData as $key => $value) { + echo $value['client_policy_id']; $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']); if($value['is_addon'] == "2"){ $value['type'] = 'SI TopUp'; }else if($value['is_addon'] == "3"){ $value['type'] = 'Dependent AddOn'; }else{ $value['type'] = $getSlabAndGridData['grid_master']['policy_type']; } $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0); From afabd468887c8f8fbc55027aa3db2e3a72b43e92 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Fri, 3 May 2024 15:40:05 +0530 Subject: [PATCH 6/6] CHANGE_ in getVerifiedUserData API : GWM --- app/Controllers/RestAuthenticationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 0bd7edc6..3af70fc4 100644 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -96,7 +96,7 @@ class RestAuthenticationController extends AdminController $mobile_number = $this->request->getJSON()->mobile_number; $otp = $this->request->getJSON()->otp; - $employeeData = $this->employeeModel->where('mobile', $mobile_number)->first(); + $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) { $auth = HttpRequestHelper::getRequestInfo(); if ($auth) {