MERGE_LIVE_LIVE_ISSUES

This commit is contained in:
Ubuntu 2025-04-22 18:17:56 +05:30
commit d86cc0ce23
11 changed files with 368 additions and 78 deletions

View File

@ -430,6 +430,8 @@ $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin"); $routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin"); $routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId"); $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
// $routes->post("/employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
//HR login api's //HR login api's
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
@ -440,13 +442,18 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
}); });
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
// $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
// $routes->post("employeeRest/calculatePremium", "EmployeeRestController::calculatePremium");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); // $routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase"); $routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
$routes->post("saveMpin", "RestAuthenticationController::saveMpin"); // $routes->post("updateMpin", "RestAuthenticationController::updateMpin");
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
$routes->post("getChatResponse", "ChatBotController::getChatResponse"); $routes->post("getChatResponse", "ChatBotController::getChatResponse");
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile"); $routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
@ -486,6 +493,9 @@ $routes->post("sendEmail", "EmployeeRestController::send_email");
$routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrolledDetails"); $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrolledDetails");
// Ticketing System //crone job
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
$routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
// Ticketing System End's $routes->get('enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");

View File

@ -201,12 +201,15 @@ class DashboardController extends AdminController
return $this->respond(['status' => 'success']); return $this->respond(['status' => 'success']);
} }
//--------------- FOR CRONE JOB -----------------------------------------------------------------------------------------
public function updatePolicyEnrollmentStatus() public function updatePolicyEnrollmentStatus()
{ {
$clientPolicyModel = new ClientPolicyModel(); $clientPolicyModel = new ClientPolicyModel();
$myLogger = \Config\Services::mylogger(); $myLogger = \Config\Services::mylogger();
$myLogger->logme('error', 'update Policy Enrollment Status Function called');
$myLogger->logme('error', 'OPEN OR CLOSE FOR ENROLLMENT UPDATE START TIME {{ ' . date('d-m-Y H:i:s a') . ' }}');
$client_policy_data = $clientPolicyModel->getPolicyDetailsForEnrollment(); $client_policy_data = $clientPolicyModel->getPolicyDetailsForEnrollment();
$myLogger->logme('error', 'Fetched client policy data for Enrollment Status update'); $myLogger->logme('error', 'Fetched client policy data for Enrollment Status update');
@ -226,17 +229,29 @@ class DashboardController extends AdminController
if ($currentDate == $openDate) { if ($currentDate == $openDate) {
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]); $clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
$openEnrollment[] = $id; $openEnrollment[] = $id;
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.'); // $myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.');
} }
if ($closeDate < $currentDate) { if ($closeDate < $currentDate) {
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]); $clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
$closeEnrollment[] = $id; $closeEnrollment[] = $id;
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to close for enrollment.'); // $myLogger->logme('error', 'Updated policy ID ' . $id . ' to close for enrollment.');
} }
} }
$myLogger->logme('error', 'enrollment_status function completed'); $this->myLogger->logme('info', 'Policy Enrollment Status Update: ' . json_encode([
'status' => true,
'message' => 'Updated Policy Enrollment Status',
'open_policy_count' => count($openEnrollment),
'close_policy_count' => count($closeEnrollment),
'open_policy_ids' => $openEnrollment,
'close_policy_ids' => $closeEnrollment,
], JSON_PRETTY_PRINT));
$myLogger->logme('error', 'update Policy Enrollment Status Function completed');
$myLogger->logme('error', 'OPEN OR CLOSE FOR ENROLLMENT UPDATE END TIME {{ ' . date('d-m-Y H:i:s a') . ' }}');
return $this->respond([ return $this->respond([
'status' => true, 'status' => true,
'message' => 'updated Policy Enrollment Status', 'message' => 'updated Policy Enrollment Status',
@ -253,6 +268,8 @@ class DashboardController extends AdminController
$clientPolicyModel = new ClientPolicyModel(); $clientPolicyModel = new ClientPolicyModel();
$myLogger = \Config\Services::mylogger(); $myLogger = \Config\Services::mylogger();
$myLogger->logme('error', 'SEND REMINDER MAIL FUNCTION START TIME {{ ' . date('d-m-Y H:i:s a') . ' }}');
$client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder(); $client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder();
$myLogger->logme('error', 'Fetched client policy data'); $myLogger->logme('error', 'Fetched client policy data');
@ -262,6 +279,8 @@ class DashboardController extends AdminController
$result = $this->sendRemainderMail($client_policy_data, 'crone'); $result = $this->sendRemainderMail($client_policy_data, 'crone');
$myLogger->logme('error', 'sendCroneRemainderMail function completed'); $myLogger->logme('error', 'sendCroneRemainderMail function completed');
$myLogger->logme('error', 'SEND REMINDER MAIL FUNCTION END TIME {{ ' . date('d-m-Y H:i:s a') . ' }}');
if($result){ if($result){
return json_encode(['status' => true, 'message' => 'Mail send successfully']); return json_encode(['status' => true, 'message' => 'Mail send successfully']);
@ -270,6 +289,9 @@ class DashboardController extends AdminController
} }
} }
//--------------------------------------------------------------------------------------------------------
public function featch_dashboard_data($type) public function featch_dashboard_data($type)
{ {
$pendingActionsController = new PendingActionsController; $pendingActionsController = new PendingActionsController;
@ -308,7 +330,7 @@ class DashboardController extends AdminController
public function sendRemainderMail($client_policy_data, $send_mail_for_manual_or_crone = null) public function sendRemainderMail($client_policy_data, $send_mail_for_manual_or_crone = null)
{ {
// $this->myLogger->logme('error', 'sendRemainderMail function called'); $this->myLogger->logme('error', 'send Remainder Mail function called');
// dd($client_policy_data, $send_mail_for_manual_or_crone); // dd($client_policy_data, $send_mail_for_manual_or_crone);
@ -508,7 +530,7 @@ class DashboardController extends AdminController
} }
} else { } else {
$this->myLogger->logme('error', "SEND REMAINDER CRONE --- Remainder date is empty()"); $this->myLogger->logme('error', "send Remainder crone --- Remainder date is empty()");
} }
} }
@ -519,24 +541,37 @@ class DashboardController extends AdminController
} }
} }
// dd($reminder_whole_mail); // dd($reminder_whole_mail, count($reminder_whole_mail));
// print_rr($reminder_whole_mail); die; // print_rr($reminder_whole_mail); die;
// Process and queue bulk emails // Process and queue bulk emails
if (!empty($reminder_whole_mail) && count($reminder_whole_mail) > 0) { if (!empty($reminder_whole_mail) && count($reminder_whole_mail) > 0) {
$this->myLogger->logme('error', 'Remainder mail count: ' . count($reminder_whole_mail));
$reminder_whole_mail = array_chunk($reminder_whole_mail, 20); $reminder_whole_mail = array_chunk($reminder_whole_mail, 20);
foreach ($reminder_whole_mail as $key => $value) { foreach ($reminder_whole_mail as $key => $value) {
// $job_details = new Jobs(); // $job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]); $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]);
} $this->myLogger->logme('error', 'Bulk mail upload jobs completed successfully. Total: ' . count($value));
} }
if (count($reminder_whole_mail) > 0) { $this->myLogger->logme('error', 'Remainder mails sent successfully');
}else{
$this->myLogger->logme('error', "No reminder mail sent.");
}
$this->myLogger->logme('error', 'send Remainder Mail function completed');
// dd($reminder_whole_mail);
$mailCount = count($reminder_whole_mail);
if ($mailCount > 0) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null) public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null)

