MERGE_TEST_ENROLLMENT_ISSUES

This commit is contained in:
Venba 2024-07-11 09:15:46 +00:00
commit 1e2ee0ed2e
10 changed files with 153 additions and 38 deletions

View File

@ -271,6 +271,7 @@ $routes->get("processjob", "JobWorker::processJob");
//Employee login api's
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
//HR login api's
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
@ -282,10 +283,11 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");

View File

@ -1288,20 +1288,16 @@ class ClientController extends AdminController
$insurer_id = $client_policy_data['insurer_id'];
$client_id = $client_policy_data['client_id'];
$base_policy_policy_type_id = 0;
if($client_policy_data['base_policy'] != null){
$base_policy_policy_type_id = $this->clientPolicyModel->select('policy_type_id')->where(['id' => $client_policy_data['base_policy'], 'is_active' => 1])->first();
}
$polices = $this->policesModel
->select('policies.*, policy_type.policy_type')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where(['policies.insurer_id' => $insurer_id, 'policies.is_active' => 1])
->findAll();
$client_policy_list = $this->clientPolicyModel->getpolicyWithPattern( $client_id );
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll();
return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, 'cd_data' => $cd_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices, 'base_policy_type_id' => $base_policy_policy_type_id['policy_type_id']], 200);
return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, 'cd_data' => $cd_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
}

View File

@ -674,14 +674,14 @@ class EmployeeController extends AdminController
// client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB
public function initiateManualEmployeesOnboardProcess($client_policy_id)
{
$client_data = $this->clientPolicyModel->select('clients.client_name as client_name, policies.name as policy_name')
$client_data = $this->clientPolicyModel->select('clients.client_name as client_name, policies.name as policy_name,client_branch_id')
->join('clients', 'clients.id = client_policy.client_id')
->join('policies', 'policies.id = client_policy.policy_id')
->where('client_policy.id', $client_policy_id)
->first();
$empServiceController = new EmployeeServiceController();
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id]);
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
// dd($res);
$count = count($res);
@ -916,7 +916,7 @@ class EmployeeController extends AdminController
try {
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name')
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('employees', 'employees.id = employee_polices.employee_id')
->join('tpa', 'tpa.id = client_policy.tpa_id')
@ -940,10 +940,10 @@ class EmployeeController extends AdminController
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
if($people == 0){
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code);
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code,$client_id);
}
// dd($data);

View File

@ -1753,10 +1753,10 @@ public function getAddOnPolicy()
public function iAgreeForAddOn()
{
$postData = json_decode($this->request->getBody(), true);
$client_policy_id = $postData['client_policy_id'];
// Alternatively, you can use echo to see the type
$emp_code = $postData['emp_code'];
$client_id = $postData['client_id'];
@ -1765,7 +1765,7 @@ public function iAgreeForAddOn()
->where('is_active', 1 )
->set(array('emp_status'=>'enrolled'))
->update();
if (!is_null($client_policy_id) && is_array($client_policy_id))
{
$array_list = [];
@ -1776,9 +1776,10 @@ public function iAgreeForAddOn()
->set(array('status'=>'enrolled'))
->update();
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
$array_list[] = $find;
if(count($find) > 0){
$array_list[] = $find;
}
}
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();

View File

@ -1206,7 +1206,7 @@ class EmployeeServiceController extends AdminController
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid()];
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
// dd($this->employeeModel->getLastQuery());
// Kint::dump($existing_famility_details);die();
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');

View File

