Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2024-04-12 09:45:01 +05:30
commit 5354c138b1
3 changed files with 48 additions and 23 deletions

View File

@ -235,10 +235,10 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
}); });
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
$routes->get("relationshipList", "EmployeeRestController::relationshipList"); $routes->get("relationshipList", "EmployeeRestController::relationshipList");
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");

View File

@ -72,6 +72,7 @@ class EmployeeRestController extends AdminController
if ($emp_code) { if ($emp_code) {
$relationship = 'self'; $relationship = 'self';
$employee = $this->employeeModel->where('emp_code', $emp_code) $employee = $this->employeeModel->where('emp_code', $emp_code)
->where('is_active', 1 )
->where('relationship', $relationship) ->where('relationship', $relationship)
->first(); ->first();
$result = $employee; $result = $employee;
@ -92,7 +93,7 @@ class EmployeeRestController extends AdminController
$data = $this->request->getJSON(); $data = $this->request->getJSON();
if ($data) { if ($data) {
$id = $data->id; $id = $data->id;
$employee = $this->employeeModel->update($id, $data); $employee = $this->employeeModel->where('is_active', 1 )->update($id, $data);
if ($employee) { if ($employee) {
$result = []; $result = [];
@ -114,7 +115,7 @@ class EmployeeRestController extends AdminController
try { try {
$emp_code = $this->request->getGet('emp_code'); $emp_code = $this->request->getGet('emp_code');
if ($emp_code) { if ($emp_code) {
$employee = $this->employeeModel->where('emp_code', $emp_code)->findAll(); $employee = $this->employeeModel->where('is_active', 1 )->where('emp_code', $emp_code)->findAll();
$dateConverter = function($item) { $dateConverter = function($item) {
if ($item['dob'] !== '0000-00-00') { if ($item['dob'] !== '0000-00-00') {
$dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']); $dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']);
@ -146,7 +147,7 @@ class EmployeeRestController extends AdminController
foreach ($data as $item) { foreach ($data as $item) {
$id = $item->id; $id = $item->id;
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$employee = $this->employeeModel->update($id, (array)$item); $employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
if ($employee) { if ($employee) {
$updatedCount++; $updatedCount++;
} }
@ -180,7 +181,8 @@ class EmployeeRestController extends AdminController
$id = $item->id; $id = $item->id;
$item->family_floater_key = $this->RelationshipMap($item->relationship); $item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$employee = $this->employeeModel->update($id, (array)$item); $item->emp_status = 'Draft';
$employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
if ($employee) { if ($employee) {
$Count++; $Count++;
} }
@ -188,7 +190,8 @@ class EmployeeRestController extends AdminController
//create new data //create new data
$item->family_floater_key = $this->RelationshipMap($item->relationship); $item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$employee = $this->employeeModel->insert($item); $item->emp_status = 'Draft';
$employee = $this->employeeModel->where('is_active', 1 )->insert($item);
if ($employee) { if ($employee) {
if(!isset($item->is_addon_value)) if(!isset($item->is_addon_value))
@ -285,13 +288,17 @@ class EmployeeRestController extends AdminController
if($this->request->getGet('id')) if($this->request->getGet('id'))
{ {
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete(); $this->employeeModel->where('id', $this->request->getGet('id') )
->where('is_active', 1 )
->set(array('is_active'=> 0 ))
->update();
$this->employeePolicyModel->where('employee_id',$this->request->getGet('id') )
->where('is_active', 1 )
->set(array('is_active'=> 0 ))
->update();
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
if ($delete) {
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
}
}else{ }else{
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404); return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
} }
@ -498,6 +505,7 @@ class EmployeeRestController extends AdminController
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id) $checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
->where('client_policy_id', $value->client_policy_id) ->where('client_policy_id', $value->client_policy_id)
->where('is_active', 1 )
->findAll(); ->findAll();
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id); $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
$SlabRatesArray = $getSlabAndGridData['slab_rates']; $SlabRatesArray = $getSlabAndGridData['slab_rates'];
@ -514,6 +522,7 @@ class EmployeeRestController extends AdminController
$data['client_policy_id']= $value->client_policy_id; $data['client_policy_id']= $value->client_policy_id;
$data['basic_cover_si']= $value->basic_cover_si; $data['basic_cover_si']= $value->basic_cover_si;
$data['premium']= $premium; $data['premium']= $premium;
$data['status'] = 'Draft';
$this->employeePolicyModel->insert($data); $this->employeePolicyModel->insert($data);
} }
@ -561,7 +570,7 @@ class EmployeeRestController extends AdminController
$jwt = $this->request->getHeader('Authorization'); $jwt = $this->request->getHeader('Authorization');
$jwtParts = explode(' ', $jwt); $jwtParts = explode(' ', $jwt);
$token = $jwtParts[1]; $token = $jwtParts[2];
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true); $decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
@ -576,8 +585,9 @@ class EmployeeRestController extends AdminController
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first(); $policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first(); $policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
$policy_permium_2 = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first(); $policy_permium_2 = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
$sum_insured_amount_for_check_employee_1 = $policy_permium_1['si'];
$sum_insured_amount_for_check_employee_2 = $policy_permium_2['si']; $sum_insured_amount_for_check_employee_1 = isset($policy_permium_1['si']) ? $policy_permium_1['si'] : null;
$sum_insured_amount_for_check_employee_2 = isset($policy_permium_2['si']) ? $policy_permium_2['si'] : null;
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName(); $filename = $file->getName();
@ -871,7 +881,7 @@ public function getEmployeePolicy()
// Retrieve employee policy data by passing the employee primary key // Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id); $empPolicy = $this->employeeModel->getEmployeePolicy($id);
// Retrieve employee and dependents data by passing the employee code // Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_addon_value',0)->findAll(); $employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
if ($empPolicy) { if ($empPolicy) {
@ -1079,8 +1089,8 @@ public function getAddOnPolicy()
{ {
try { try {
$addOnEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll(); $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll();
$GMCEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll(); $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll();
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll(); $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
@ -1122,7 +1132,7 @@ public function getAddOnPolicy()
if(count($addOnEmployeeData)){ if(count($addOnEmployeeData)){
foreach ($addOnEmployeeData as $key => $value) { foreach ($addOnEmployeeData as $key => $value) {
if ($value['family_floater_key'] === $dependent) { if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow(); $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)){ $dependent_and_si_value = $employee_policy->basic_cover_si; } if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $employee_policy->premium;} if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $employee_policy->premium;}
@ -1153,6 +1163,7 @@ public function getAddOnPolicy()
{ {
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) $GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('is_addon_value',0) ->where('is_addon_value',0)
->where('is_active', 1 )
->where('family_floater_key','parent') ->where('family_floater_key','parent')
->findAll(); ->findAll();
@ -1207,7 +1218,7 @@ public function getAddOnPolicy()
$only_si_premium_value = null; $only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) { foreach ($GMCEmployeeData as $key => $value) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow(); $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; } if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;} if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true; $temp3['is_value_exist'] = true;
@ -1247,6 +1258,20 @@ public function getAddOnPolicy()
public function iAgreeForAddOn() public function iAgreeForAddOn()
{ {
$emp_code = $this->request->getGet('emp_code');
$client_policy_id = $this->request->getGet('client_policy_id');
$client_id = $this->request->getGet('client_id');
$this->employeeModel->where('emp_code', $emp_code )
->where('is_active', 1 )
->set(array('emp_status'=>'Enrolled'))
->update();
$this->employeePolicyModel->where('client_id', $client_id )
->where('client_policy_id', $client_policy_id )
->where('is_active', 1 )
->set(array('status'=>'Enrolled'))
->update();
return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200); return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
} }

View File

@ -97,7 +97,7 @@ class RestAuthenticationController extends AdminController
$otp = $this->request->getJSON()->otp; $otp = $this->request->getJSON()->otp;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first(); $employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
if ($employeeData && $otp == $employeeData["otp"]) { if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
$auth = HttpRequestHelper::getRequestInfo(); $auth = HttpRequestHelper::getRequestInfo();
if ($auth) { if ($auth) {
$data = [ $data = [