View File

@ -105,7 +105,7 @@ class EmployeeController extends AdminController
// Convert the status field to an array if it exists in the request data // Convert the status field to an array if it exists in the request data
if (isset($filterData['status']) && !empty($filterData['status'])) { if (isset($filterData['status']) && !empty($filterData['status'])) {
$filterData['status'] = explode(",", $filterData['status']); // $filterData['status'] = explode(",", $filterData['status']);
}else{ }else{
$filterData['status'] = []; $filterData['status'] = [];
} }

View File

@ -227,6 +227,8 @@ class EmployeeRestController extends AdminController
try { try {
$data = $this->request->getJSON(); $data = $this->request->getJSON();
// dd($data);
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id); $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); } if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
@ -252,7 +254,7 @@ class EmployeeRestController extends AdminController
$item->gender = $this->GenderMap($item->relationship , $item->emp_code); $item->gender = $this->GenderMap($item->relationship , $item->emp_code);
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$item->emp_status = 'draft'; $item->emp_status = 'draft';
// dd($item);
$employee = $this->employeeModel->insert($item); $employee = $this->employeeModel->insert($item);
if ($employee) { if ($employee) {
@ -348,6 +350,7 @@ class EmployeeRestController extends AdminController
$data['status']= 'draft'; $data['status']= 'draft';
$data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id); $data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
// dd($data);
$this->employeePolicyModel->insert($data); $this->employeePolicyModel->insert($data);
} }
@ -513,6 +516,9 @@ class EmployeeRestController extends AdminController
$requestData = $this->request->getJSON(); $requestData = $this->request->getJSON();
// print_r($requestData);
// dd($requestData);
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id); $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id);
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); } if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
@ -524,7 +530,7 @@ class EmployeeRestController extends AdminController
->where('is_active', 1 ) ->where('is_active', 1 )
->findAll(); ->findAll();
// dd($checkIfExist);
if ($checkIfExist) { if ($checkIfExist) {
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si); $empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
@ -2254,7 +2260,7 @@ class EmployeeRestController extends AdminController
// print_r($slab_details);die(); // print_r($slab_details);die();
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']); $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
// kint::dump($existing_famility_details); // kint::dump($existing_famility_decalculatePremiumtails);
//get the Auto SI amount //get the Auto SI amount
$auto_si_data = update_si_with_auto_si($client_id, $client_policy_id, $emp_code, $client_branch_id, $existing_famility_details); $auto_si_data = update_si_with_auto_si($client_id, $client_policy_id, $emp_code, $client_branch_id, $existing_famility_details);
@ -2274,8 +2280,8 @@ class EmployeeRestController extends AdminController
{ {
//get basepolicy id then pull emplist from base policy if only current policy is DA addon policy and emplist is zero //get basepolicy id then pull emplist from base policy if only current policy is DA addon policy and emplist is zero
// echo 'inside'; // echo 'inside';
$client_policy_id = $base_policy; // $client_policy_id = $base_policy;
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']); $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $base_policy,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
} }
$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'];
@ -2292,10 +2298,32 @@ class EmployeeRestController extends AdminController
$transformed_famility_details = transform_db_data_to_excel($family); $transformed_famility_details = transform_db_data_to_excel($family);
$data = calculate_premium_new(family_data: $transformed_famility_details,policy_terms:$policy_terms,slab_details:$slab_details,fileArr: $file,existing_units: $existing_units,default_si : $default_si); $data = calculate_premium_new(family_data: $transformed_famility_details,policy_terms:$policy_terms,slab_details:$slab_details,fileArr: $file,existing_units: $existing_units,default_si : $default_si);
// print_r($data);
$employee_data_group_by_family[$emp_id] = $data; $employee_data_group_by_family[$emp_id] = $data;
foreach ($data as $value) {
$newData = [];
$newData['employee_id'] = $value['temp']['emp_id'];
$newData['client_policy_id'] = $value['policy_details']['client_policy_id'];
$newData['status'] = "draft";
$newData['basic_cover_si'] = $value['policy_details']['basic_cover_si'];
$newData['date_coverage'] = $value['policy_details']['date_coverage'];
$newData['policy_end_date'] = $value['policy_details']['policy_end_date'];
$newData['days'] = $value['policy_details']['days'];
$isExistingEmpAndPolicy = $this->employeePolicyModel->where('employee_id',$value['temp']['emp_id'])->where('client_policy_id',$value['policy_details']['client_policy_id'])->where('is_active', 1)->get()->getRow();
if($isExistingEmpAndPolicy)
{
$this->employeePolicyModel->where('employee_id',$value['temp']['emp_id'])->where('client_policy_id',$value['policy_details']['client_policy_id'])->where('is_active', 1)->set($newData)->update();
}else{
$this->employeePolicyModel->insert($newData);
} }
}
}
// die();
if($clientPolicyId != null && $empCode != null) if($clientPolicyId != null && $empCode != null)
{ // dd ($employee_data_group_by_family); { // dd ($employee_data_group_by_family);
return $employee_data_group_by_family; return $employee_data_group_by_family;

View File

@ -28,6 +28,9 @@ use App\Controllers\JobWorker ;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use Kint\Kint; use Kint\Kint;
use App\Helpers\ExcelSanitizeHelper;
class EmployeeServiceController extends AdminController class EmployeeServiceController extends AdminController
{ {
@ -1656,6 +1659,8 @@ class EmployeeServiceController extends AdminController
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name'])); // $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
// echo 'update emp'; // echo 'update emp';
} }
$value = ExcelSanitizeHelper::sanitizeArrayData($value);
$this->employeeModel->save($value); $this->employeeModel->save($value);
if (isset($value['id'])) { if (isset($value['id'])) {
$emp_id = $value['id']; $emp_id = $value['id'];
@ -2077,6 +2082,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$value['created_by'] = $file['created_by']; $value['created_by'] = $file['created_by'];
$log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK '; $log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
} }
$value = ExcelSanitizeHelper::sanitizeArrayData($value);
$this->employeeModel->save($value); $this->employeeModel->save($value);
if (isset($value['id'])) if (isset($value['id']))

View File

@ -1662,6 +1662,9 @@ class MasterController extends AdminController
} }
public function testZeptoSMTP() { public function testZeptoSMTP() {
echo "Inside the testZeptoSMTP function";
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>'; $message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
$attachments = [ $attachments = [
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
@ -1670,9 +1673,14 @@ class MasterController extends AdminController
]; ];
$email_id = 'srinivas.saravanan@venbainfotech.com'; $email_id = 'srinivas.saravanan@venbainfotech.com';
$common = ['mail_type'=>'test_mail_cli']; $common = ['mail_type'=>'test_mail_cli'];
// Send email and get response $bcc = 'venkateshraman786@gmail.com, srinivassaravanan2002@gmail.com, venkatesh.r@venbainfotech.com';
$result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]); $cc = 'gowtham.manavalan.la@gmail.com, venkatraj.office@gmail.com';
// print_r($bcc);die();
// Send email and get response
$result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message, 'bcc'=>$bcc, 'cc'=>$cc, 'attachments' => $attachments,'common'=>$common]);
print_r($result);
log_message('error',json_encode($result)); log_message('error',json_encode($result));
// Format the response for display/debugging // Format the response for display/debugging

