Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-05-04 16:41:30 +05:30
commit 4bdf7b9eeb
5 changed files with 61 additions and 20 deletions

View File

@ -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");

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');
@ -1039,10 +1039,11 @@ 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();
// dd($empPolicy);
if ($empPolicy) {
@ -1062,12 +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;
@ -1175,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){
@ -1265,11 +1272,13 @@ 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'))->findAll();
// dd($clientPolicy);
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
->where('policy_status', 1)
->findAll();
// dd( $clientPolicy);
if(count($clientPolicy))
{
$PolicyData = [];
@ -1286,8 +1295,27 @@ 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;
$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)
@ -1299,7 +1327,7 @@ public function getAddOnPolicy()
}
if($array['is_addon'] == 3)
if($array['is_addon'] == 3)//dependent add on policy
{
@ -1409,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; }
@ -1452,7 +1487,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);
@ -1554,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 = [];
@ -1569,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);

View File

@ -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) {

View File

@ -132,9 +132,10 @@ 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)
->where('employee_polices.employee_id', $id)
->get()
->getResult();

View File

@ -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]);
?>
<a href="<?php echo $redirectUrl; ?>" target="_blank">
<i class="mdi mdi-lifebuoy"></i>