Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ec2b86c847
@ -454,6 +454,8 @@ $routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin")
|
|||||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||||
$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||||
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
||||||
|
$routes->post("employeeRest/updateMobileNumber", "RestAuthenticationController::updateMobileNumber");
|
||||||
|
|
||||||
|
|
||||||
// $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
|
// $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
|
||||||
// $routes->post("employeeRest/calculatePremium", "EmployeeRestController::calculatePremium");
|
// $routes->post("employeeRest/calculatePremium", "EmployeeRestController::calculatePremium");
|
||||||
|
|||||||
@ -3426,6 +3426,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
$request = $this->request->getJSON(true);
|
$request = $this->request->getJSON(true);
|
||||||
$mobile_no = $request['mobile_number'] ?? null;
|
$mobile_no = $request['mobile_number'] ?? null;
|
||||||
|
$email_id = $request['email_id'] ?? null;
|
||||||
$client_short_name = $request['client_short_name'] ?? null;
|
$client_short_name = $request['client_short_name'] ?? null;
|
||||||
|
|
||||||
log_message('error', 'STEP 2: Received input - ' . json_encode($request));
|
log_message('error', 'STEP 2: Received input - ' . json_encode($request));
|
||||||
@ -3434,12 +3435,16 @@ class EmployeeRestController extends AdminController
|
|||||||
$clientId = null;
|
$clientId = null;
|
||||||
if (!empty($client_short_name)) {
|
if (!empty($client_short_name)) {
|
||||||
log_message('error', 'STEP 3: Looking up client with short_name: ' . $client_short_name);
|
log_message('error', 'STEP 3: Looking up client with short_name: ' . $client_short_name);
|
||||||
|
|
||||||
$client_data = $this->clientModel
|
$client_data = $this->clientModel
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->where('short_name', $client_short_name)
|
->where('short_name', $client_short_name)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($client_data) {
|
// $sql = "SELECT * FROM clients WHERE is_active = 1 AND short_name = ? LIMIT 1";
|
||||||
|
// $client_data = db_connect()->query($sql, [$client_short_name])->getRowArray();
|
||||||
|
|
||||||
|
if (!empty($client_data)) {
|
||||||
$clientId = $client_data['id'];
|
$clientId = $client_data['id'];
|
||||||
log_message('error', 'STEP 4: Found client ID: ' . $clientId);
|
log_message('error', 'STEP 4: Found client ID: ' . $clientId);
|
||||||
} else {
|
} else {
|
||||||
@ -3450,8 +3455,8 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 5: Validate mobile number
|
// Step 5: Validate mobile number
|
||||||
if (empty($mobile_no)) {
|
if (empty($mobile_no) && empty($email_id)) {
|
||||||
log_message('error', 'STEP 5: Mobile number is empty or null. Returning 0.');
|
log_message('error', 'STEP 5: Mobile number and Email is empty or null. Returning 0.');
|
||||||
return $this->respond(['data' => 0]);
|
return $this->respond(['data' => 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3469,7 +3474,6 @@ class EmployeeRestController extends AdminController
|
|||||||
->where('cp.open_for_enrollment', 1)
|
->where('cp.open_for_enrollment', 1)
|
||||||
->where('cp.policy_status', 1)
|
->where('cp.policy_status', 1)
|
||||||
->whereIn('cp.policy_type_id', [1, 2, 6, 7])
|
->whereIn('cp.policy_type_id', [1, 2, 6, 7])
|
||||||
->where('employees.mobile', $mobile_no)
|
|
||||||
->orderBy('employees.created_at', 'desc')
|
->orderBy('employees.created_at', 'desc')
|
||||||
->groupBy('employee_polices.client_policy_id');
|
->groupBy('employee_polices.client_policy_id');
|
||||||
|
|
||||||
@ -3480,6 +3484,16 @@ class EmployeeRestController extends AdminController
|
|||||||
log_message('error', 'STEP 7: No client ID filter applied.');
|
log_message('error', 'STEP 7: No client ID filter applied.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($mobile_no)) {
|
||||||
|
$builder->where('employees.mobile', $mobile_no);
|
||||||
|
log_message('error', 'STEP 7: Applied mobile_no filter: ' . $mobile_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($email_id)) {
|
||||||
|
$builder->where('employees.email_corporate', $email_id);
|
||||||
|
log_message('error', 'STEP 7: Applied email_id filter: ' . $email_id);
|
||||||
|
}
|
||||||
|
|
||||||
$count = $builder->get()->getNumRows();
|
$count = $builder->get()->getNumRows();
|
||||||
log_message('error', 'STEP 8: Final policy count = ' . $count);
|
log_message('error', 'STEP 8: Final policy count = ' . $count);
|
||||||
|
|
||||||
|
|||||||
@ -1312,4 +1312,125 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------- EMP MOBILE NUMBER UPDATE API'S -------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public function updateMobileNumber()
|
||||||
|
{
|
||||||
|
log_message('error', ' ');
|
||||||
|
log_message('error', ' ************************************* UPDATE MOBILE START **************************************** ');
|
||||||
|
log_message('error', ' ');
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Function called");
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$payload = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
$email_id = $payload['email_id'] ?? null;
|
||||||
|
$new_mobile = $payload['new_mobile_number'] ?? null;
|
||||||
|
|
||||||
|
if (empty($email_id) || empty($new_mobile)) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'failed',
|
||||||
|
'code' => 400,
|
||||||
|
'message' => 'Email ID and new mobile number are required'
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$empdata = RestAuthHelper::getPreAndPostDataByEmailOrMobile(['email_id' => $email_id]);
|
||||||
|
// print_r($empdata); die;
|
||||||
|
|
||||||
|
if(empty($empdata)){
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: No employee data found both PRE & POST");
|
||||||
|
log_message('error', ' ');
|
||||||
|
log_message('error', '************************ PRE END ********************************');
|
||||||
|
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$employeeData = [];
|
||||||
|
if (isset($empdata['pre']) && !empty($empdata['pre'])) {
|
||||||
|
$employeeData = $empdata['pre'];
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Using PRE data");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($employeeData['employee_id']))
|
||||||
|
{
|
||||||
|
// Update mobile number
|
||||||
|
$updated = $this->employeeModel->update($employeeData['employee_id'], [
|
||||||
|
'mobile' => $new_mobile,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($updated) {
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Mobile number updated successfully");
|
||||||
|
log_message('error', ' ');
|
||||||
|
log_message('error', ' ************************************* UPDATE MOBILE END **************************************** ');
|
||||||
|
log_message('error', ' ');
|
||||||
|
|
||||||
|
//If post-enrollment data exist update the same mobile number from pre-enrollment.
|
||||||
|
if (isset($empdata['post']['client_id']) && !empty($empdata['post']['client_id'])) {
|
||||||
|
|
||||||
|
$payload['client_id'] = $empdata['post']['client_id'];
|
||||||
|
$payload['employee_id'] = $empdata['post']['employee_id'];
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Client_id and employee_id from POST data to update the Mobile number");
|
||||||
|
|
||||||
|
$this->callThirdPartyAPI($payload, 'updateMobileNumber');
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Calling callThirdPartyAPI for updateMobileNumber");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'success',
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Mobile number updated successfully',
|
||||||
|
], 200);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Failed to update mobile number");
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'failed',
|
||||||
|
'code' => 500,
|
||||||
|
'message' => 'Failed to update mobile number'
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Employee not found with email in the PRE DATABASE, falling back to third-party API");
|
||||||
|
|
||||||
|
// Call the third-party API function
|
||||||
|
if (!empty($empdata['post']['client_id'])) {
|
||||||
|
$payload->client_id = $empdata['post']['client_id'];
|
||||||
|
}
|
||||||
|
return $this->callThirdPartyAPI($payload, 'updateMobileNumber');
|
||||||
|
log_message('error', ' ');
|
||||||
|
log_message('error', '************************ PRE END ********************************');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Exception: " . $th->getMessage());
|
||||||
|
log_message('error', ' ');
|
||||||
|
log_message('error', ' ************************************* UPDATE MOBILE END **************************************** ');
|
||||||
|
log_message('error', ' ');
|
||||||
|
|
||||||
|
$errorData = [
|
||||||
|
'message' => $th->getMessage(),
|
||||||
|
'file' => $th->getFile(),
|
||||||
|
'line' => $th->getLine(),
|
||||||
|
'code' => $th->getCode(),
|
||||||
|
'trace' => $th->getTraceAsString(),
|
||||||
|
'trace_array' => $th->getTrace(), // full array version (optional)
|
||||||
|
'function' => $th->getTrace()[0]['function'] ?? null,
|
||||||
|
'class' => $th->getTrace()[0]['class'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'failed',
|
||||||
|
'code' => 500,
|
||||||
|
'message' => 'Exception occurred',
|
||||||
|
'error_data' => $errorData
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -256,7 +256,8 @@ class sendMailNotification
|
|||||||
$policy_name = $inner_item['policy_name'];
|
$policy_name = $inner_item['policy_name'];
|
||||||
|
|
||||||
if ($inner_item['relationship'] == 'Self') {
|
if ($inner_item['relationship'] == 'Self') {
|
||||||
$emp_code = '(' . $inner_item['emp_code'] . ')';
|
// $emp_code = '(' . $inner_item['emp_code'] . ')';
|
||||||
|
$emp_code = ' ( Employee Code : ' . $inner_item['emp_code'] . ')';
|
||||||
$mail = $inner_item['email_corporate'];
|
$mail = $inner_item['email_corporate'];
|
||||||
$name = $inner_item['name'];
|
$name = $inner_item['name'];
|
||||||
$employee_mobile_no = $inner_item['mobile'];
|
$employee_mobile_no = $inner_item['mobile'];
|
||||||
@ -549,7 +550,7 @@ class sendMailNotification
|
|||||||
// dd($payable_employee_array, $Addon_list);
|
// dd($payable_employee_array, $Addon_list);
|
||||||
// print_r($table_content); die;
|
// print_r($table_content); die;
|
||||||
|
|
||||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')', $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . $emp_code, $mail_content);
|
||||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
||||||
|
|
||||||
@ -647,7 +648,8 @@ class sendMailNotification
|
|||||||
$policy_name = $inner_item['policy_name'];
|
$policy_name = $inner_item['policy_name'];
|
||||||
|
|
||||||
if ($inner_item['relationship'] == 'Self') {
|
if ($inner_item['relationship'] == 'Self') {
|
||||||
$emp_code = ' (' . $inner_item['emp_code'] . ')';
|
// $emp_code = ' (' . $inner_item['emp_code'] . ')';
|
||||||
|
$emp_code = ' ( Employee Code : ' . $inner_item['emp_code'] . ')';
|
||||||
} else {
|
} else {
|
||||||
$emp_code = '';
|
$emp_code = '';
|
||||||
}
|
}
|
||||||
@ -1406,7 +1408,8 @@ class sendMailNotification
|
|||||||
$policy_name = $array_list['policy_name'];
|
$policy_name = $array_list['policy_name'];
|
||||||
|
|
||||||
if ($array_list['relationship'] == 'Self') {
|
if ($array_list['relationship'] == 'Self') {
|
||||||
$emp_code = ' (' . $array_list['emp_code'] . ')';
|
// $emp_code = ' (' . $array_list['emp_code'] . ')';
|
||||||
|
$emp_code = ' ( Employee Code : ' . $array_list['emp_code'] . ')';
|
||||||
} else {
|
} else {
|
||||||
$emp_code = '';
|
$emp_code = '';
|
||||||
}
|
}
|
||||||
@ -1496,7 +1499,7 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')', $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . $emp_code, $mail_content);
|
||||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
||||||
|
|
||||||
@ -1562,7 +1565,8 @@ class sendMailNotification
|
|||||||
$policy_name = $array_list['policy_name'];
|
$policy_name = $array_list['policy_name'];
|
||||||
|
|
||||||
if ($array_list['relationship'] == 'Self') {
|
if ($array_list['relationship'] == 'Self') {
|
||||||
$emp_code = ' (' . $array_list['emp_code'] . ')';
|
// $emp_code = ' (' . $array_list['emp_code'] . ')';
|
||||||
|
$emp_code = ' ( Employee Code : ' . $array_list['emp_code'] . ')';
|
||||||
} else {
|
} else {
|
||||||
$emp_code = '';
|
$emp_code = '';
|
||||||
}
|
}
|
||||||
@ -1652,7 +1656,7 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')', $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . $emp_code, $mail_content);
|
||||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
||||||
|
|
||||||
|
|
||||||
@ -1809,7 +1813,7 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')', $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . $emp_code, $mail_content);
|
||||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content, $mail_content);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
$value = json_decode($params['notification_data']['mail_content_json']??[],true);
|
||||||
|
$contentWidth = (int)$value['body']['values']['contentWidth']??500;
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
@ -10,7 +15,7 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
.mail-template-header {
|
.mail-template-header {
|
||||||
max-width: 500px;
|
max-width: <?=$contentWidth?>px;
|
||||||
background-color: #ffffff !important;
|
background-color: #ffffff !important;
|
||||||
border-bottom: 1px solid #00999E;
|
border-bottom: 1px solid #00999E;
|
||||||
width: 100%; /* default: allow full width */
|
width: 100%; /* default: allow full width */
|
||||||
@ -26,12 +31,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mail-template-footer {
|
.mail-template-footer {
|
||||||
max-width: 500px;
|
max-width: <?=$contentWidth?>px;
|
||||||
background-color: #ffffff !important;
|
background-color: #ffffff !important;
|
||||||
border-top: 1px solid #00999E;
|
border-top: 1px solid #00999E;
|
||||||
width: 100%; /* default: allow full width */
|
width: 100%; /* default: allow full width */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p{
|
||||||
|
margin:0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* On screens smaller than 600px → force 100% */
|
/* On screens smaller than 600px → force 100% */
|
||||||
@media screen and (max-width: 600px) {
|
@media screen and (max-width: 600px) {
|
||||||
.mail-template-footer {
|
.mail-template-footer {
|
||||||
@ -41,7 +50,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px){
|
||||||
|
|
||||||
|
.header-div{
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-div{
|
||||||
|
width : 100% !important ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.client_logo,
|
||||||
|
.nhance_logo
|
||||||
|
{
|
||||||
|
vertical-align: middle !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -49,15 +73,21 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- header -->
|
<!-- header -->
|
||||||
<div align="center">
|
<div align="center" class="header-div">
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
|
||||||
<tr style="height:90px; background-color: #ffffff !important;">
|
<tr style="height:90px; background-color: #ffffff !important;">
|
||||||
<td align="left" valign="middle" style="padding:20px;" width="50%">
|
<td align="left" class="client_logo" style="padding:5px;" width="50%">
|
||||||
<img src="<?= $client_logo?>"
|
<div style="
|
||||||
alt="Client Logo"
|
width:160px;
|
||||||
style="max-height:80px; max-width: 160px;">
|
height:80px;
|
||||||
|
background-image:url('<?= $client_logo ?>');
|
||||||
|
background-size:contain;
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
">
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td align="right" valign="middle" style="padding:20px;" width="50%">
|
<td align="right" class="nhance_logo" style="padding:5px;" width="50%">
|
||||||
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
|
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
|
||||||
alt="Default Logo"
|
alt="Default Logo"
|
||||||
style="height:auto; max-width: 120px;">
|
style="height:auto; max-width: 120px;">
|
||||||
@ -76,7 +106,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
<div align="center">
|
<div align="center" class="footer-div">
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
|
||||||
<tr style="background-color: #ffffff !important;">
|
<tr style="background-color: #ffffff !important;">
|
||||||
<td align="center" valign="middle" style="padding-top:5px;">
|
<td align="center" valign="middle" style="padding-top:5px;">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user