View File

@ -346,6 +346,7 @@ class RestAuthenticationController extends AdminController
$id= $employeeData["id"]; $id= $employeeData["id"];
$updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update(); $updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update();
if($updateMpin){ if($updateMpin){
$this->callThirdPartyAPI($this->request->getJSON(), 'updateEmpMPIN');
$result = ['user_verification' => true , 'message' => "Mpin Updated"]; $result = ['user_verification' => true , 'message' => "Mpin Updated"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{ }else{
@ -355,10 +356,10 @@ class RestAuthenticationController extends AdminController
} else { } else {
$result = ['user_verification' => false , 'message' => "User not found"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
return $this->callThirdPartyAPI($this->request->getJSON(), 'saveMpin');
} }
} catch (\Throwable $th) { } catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
} }
@ -386,6 +387,7 @@ class RestAuthenticationController extends AdminController
$id= $employeeData["id"]; $id= $employeeData["id"];
$updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update(); $updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update();
if($updateMpin){ if($updateMpin){
$this->callThirdPartyAPI($this->request->getJSON(), 'updateEmpMPIN');
$result = ['mpin_verification' => true , 'message' => "Mpin Updated"]; $result = ['mpin_verification' => true , 'message' => "Mpin Updated"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{ }else{
@ -395,8 +397,7 @@ class RestAuthenticationController extends AdminController
} else { } else {
$result = ['mpin_verification' => false , 'message' => "Wrong Mpin"]; return $this->callThirdPartyAPI($this->request->getJSON(), 'updateMpin');
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
} }
} catch (\Throwable $th) { } catch (\Throwable $th) {
@ -412,8 +413,7 @@ class RestAuthenticationController extends AdminController
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null; $email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
$mpin = $this->request->getJSON()->mpin; $mpin = $this->request->getJSON()->mpin;
if (isset($mobile_number)) if (isset($mobile_number)) {
{
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
} else { } else {
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first(); $employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first();
@ -431,7 +431,6 @@ class RestAuthenticationController extends AdminController
]; ];
$authdata = $this->authHistoryModel->insert($data); $authdata = $this->authHistoryModel->insert($data);
} }
$result = JWTToken::encode($employeeData); $result = JWTToken::encode($employeeData);
@ -439,12 +438,19 @@ class RestAuthenticationController extends AdminController
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(), 'verifyMpin'); $apiResponse = $this->callThirdPartyAPI($this->request->getJSON(), 'verifyMpin');
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'post_enrollment' => json_decode($apiResponse, true)], 200); return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'post_enrollment' => json_decode($apiResponse, true)], 200);
} else { } else {
// Call the third-party API function // Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedUserData');
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(), 'verifyMpin');
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "Invalid OTP", 'post_enrollment' => json_decode($apiResponse, true)], 200); return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "Invalid OTP", 'post_enrollment' => json_decode($apiResponse, true)], 200);
//$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'/getVerifiedUserData');
// return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP", 'post_enrollment'=> json_decode($apiResponse, true)],200);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500); return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
return $this->respond(['status' => 'failed', 'code' => 200, 'post_enrollment' => json_decode($apiResponse, true)], 200);
} }
} }
@ -465,7 +471,9 @@ class RestAuthenticationController extends AdminController
return $this->respond(['status' => 'success','code' => 200,'data' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"]],200); return $this->respond(['status' => 'success','code' => 200,'data' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"]],200);
} else { } else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Mpin - not found", 'Mpin' =>null],200); // return $this->respond(['status' => 'failed','code' => 404,'data' => "Mpin - not found", 'Mpin' =>null],200);
return $this->callThirdPartyAPI($this->request->getJSON(), 'checkMpin');
} }
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500); return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);