@ -212,5 +212,104 @@ class RestAuthenticationController extends AdminController
}
public function saveMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$mpin = $this->request->getJSON()->mpin;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
if ($employeeData) {
$id= $employeeData["id"];
$updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update();
if($updateMpin){
$result = ['user_verification' => true , 'message' => "Mpin Updated"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{
$result = ['user_verification' => true , 'message' => "Mpin Not Updated"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
} else {
$result = ['user_verification' => false , 'message' => "User not found"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
} catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
}
public function updateMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$old_mpin = $this->request->getJSON()->old_mpin;
$mpin = $this->request->getJSON()->new_mpin;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('mpin', $old_mpin)->where('relationship', 'self')->first();
if ($employeeData) {
$id= $employeeData["id"];
$updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update();
if($updateMpin){
$result = ['mpin_verification' => true , 'message' => "Mpin Updated"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{
$result = ['mpin_verification' => true , 'message' => "Mpin Not Updated"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
} else {
$result = ['mpin_verification' => false , 'message' => "Wrong Mpin"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
} catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
}
public function verifyMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$mpin = $this->request->getJSON()->mpin;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
if ($employeeData && $mpin == $employeeData["mpin"]) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
'user_id' => $employeeData['id'],
'user_type' => 'employee',
'ip' => $auth['ip'],
'platform' => $auth['platform'],
'broswer' => $auth['browser'],
];
$authdata= $this->authHistoryModel->insert($data);
}
$result = JWTToken::encode($employeeData);
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
}
}
}

View File

@ -158,8 +158,11 @@ class sendMailNotification
$addtional_premium = 0;
$gst = 0;
foreach ($array_list as $item) {
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
if(count($item) != 0){
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data ='';
$policy_name ='';
$is_addon ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
@ -175,10 +178,11 @@ class sendMailNotification
$gst = $inner_item['gst'] + $gst;
}
}
// echo $policy_name;die;
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
$table_content .= $temp_data;
$table_content .= '</tbody></table></div>';
$Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@ -193,6 +197,8 @@ class sendMailNotification
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
@ -220,11 +226,11 @@ class sendMailNotification
$client_id = $params['client_id'];
$clientModel = new ClientModel();
$notificationModel = new NotificationModel();
$clientRMModel =new ClientRMModel();
$client_data =$clientModel->where('id', $client_id)->first();
$notificationModel = new NotificationModel();
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
$clientRMModel =new ClientRMModel();
if ($notification_data['enabled'] == 1) {
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
@ -236,6 +242,7 @@ class sendMailNotification
$user_list[]=$user_data;
}
}
// print_r($client_rm_data);die;
@ -262,8 +269,11 @@ class sendMailNotification
$array_list = $params['array_list'];
foreach ($array_list as $item) {
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
if(count($item) != 0){
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data ='';
$policy_name ='';
$is_addon ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
@ -278,7 +288,7 @@ class sendMailNotification
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
$table_content .= $temp_data;
$table_content .= '</tbody></table></div>';
$Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@ -293,6 +303,8 @@ class sendMailNotification
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
@ -308,14 +320,17 @@ class sendMailNotification
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
$account_manager_mail_list = [];
foreach ($user_list as $key => $value) {
$full_name = $value['first_name'] .' ' .$value['last_name'];
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
// print_r($user_list);die;
if(isset($user_list)){
foreach ($user_list as $key => $value) {
$full_name = $value['first_name'] .' ' .$value['last_name'];
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content];
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content];
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
}
return $wholeData;
}
return $wholeData;
}
} else if($action == 'client_hr_summary_mail'){
@ -380,7 +395,7 @@ class sendMailNotification
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
$table_content .= $temp_data;
$table_content .= '</tbody></table></div>';
$Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@ -413,7 +428,7 @@ class sendMailNotification
$hr_mails = $client_data['hr_mails'];
$mail_array = explode(',', $hr_mails);
$mail_array = array_map('trim', $mail_array);
$wholeData = [];
foreach ($mail_array as $key => $value) {
$wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content];
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];

View File

@ -40,7 +40,8 @@ class EmployeeModel extends Model
"is_createdby_hr",
"client_branch_id",
"token_time_out",
"emp_type"
"emp_type",
"mpin"
];
// Callbacks

View File

@ -814,7 +814,7 @@ class EmployeePolicyModel extends Model
->get()->getResultArray();
}
public function getECardDataUsingMd5($client_policy_id, $emp_code){
public function getECardDataUsingMd5($client_policy_id, $emp_code,$client_id){
$result = $this->db->table('employees e')
->select('e.id,
@ -829,7 +829,7 @@ class EmployeePolicyModel extends Model
e.doj,
e.band,
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ') AS self,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
ep.tpa_id,
@ -881,7 +881,7 @@ class EmployeePolicyModel extends Model
}
public function getECardSingleData($rand_string, $emp_code){
public function getECardSingleData($rand_string, $emp_code,$client_id){
$result = $this->db->table('employees e')
->select('e.id,
@ -896,7 +896,7 @@ class EmployeePolicyModel extends Model
e.doj,
e.band,
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ') AS self,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
ep.tpa_id,

View File

@ -22,6 +22,7 @@ class LevelContactModel extends Model
"updated_by",
"otp",
"is_active",
"token_time_out"
];
}