View File

@ -318,33 +318,34 @@ class MailHelper
'htmlbody' => $message 'htmlbody' => $message
]; ];
// Add CC recipients if provided // Add CC recipients if provided
if (!empty($cc)) { if (!empty($cc)) {
$postData['cc'] = []; $ccList = explode(',', $cc);
// Handle both string and array inputs for CC $ccList = array_map('trim', $ccList);
$ccEmails = is_array($cc) ? $cc : [$cc]; $postData['cc'] = array_map(function ($email) {
foreach ($ccEmails as $ccEmail) { return [
$postData['cc'][] = [
'email_address' => [ 'email_address' => [
'address' => $ccEmail 'address' => $email
] ]
]; ];
} }, $ccList);
} }
// Add BCC recipients if provided
// Add BCC if present
if (!empty($bcc)) { if (!empty($bcc)) {
$postData['bcc'] = []; $bccList = explode(',', $bcc);
// Handle both string and array inputs for BCC $bccList = array_map('trim', $bccList);
$bccEmails = is_array($bcc) ? $bcc : [$bcc]; $postData['bcc'] = array_map(function ($email) {
foreach ($bccEmails as $bccEmail) { return [
$postData['bcc'][] = [
'email_address' => [ 'email_address' => [
'address' => $bccEmail 'address' => $email
] ]
]; ];
}, $bccList);
} }
} //
// Handle attachments // Handle attachments
if (!empty($attachments)) { if (!empty($attachments)) {

View File

@ -112,10 +112,40 @@ class EmployeePolicyModel extends Model
'emp.basic_pay', 'emp.basic_pay',
'emp.band as grade', 'emp.band as grade',
'policy_type.policy_type', 'policy_type.policy_type',
'policy_type.id as policy_type_id',
'client_branch.branch_name as client_branch_name', 'client_branch.branch_name as client_branch_name',
'client_branch.branch_code as client_branch_code', 'client_branch.branch_code as client_branch_code',
'cp.policy_no', 'cp.policy_no',
'cp.policy_type_id',
// Name audit trail
'(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "name" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS name_first_old',
'(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "name" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS name_last_new',
// DOB audit trail
'(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "dob" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS dob_first_old',
'(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "dob" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS dob_last_new',
// Gender audit trail
'(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "gender" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS gender_first_old',
'(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "gender" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS gender_last_new',
'(CASE
WHEN emp.relationship = "Self"
THEN (SELECT COUNT(id) FROM employees WHERE emp_code = emp.emp_code AND is_active = 0 AND emp_status != "truncated")
ELSE NULL
END) AS removed_count',
'(CASE
WHEN emp.relationship != "Self" AND emp.created_at != (
SELECT created_at
FROM employees
WHERE emp_code = emp.emp_code AND relationship = "Self" AND is_active = 1
LIMIT 1
)
THEN "Newly Added"
ELSE NULL
END) AS newly_added',
]) ])
->join('employees emp', 'employee_polices.employee_id = emp.id') ->join('employees emp', 'employee_polices.employee_id = emp.id')
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy ->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
@ -129,6 +159,8 @@ class EmployeePolicyModel extends Model
->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master ->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
->orderBy('emp.emp_code', 'ASC') ->orderBy('emp.emp_code', 'ASC')
->orderBy('employee_polices.employee_id', 'ASC'); ->orderBy('employee_polices.employee_id', 'ASC');
// Conditionally add where clauses // Conditionally add where clauses
if ($client_id != 0 && !empty($client_id)) { if ($client_id != 0 && !empty($client_id)) {
$result->where('emp.client_id', $client_id); $result->where('emp.client_id', $client_id);
@ -188,6 +220,114 @@ class EmployeePolicyModel extends Model
return $res; return $res;
} }
// public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "")
// {
// // dd($status);
// $result = $this->select([
// 'employee_polices.*',
// 'policy_type.policy_type as policy_name',
// 'im.short_name as insurer_short_name',
// 'ib.branch_name as insurer_branch_name',
// 'ib.branch_code as insurer_branch_code',
// 'tpam.name as tpa_name',
// 'tpam.short_name as tpa_short_name',
// 'tpab.branch_code as tpa_branch_code',
// 'cm.client_name',
// 'cm.short_name as client_short_name',
// // 'emp.id as employee_primary_id',
// 'emp.relationship',
// 'emp.relationship_code',
// 'emp.change_event',
// 'emp.emp_code',
// 'emp.name',
// 'emp.email_corporate',
// 'emp.dob',
// 'DATE_FORMAT(emp.dob, "%d/%m/%Y") AS formatted_dob',
// 'emp.gender',
// 'emp.emp_status',
// 'emp.is_active as emp_is_active',
// 'emp.mobile as mobile',
// 'emp.doj',
// 'emp.basic_pay',
// 'emp.band as grade',
// 'policy_type.policy_type',
// 'policy_type.id as policy_type_id',
// 'client_branch.branch_name as client_branch_name',
// 'client_branch.branch_code as client_branch_code',
// 'cp.policy_no',
// ])
// ->join('employees emp', 'employee_polices.employee_id = emp.id')
// ->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
// ->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
// ->join('policy_type', 'policy_type.id = cp.policy_type_id')
// ->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
// ->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch
// ->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
// ->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
// ->join('clients cm', 'cp.client_id = cm.id') //cm - client master
// ->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
// ->orderBy('emp.emp_code', 'ASC')
// ->orderBy('employee_polices.employee_id', 'ASC');
// // Conditionally add where clauses
// if ($client_id != 0 && !empty($client_id)) {
// $result->where('emp.client_id', $client_id);
// }
// if ($branch_id != 0 && !empty($branch_id)) {
// $result->where('emp.client_branch_id', $branch_id);
// }
// if ($policy_id != 0 && !empty($policy_id)) {
// $result->where('employee_polices.client_policy_id', $policy_id);
// }
// if (is_array($status) && count($status) > 0) {
// $result->where('employee_polices.status !=', 'expired');
// if (in_array("active", $status)) {
// $result->where('employee_polices.tpa_id IS NOT NULL');
// $result->where('employee_polices.uhid IS NOT NULL');
// $result->whereIn('employee_polices.status', $status);
// } elseif (in_array("pending", $status)) {
// $result->where('employee_polices.tpa_id IS NULL');
// $result->where('employee_polices.uhid IS NULL');
// $result->whereIn('employee_polices.status', array_merge($status, ['active']));
// } else {
// $result->whereIn('employee_polices.status', $status);
// }
// // if($status == 'active'){
// // $result->where('employee_polices.tpa_id IS NOT NULL');
// // $result->where('employee_polices.uhid IS NOT NULL');
// // }else if($status == 'pending'){
// // $status = 'active';
// // $result->where('employee_polices.status', $status);
// // }else{
// // $result->where('employee_polices.status', $status);
// // }
// }
// if (!empty($emp_code)) {
// $result->where('emp.emp_code', $emp_code);
// }
// if (!empty($emp_name)) {
// $result->like('emp.name', $emp_name);
// }
// // Always check these conditions
// $result->where('employee_polices.is_active', 1)
// ->where('emp.is_active', 1);
// $res = $result->findAll();
// // dd($this->db->getLastQuery());
// return $res;
// }
public function getEmployeePolicyForEcard($policy_id = 0) public function getEmployeePolicyForEcard($policy_id = 0)
{ {
$result = $this->select([ $result = $this->select([

View File

@ -117,6 +117,7 @@
()Pro Rata <br> Premium</th> ()Pro Rata <br> Premium</th>
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">()GST <th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">()GST
</th> </th>
<th class="font-weight-medium">Remarks</th>
<th class="font-weight-medium"> Action </th> <th class="font-weight-medium"> Action </th>
</tr> </tr>
</thead> </thead>
@ -179,6 +180,28 @@
</td> </td>
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?> <td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?>
</td> </td>
<td>
<?php
if(!empty($employee['name_first_old']) ){
echo "<p> Name : " . $employee['name_first_old'] . ' => ' . $employee['name_last_new'] . "</p>";
}
if(!empty($employee['dob_first_old'])){
echo "<p> DOB : " . change_date_format($employee['dob_first_old'], null, 'd/m/Y') . ' => ' . change_date_format($employee['dob_last_new'], null, 'd/m/Y') . "</p>";
}
if(!empty($employee['gender_first_old'])){
echo "<p> Gender : " . $employee['gender_first_old'] . ' => ' . $employee['gender_last_new'] . "</p>";
}
if(!empty($employee['newly_added'])){
echo "<p>" . $employee['newly_added'] . "</p>";
}
if(!empty($employee['removed_count'])){
echo "<p>" . $employee['removed_count'] . " People removed </p>";
}
if(empty($employee['name_first_old']) && empty($employee['dob_first_old']) && empty($employee['gender_first_old']) && empty($employee['removed_count'] ) && empty($employee['newly_added'] )){
echo " - ";
}
?>
</td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">
<a href="javascript: void(0);" <a href="javascript: void(0);"
@ -366,15 +389,46 @@ $(document).ready(function() {
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{ buttons: [
{
extend: 'csv', extend: 'csv',
text: 'CSV', text: 'CSV',
title: 'Member-List', title: 'Member-List',
}, { },
extend: 'excel', {
extend: 'excelHtml5',
text: 'Excel', text: 'Excel',
title: 'Member-List', title: 'Member-List',
}], exportOptions: {
columns: function (idx, data, node) {
return idx < $('#tickets-table thead th').length - 1;
},
format: {
body: function (data, row, column, node) {
// Only apply formatting for column Q (index 16)
if (column === 16) {
return $('<div>').html(data).find('p').map(function () {
return $(this).text().trim();
}).get().join('\n');
}
// Return other columns as-is (text only, no HTML tags)
return $('<div>').html(data).text().trim();
}
}
},
customize: function (xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
// Wrap only column Q
$('row c[r]', sheet).each(function () {
var cell = $(this);
var address = cell.attr('r'); // Example: Q2, Q3
if (address.startsWith('Q')) {
cell.attr('s', '55'); // Wrap text style
}
});
}
}
],
language: { language: {
search: "_INPUT_", search: "_INPUT_",
searchPlaceholder: "Search..." searchPlaceholder: "Search..."

View File

@ -264,7 +264,7 @@
<!-- Unlayer editor --> <!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="member_welcome_mail_editor_container" style="height: 600px;width:max-content"></div> <div id="member_welcome_mail_editor_container" style="height: 600px"></div>
</div> </div>
</div> </div>
@ -360,7 +360,7 @@
<!-- Unlayer editor --> <!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="member_reminder_mail_editor_container" style="height: 600px;width:max-content"></div> <div id="member_reminder_mail_editor_container" style="height: 600px"></div>
</div> </div>
</div> </div>
@ -441,7 +441,7 @@
<!-- Unlayer editor --> <!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="member_ecard_mail_editor_container" style="height: 600px;width:max-content"></div> <div id="member_ecard_mail_editor_container" style="height: 600px"></div>
</div> </div>
</div> </div>
@ -544,7 +544,7 @@
<!-- Unlayer editor --> <!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;width:max-content"></div> <div id="member_review_and_summary_mail_editor_container" style="height: 600px"></div>
</div> </div>
</div> </div>
@ -619,7 +619,7 @@
<!-- Unlayer editor --> <!-- Unlayer editor -->
<!-- <div class="form-row" id="rac_rate_dropdown"> --> <!-- <div class="form-row" id="rac_rate_dropdown"> -->
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="account_maneger_summary_mail_editor_container" style="height: 600px;width:max-content"></div> <div id="account_maneger_summary_mail_editor_container" style="height: 600px"></div>
</div> </div>
<!-- </div> --> <!-- </div> -->
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
@ -705,7 +705,7 @@
<!-- Unlayer editor --> <!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div id="client_hr_summary_mail_editor_container" style="height: 600px;width:max-content"></div> <div id="client_hr_summary_mail_editor_container" style="height: 600px"></div>
</div> </div>
</div> </div>