MERGE_TEST_MINOR_ITEMS

This commit is contained in:
Ubuntu 2026-01-02 14:09:56 +05:30
commit 7941d34310
14 changed files with 968 additions and 407 deletions

View File

@ -1,27 +1,15 @@
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
# CI_ENVIRONMENT = development
CI_ENVIRONMENT =
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
app.baseURL = 'http://localhost/client_changes/nhance/'
app.appTimezone = 'Asia/Kolkata'
app.baseURL =
app.appTimezone =
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
@ -30,187 +18,93 @@ app.appTimezone = 'Asia/Kolkata'
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
# Dev DB Connection
database.default.hostname = 119.18.54.85
database.default.database = venbaehn_nhance
database.default.username = venbaehn_nhance_user1
database.default.password = 'iM~X7(cR+}A-'
database.default.DBDriver = MySQLi
database.default.DBPrefix =
database.default.port = 3306
database.tests.hostname = 119.18.54.85
database.tests.database = venbaehn_nhance
database.tests.username = venbaehn_nhance_user1
database.tests.password = 'iM~X7(cR+}A-'
database.tests.DBDriver = MySQLi
database.tests.DBPrefix =
database.tests.port = 3306
# Test DB Connection
# database.default.hostname = 119.18.54.85
# database.default.database = venbaehn_nhance_test
# database.default.username = venbaehn_nhance_user1
# database.default.password = 'iM~X7(cR+}A-'
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = 119.18.54.85
# database.tests.database = venbaehn_nhance_test
# database.tests.username = venbaehn_nhance_user1
# database.tests.password = 'iM~X7(cR+}A-'
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
# UAT DB Connection
# database.default.hostname = 119.18.54.85
# database.default.database = venbaehn_nhance_uat
# database.default.username = venbaehn_nhance_user1
# database.default.password = 'iM~X7(cR+}A-'
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = 119.18.54.85
# database.tests.database = venbaehn_nhance_uat
# database.tests.username = venbaehn_nhance_user1
# database.tests.password = 'iM~X7(cR+}A-'
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
# Local PhpMyAdmin DB Connection
# database.default.hostname = localhost
# database.default.database = nhance
# database.default.username = root
# database.default.password = ''
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = localhost
# database.tests.database = nhance
# database.tests.username = root
# database.tests.password = ''
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
#--------------------------------------------------------------------
# CONTENT SECURITY POLICY
#--------------------------------------------------------------------
# contentsecuritypolicy.reportOnly = false
# contentsecuritypolicy.defaultSrc = 'none'
# contentsecuritypolicy.scriptSrc = 'self'
# contentsecuritypolicy.styleSrc = 'self'
# contentsecuritypolicy.imageSrc = 'self'
# contentsecuritypolicy.baseURI = null
# contentsecuritypolicy.childSrc = null
# contentsecuritypolicy.connectSrc = 'self'
# contentsecuritypolicy.fontSrc = null
# contentsecuritypolicy.formAction = null
# contentsecuritypolicy.frameAncestors = null
# contentsecuritypolicy.frameSrc = null
# contentsecuritypolicy.mediaSrc = null
# contentsecuritypolicy.objectSrc = null
# contentsecuritypolicy.pluginTypes = null
# contentsecuritypolicy.reportURI = null
# contentsecuritypolicy.sandbox = false
# contentsecuritypolicy.upgradeInsecureRequests = false
# contentsecuritypolicy.styleNonceTag = '{csp-style-nonce}'
# contentsecuritypolicy.scriptNonceTag = '{csp-script-nonce}'
# contentsecuritypolicy.autoNonce = true
#--------------------------------------------------------------------
# COOKIE
#--------------------------------------------------------------------
# cookie.prefix = ''
# cookie.expires = 0
# cookie.path = '/'
# cookie.domain = ''
# cookie.secure = false
# cookie.httponly = false
# cookie.samesite = 'Lax'
# cookie.raw = false
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
# encryption.key =
# encryption.driver = OpenSSL
# encryption.blockSize = 16
# encryption.digest = SHA512
#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------
# honeypot.hidden = 'true'
# honeypot.label = 'Fill This Field'
# honeypot.name = 'honeypot'
# honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
# honeypot.container = '<div style="display:none">{template}</div>'
#--------------------------------------------------------------------
# SECURITY
#--------------------------------------------------------------------
# security.csrfProtection = 'cookie'
# security.tokenRandomize = false
# security.tokenName = 'csrf_token_name'
# security.headerName = 'X-CSRF-TOKEN'
# security.cookieName = 'csrf_cookie_name'
# security.expires = 7200
# security.regenerate = true
# security.redirect = false
# security.samesite = 'Lax'
DB_SSL_ENABLE =
database.default.hostname =
database.default.database =
database.default.username =
database.default.password =
database.default.DBDriver =
#database.default.DBPrefix =
#database.default.port =
#--------------------------------------------------------------------
# SESSION
#--------------------------------------------------------------------
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
session.cookieName = 'ci_session_dev'
session.expiration = 86400
# session.cookieName = 'ci_session'
#session.expiration = 28800
# session.savePath = null
# session.matchIP = false
session.timeToUpdate = 300
session.regenerateDestroy = true
# session.timeToUpdate = 300
# session.regenerateDestroy = false
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------
# logger.threshold = 4
logger.threshold = 4
#--------------------------------------------------------------------
# CURLRequest
#--------------------------------------------------------------------
# curlrequest.shareOptions = true
GOOGLE_OAUTH_APP_NAME =
#GOOGLE_OAUTH_CLIENT_ID =
#GOOGLE_OAUTH_CLIENT_SECRET =
GOOGLE_OAUTH_CLIENT_ID =
GOOGLE_OAUTH_CLIENT_SECRET =
GOOGLE_OAUTH_REDIRECT_URI =
GOOGLE_OAUTH_SCOPES =
App_Url =
NHANCE_LOGO =
helpdeskURL =
TOKENTIMEOUT =
POST_ENROLLMENT_APP_LINK =
GDRIVE_ROOT_FOLDER_ID =
email.fromEmail =
email.fromName =
ZEPTO_API_KEY =
email.SMTPPass =
#--------------------------------------------------------------------
# Google-OAUTH-Credentials
# SET COOKIE DATA
#--------------------------------------------------------------------
cookie.Path = '/';
cookie.Domain = '.nhanceindia.in'; //Enter Domain Name with preceding .(dot) -> .nhanceindia.in
cookie.secure = 'true';// if https set as true or if http set as false
GOOGLE_OAUTH_APP_NAME = 'OAuth'
GOOGLE_OAUTH_CLIENT_ID = '696241936560-m2mr272ge7vr2n4q36c22l3d2gdgi90l.apps.googleusercontent.com'
GOOGLE_OAUTH_CLIENT_SECRET = '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'
GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/client_changes/nhance/oauth2callback'
GOOGLE_OAUTH_SCOPES = "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile"
unlayer.projectID =
email.enquiryMail =
database.postDB.hostname =
database.postDB.database =
database.postDB.username =
database.postDB.password =
database.postDB.DBDriver =
database.postDB.DBPrefix =
database.postDB.port =
App_Url = https://venbait.in/nhance/app/dev/
POST_ENROLLMENT_APP_LINK = https://venbait.in/nhance/employee/dev/
NHANCE_LOGO = https://venbait.in/nhance/dev/public/assets/images/Nhance_Favi.png
POST_ENROLLMENT_BASEURL =
#SMS
SMS_API_KEY =
SMS_SENDER_ID =
SMS_TEMPLATE_ID =
SMS_SERVICE_NAME =
SMS_APP_NAME =
# CORS Configuration
CORS_ALLOWED_ORIGINS=
CORS_ALLOW_CREDENTIALS=true
CORS_ALLOWED_METHODS=GET,POST,PUT,PATCH,DELETE,OPTIONS
CORS_ALLOWED_HEADERS=Content-Type,Authorization,X-Requested-With,Accept,Origin,App-Signature
CORS_EXPOSE_HEADERS=X-Total-Count,X-Page-Count,X-RateLimit-Remaining
CORS_MAX_AGE=7200
CORS_DEBUG=true
APP_SIGNATURE =

View File

@ -519,6 +519,7 @@ $routes->cli('cli/sendZeptoMail', 'MasterController::testZeptoSMTP');
$routes->cli('cli/check_bounce_mail_cli', 'MasterController::testCheckBounceMails');
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
$routes->cli('cli/check_env', 'MasterController::checkEnv');
//crone job
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
@ -527,8 +528,10 @@ $routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPoli
$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
$routes->cli('cli/insurerRFQRemainder', 'LeadsController::remainderForQcr');
$routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery');
$routes->cli('cli/ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
$routes->cli('cli/syncTpaClaimToNhance','MediAssistApiController::syncTpaClaimToNhance');
$routes->cli('cli/MediAssit-ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
$routes->cli('cli/Vidal-ClaimStatusUpdate','VidalApiController::ClaimStatusUpdate');
$routes->cli('cli/MediAssit-syncTpaClaimToNhance','MediAssistApiController::syncTpaClaimToNhance');
$routes->cli('cli/thzReminderCrone','ThzController::getOpenTicketsOlderThan24HoursAndAssignNextLevel');
@ -756,22 +759,14 @@ $routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBa
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
//Third party Vidal Api Call
$routes->get('fileUpload','VidalApiController::fileUpload');
$routes->post('hospitalNetwork','VidalApiController::hospitalNetwork');
$routes->post('eCardService','VidalApiController::eCardService');
$routes->post('claimStatusCheck','VidalApiController::claimStatusCheck');
$routes->get('newClaim','VidalApiController::SubmitClaim');
$routes->post('enrollment','VidalApiController::enrollment');
$routes->get('fileUploadToVidal','VidalApiController::fileUploadToVidal');
$routes->get('claimStatus','VidalApiController::claimStatus');
//Third party MediAssist Api Call
$routes->get('EcardRequest','MediAssistApiController::EcardRequest');
//Third party - testing route
$routes->get('EcardRequest','VidalApiController::EcardRequest');
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
$routes->get('GetBenefDetails','MediAssistApiController::GetBenefDetails');
$routes->get('ClaimDetail','MediAssistApiController::ClaimDetail');
$routes->get('GetBenefDetails','VidalApiController::GetBenefDetails');
$routes->get('ClaimDetail','VidalApiController::ClaimDetail');
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
@ -779,10 +774,9 @@ $routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
$routes->get('syncTpaClaimToNhance','MediAssistApiController::syncTpaClaimToNhance');
// API service
// API service (Don't delete)
$routes->post("ecardRequest", "ApiServiceController::ecardRequest");
$routes->post("getTPAID", "ApiServiceController::getTPAID");
// $routes->get("getTPAID", "ApiServiceController::getTPAID");
$routes->get('fileDownload','MediAssistApiController::fileDownload');
@ -821,6 +815,7 @@ $routes->group('test', function($routes) {
$routes->get('membervalidation', 'TestingController::membervalidation');
$routes->get('generateExcel', 'TestingController::generateExcel');
$routes->get('logo_renaming','TestingController::logo_renaming');
$routes->get('thzReminderCrone','ThzController::getOpenTicketsOlderThan24HoursAndAssignNextLevel');
// $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInCrossDB');
// $routes->get('createDefaultMailTempalteInSameDB','TestingController::createDefaultMailTempalteInSameDB');
});

View File

@ -119,8 +119,16 @@ class ApiServiceController extends BaseController
{
if($employee_policy[0]['tpa_primary_id'] == $this->medi_assist_primary_key)//Medi assist
{
$mediAssistController = new MediAssistApiController();
$data['eCardDownload'] = $mediAssistController->EcardRequest( $emp_code, $policy_no );
}else if($employee_policy[0]['tpa_primary_id'] == $this->vidal_primary_key)// Vidal
{
$vidalApiController = new VidalApiController;
$data['eCardDownload'] = $vidalApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
}else{
if($type == "download"){
@ -246,6 +254,17 @@ class ApiServiceController extends BaseController
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
}else if ($tpa_id == $this->vidal_primary_key) // Vidal
{
$file_id = $fileModel->insert($data);
log_message('error', "Files table inserted successfully, File id : {$file_id}");
// $vidalApiController = new VidalApiController;
// $vidalApiController->GetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
$r = Jobs::addJob(['job_name' => 'GetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]);
log_message('error', "GetBenefDetails job pushed successfully.");
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
}else{
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]);
}
@ -265,8 +284,15 @@ class ApiServiceController extends BaseController
$tpaID = $data['tpa_id'];
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
$mediAssistController = new MediAssistApiController();
return $mediAssistController->ClaimDetail($claimId);
}else if ($tpaID == $this->vidal_primary_key) { // vidal
$vidalApiController = new VidalApiController;
return $vidalApiController->ClaimDetail($claimId);
}else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
$message = "This TPA has no API service enabled";

View File

@ -2203,6 +2203,9 @@ class EmpDataServiceController extends BaseController
if ($get_policy_type['policy_type_id'] != 1) {
// generate e-card and store S3
$r = Jobs::addJob(['job_name' => 'bulkGenerateEcardAndStoreinS3', 'payload' => ['client_policy_id' => $client_policy_id]]);
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $emp_policy_ids, 'client_policy_id' => $client_policy_id]]);
}
@ -2524,6 +2527,7 @@ class EmpDataServiceController extends BaseController
$event_type = $file['event_type'];
$policy_issue_date = $file['policy_issue_date'];
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
$status_val = 'success';
if ($status == 'in-progress-partially') {
@ -2613,6 +2617,10 @@ class EmpDataServiceController extends BaseController
'status' => $status_val,
]);
if($client_policy_data['policy_type_id'] != 1){
// re-generate e-card and store S3
$r = Jobs::addJob(['job_name' => 'bulkGenerateEcardAndStoreinS3', 'payload' => ['client_policy_id' => $client_policy_id]]);
}
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID employee count : {data}', ['data'=> $emp_count]);
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID batch file status : {data}', ['data'=> $status_val]);

View File

@ -1076,10 +1076,23 @@ class EmployeeController extends AdminController
}
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html, 'file_data' => $file_name, 'excel_data' => $excel_data], 200);
} catch (\Exception $e) {
} catch (\Throwable $th) {
$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,
];
// Handle exception
$errorMessage = 'Error occurred: ' . $e->getMessage();
$errorMessage = 'Error occurred:' . PHP_EOL . json_encode($errorData, JSON_PRETTY_PRINT);
$this->myLogger->logme('error', $errorMessage);
$html = '<div class="text-center">No Data Found</div>';
return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => $html, 'file_data' => $file_name], 500);
}
@ -3310,8 +3323,13 @@ class EmployeeController extends AdminController
->where('employee_polices.wellness_onboard', '0')
->where('emp.emp_status', 'active')
->where('emp.is_active', 1)
->where('cp.wellness_plan_id is not null')
->where('cp.wellness_plan_id is not null',null,false)
->where('cp.wellness_plan_id !=',"")
->where('cp.wellness_plan_id !=',0)
->where('cp.wellness_vendor_id is null')
->where('cp.wellness_vendor_id !=',0)
->where('cp.wellness_vendor_id !=',"")
// ->where('cp.policy_status',1)
// ->where('cp.is_active',1)
->findAll();
@ -4145,6 +4163,8 @@ class EmployeeController extends AdminController
return $this->respond([
'status' => 'ECARD_BULK_TO_S3 Job queued',
'message' => 'E-card re-generation process has started successfully.',
'dataStatus' => true,
'total' => $total,
'batches' => $total_batches
], 200);

View File

@ -41,6 +41,7 @@ use App\Models\RTOModel;
use App\Models\PartnerPosModel;
use CodeIgniter\CLI\CLI;
use CodeIgniter\CLI\BaseCommand;
class MasterController extends AdminController
{
@ -1950,6 +1951,7 @@ class MasterController extends AdminController
$this->checkGoogleOAuthCredentialsinDB();
$this->getCronJobsList();
$this->checkGdriveRootFolderID();
$this->checkEnv();
}
public function checkAndCreateDirectories()
@ -2075,6 +2077,80 @@ class MasterController extends AdminController
dd($result);
}
public function checkEnv()
{
$root = ROOTPATH;
$sample_file_name = '.env.sample';
$sample_file_path = $root . $sample_file_name;
$envFile = $root . '.env';
// echo ($exampleFile);//die();
if (!file_exists($sample_file_path)) {
echo ("$sample_file_path file not found");
exit();
}
if (!file_exists($envFile)) {
echo('.env file not found');
exit();
}
$example = $this->parseEnv($sample_file_path);
$actual = $this->parseEnv($envFile);
$missing = array_diff_key($example, $actual);
$extra = array_diff_key($actual, $example);
CLI::write("#################### CHECKING ENV ##############################\n");
if ($extra) {
CLI::write('⚠️ Extra ENV keys (not in .env.example)', 'yellow');
foreach (array_keys($extra) as $key) {
CLI::write(" - $key", 'yellow');
}
}
CLI::newLine();
if ($missing) {
CLI::error('❌ Missing ENV keys');
foreach (array_keys($missing) as $key) {
CLI::write(" - $key", 'red');
}
}
CLI::newLine();
if (!$missing && !$extra) {
CLI::write('✅ ENV configuration is clean', 'green');
return CLI::EXIT_SUCCESS;
}
CLI::write("#################### END OF CHECKING ENV ############################\n");
}
private function parseEnv(string $file): array
{
$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$env = [];
foreach ($lines as $line) {
$line = trim($line);
if ($line === '' || str_starts_with($line, '#')) {
continue;
}
if (strpos($line, '=') !== false) {
[$key] = explode('=', $line, 2);
$env[trim($key)] = true;
}
}
return $env;
}
//----------------------------------------------------------------------------------------------------------
public function nhanceBranchMaster()

View File

@ -1139,6 +1139,7 @@ class MediAssistApiController extends BaseController
"Payment - Refunded to Insurer" => 14,
"Processed - Processing Payment" => 10,
"Processed - Physical Documents Awaited" => 9,
"Pre-Auth Processed" => 8,
// Extra Mappings (based on your DB list)
"NON ID" => 1,

View File

@ -88,7 +88,7 @@ class NotificationController extends AdminController
{
$checkboxNames = [
'member_welcome_mail_btn',
'common_mail_btn',
'member_common_mail_btn',
'member_reminder_mail_btn',
'member_ecard_mail_btn',
'member_review_and_summary_mail_btn',
@ -232,7 +232,8 @@ class NotificationController extends AdminController
$params = [
'client_data' => $client_data,
'notification_data' => $notification_data,
'test_mail' => $test_mail
'test_mail' => $test_mail,
'test_mail_list' => ""
];
$testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params);
@ -361,7 +362,7 @@ class NotificationController extends AdminController
// Define upload path and attempt file upload
$uploadFilePath = WRITEPATH . 'uploads/attachments';
$uploadedFile = $this->request->getFile('file');
$fileName = file_Upload($uploadedFile, $uploadFilePath); // Assume file_Upload handles file saving
$fileName = file_Upload_for_lead($uploadedFile, $uploadFilePath); // Assume file_Upload handles file saving
if ($fileName) {
// Prepare data for insertion

View File

@ -101,6 +101,7 @@ class RestAuthenticationController extends AdminController
->where('employees.mobile', $mobile_number)
->where('EP.is_active', 1)
->whereIn('EP.status', ['active', 'expired'])
->orderBy('employees.id', 'desc')
->first();
$lastQuery = $this->employeeModel->db->getLastQuery();
@ -122,7 +123,7 @@ class RestAuthenticationController extends AdminController
AND employees.relationship = 'self'
AND employees.is_active = 1
AND employee_polices.is_active = 1
AND employee_polices.status IN ('active')
AND employee_polices.status IN ('active', 'expired')
";
$db = db_connect();
@ -166,7 +167,7 @@ class RestAuthenticationController extends AdminController
log_message('error', ' ');
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
return $this->respond(['status' => 'failed','code' => 500,'data' => $th->getMessage()],500);
}
}

View File

@ -5,6 +5,8 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Helpers\MailHelper;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
use App\Models\ThzMasterModel;
use App\Models\ThzMasterNotesModel;
@ -20,6 +22,7 @@ use App\Models\ClientRMModel;
class ThzController extends BaseController
{
use ResponseTrait;
protected $thzMasterModel;
protected $thzMasterNotesModel;
@ -75,6 +78,9 @@ class ThzController extends BaseController
} else {
$text = "create";
if(!isset($data['assign_to'])){
$data['assign_to'] = $this->getAcmIdUsingClientId($data['client_id'] ?? null);
}
$insertID = $this->insertTicket($data);
$result = true;
$references = "";
@ -664,6 +670,167 @@ class ThzController extends BaseController
return $old['status'] . " - " . $data['status'];
}
private function getAcmIdUsingClientId($client_id)
{
if(!empty($client_id)){
$acm_data = $this->cientRmModel->where('is_active', 1)->where('level', 3)->where('client_id', $client_id)->orderBy('id', 'asc')->first();
if($acm_data){
return $acm_data['user_id'];
}
$this->myLogger->logme('error', 'Account Manager data not found');
return null;
}
$this->myLogger->logme('error', 'client id is null');
return null;
}
private function getRmsIdUsingClientId($client_id)
{
if(!empty($client_id)){
$acm_data = $this->cientRmModel
->select('client_rm.*, user_profiles.email')
->join('user_profiles', 'client_rm.user_id = user_profiles.id')
->where('client_rm.is_active', 1)
->where('client_rm.client_id', $client_id)
->orderBy('id', 'asc')
->findAll();
if($acm_data){
return $acm_data;
}
$this->myLogger->logme('error', 'Account Manager data not found');
return [];
}
$this->myLogger->logme('error', 'client id is null');
return null;
}
public function getOpenTicketsOlderThan24HoursAndAssignNextLevel()
{
$current_day = date('D'); // Sun, Mon, Tue...
$nl = (php_sapi_name() === 'cli') ? PHP_EOL : '<br>';
echo $current_day . $nl;
if ($this->request) {
echo "REQUEST" . $nl;
} else {
echo "CLI" . $nl;
}
if ($current_day === 'Sun') {
if($this->request){
return $this->respond(['message' => "Today is Sunday. Ticket reminder mail skipped"], 200);
}else{
$this->myLogger->logme('error', 'Today is Sunday. Ticket reminder mail skipped');
echo 'Today is Sunday. Ticket reminder mail skipped';
return;
}
}
$client_id = $this->request->getGet('client_id') ?? null;
$ticket_id = $this->request->getGet('ticket_id') ?? null;
// Fetch tickets older than 8 hours
$builder = $this->thzMasterModel
->whereIn('status', ['Open', 'In Progress'])
// ->where('thz_id', 85)
->where('created_at <= DATE_SUB(NOW(), INTERVAL 8 HOUR)', null, false);
// add condition only if client_id exists
if (!empty($client_id)) {
$builder->where('client_id', $client_id);
}
// add condition only if ticket_id exists
if (!empty($ticket_id)) {
$builder->where('thz_id', $ticket_id);
}
$result = $builder->findAll();
$subjectTemplate = 'Ticket Pending for More Than ((HOURS)) Hours Action Required';
$messageTemplate = '<a href="((TICKET_URL))"> <strong> Ticket ID : ((TICKET_ID)) </strong> </a> has remained in the same status for ((HOURS)) hours. Please take the necessary action.';
$common = [
'module' => 'THZ',
'mail_type' => 'Thz_Reminder_mail'
];
$mail_send_count = 0;
if(!empty($result)){
foreach ($result as $value) {
// Calculate hours difference
$createdAt = new \DateTime($value['created_at']);
$now = new \DateTime();
$hours = floor(($now->getTimestamp() - $createdAt->getTimestamp()) / 3600);
$ticket_url = base_url('ticketConversationList?return_type=web&thz_id=' . $value['thz_id']);
// Replace placeholders
$subject = str_replace('((HOURS))', $hours, $subjectTemplate);
$message = str_replace(
['((TICKET_ID))', '((HOURS))', '((TICKET_URL))'],
[$value['thz_id'], $hours, $ticket_url],
$messageTemplate
);
$client_id = $value['client_id'];
$level_of_user_data = $this->getRmsIdUsingClientId($client_id);
if(!empty($level_of_user_data)){
foreach ($level_of_user_data as $user) {
$res = MailHelper::send_email([
'mail' => $user['email'],
'subject' => $subject,
'message' => $message,
'common' => $common
]);
$mail_send_count++;
$this->myLogger->logme(
'error',
'THZ Reminder Mail Sent | Ticket ID: ' . $value['thz_id'] . ' | Client ID : ' . $client_id . ' | Response: ' . json_encode($res)
);
}
}else{
$this->myLogger->logme('error', 'CLIENT ID : ' . $client_id . "has no RM's found skipped...." );
}
}
}else{
if($this->request){
return $this->respond(['message' => "No ticket Pending for More Than 8 hrs"], 200);
}else{
$this->myLogger->logme('error', 'No ticket Pending for More Than 8 hrs');
echo 'No ticket Pending for More Than 8 hrs';
return;
}
}
if($this->request){
return $this->respond(['mail_send_count' => $mail_send_count], 200);
}else{
print_r(['mail_send_count' => $mail_send_count]);
return;
}
}

View File

@ -2,16 +2,24 @@
namespace App\Controllers;
use App\Models\BatchFileModel;
use App\Models\EmployeePolicyModel;
use App\Models\TpaApiDataModel;
use App\Controllers\BaseController;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
class VidalApiController extends BaseController
{
use ResponseTrait;
protected $db;
protected $vidal_primary_key;
public function __construct()
{
$this->db = \Config\Database::connect();
$this->vidal_primary_key = getenv('VIDAL_PRIMARY_KEY_CONSTANT');
}
@ -400,7 +408,7 @@ class VidalApiController extends BaseController
return ['status' => 'success','data' => $decryptedData["redirectUrl"]];
}
public function ClaimDetail($claimId = null)
public function ClaimDetail($claimId = null) //234
{
helper('api');
@ -418,6 +426,7 @@ class VidalApiController extends BaseController
tm.id,
tm.tpa_no as memberId,
tm.tpa_claim_push_reference_no as claimRefNo,
tm.tpa_claim_id as claimID,
cp.policy_no as policyNo,
cp.policy_start_date as startDate,
cp.policy_end_date as endDate,
@ -429,230 +438,523 @@ class VidalApiController extends BaseController
->get()
->getRowArray();
$body = [
if (!$ticket) {
return $this->response->setJSON(['status' => false,'message' => 'Invalid Claim ID' ]);
}
$body = [];
// REQUEST BODY
if($ticket['claimID'] != null)
{
$body = [
'empNO' => "",
'tpaCardID' => "",
'claimID' => $ticket['claimID'],
'emailID' => "",
'mobileNO' => "",
];
}
$response = call_third_party_api($url, $method, $headers, $body);
// dd($response);
if ($response['status'] != true || empty($response['data']['data']['claims'][0])) {
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
return $this->response->setJSON([
'status' => false,
'message' => 'API call failed.',
'data' => $response
]);
}
// Extract claim status
$claimData = $response['data']['data']['claims'][0];
$currentStatus = $claimData['status'] ?? '';
// VALID STATUS LIST
$validStatuses = [
"In-Progress" => 5,
"Required Information" => 4,
"Paid" => 11,
"Rejected" => 8,
"Approved" => 8,
];
// Maping tpa claim status with local claim Status
if (isset($validStatuses[$currentStatus]))
{
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'updated_at' => date('Y-m-d H:i:s')];
}else{
$updateArray = ['tpa_claim_status' => $currentStatus , 'updated_at' => date('Y-m-d H:i:s')];
}
// UPDATE ticket_master
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
// LOG UPDATE
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
return $this->response->setJSON([
'status' => true,
'message' => 'Claim status updated.',
'updated_status' => $currentStatus,
'api_response' => $response
]);
}
public function ClaimStatusUpdate()
{
helper('api');
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
];
// Fetch ticket master details
$TicketData = $this->db->table('ticket_master tm')
->select("
tm.id,
tm.tpa_no as memberId,
tm.tpa_claim_push_reference_no as claimRefNo,
tm.tpa_claim_id as claimNo,
cp.policy_no as policyNo,
cp.policy_start_date as startDate,
cp.policy_end_date as endDate,
e.emp_code as employeeCode
")
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->where('tm.tpa_claim_push_reference_no IS NOT NULL')
->where('tm.is_active', 1)
->whereNotIn('tm.claim_status_id', [8, 11, 12, 13, 66, 22, 24, 47, 49, 32, 34, 53, 55, 42, 44, 58, 60])
->where('tm.tpa_id', $this->vidal_primary_key)
->get()
->getResultArray();
// dd($TicketData);
if (!$TicketData) {
log_message('error', "Claims not found to update status");
return $this->response->setJSON(['status' => false,'message' => 'Claims not found' ]);
}
$error_data = [];
$status_updated_count = 0;
foreach ($TicketData as $key => $ticket)
{
$claimId = $ticket['id'];
$body = [];
// REQUEST BODY
if($ticket['claimNo'] != null)
{
$body = [
'empNO' => "",
'tpaCardID' => "",
'claimID' => $ticket['claimNo'],
'emailID' => "",
'mobileNO' => "",
];
}
// CALL API
$response = call_third_party_api($url, $method, $headers, $body);
if ($response['status'] != true || empty($response['data']['data']['claims'][0])) {
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
$error_data[$claimId][['status' => false,'message' => 'API call failed.','data' => $response]];
}
// Extract claim status
$claimData = $response['data']['data']['claims'][0];
$currentStatus = $claimData['status'] ?? '';
// VALID STATUS LIST
$validStatuses = [
"In-Progress" => 5,
"Required Information" => 4,
"Paid" => 11,
"Rejected" => 8,
"Approved" => 8,
];
// Maping tpa claim status with local claim Status
if (isset($validStatuses[$currentStatus]))
{
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'updated_at' => date('Y-m-d H:i:s')];
}else{
$updateArray = ['tpa_claim_status' => $currentStatus , 'updated_at' => date('Y-m-d H:i:s')];
}
// UPDATE ticket_master
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
// LOG UPDATE
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
$status_updated_count ++;
}
return $this->response->setJSON([
'status' => true,
'message' => 'Claim status updated.',
'updated_status' => $currentStatus,
'api_response' => $response,
'count' => $status_updated_count,
'error_data' => $error_data,
]);
}
public function EcardRequest($employeeId = null, $policyNo = null , $tpaNo = null)
{
helper('api');
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
];
$body = [
'empNO' => "",
'tpaCardID' => "",
'claimID' => "BLR-0284-CL-9349459",
'tpaCardID' => $tpaNo,
'claimID' => "",
'emailID' => "",
'mobileNO' => "",
];
// $body = [
// 'empNO' => "",
// 'tpaCardID' => "BLR-NI-H0351-03925-0030320-A",
// 'claimID' => "",
// 'emailID' => "",
// 'mobileNO' => "",
// ];
$response = call_third_party_api($url, $method, $headers, $body);
// dd($response);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'failed.',
'data' => $response
]);
log_message('error', 'Ecard Request FAILED | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | response: '.json_encode($response));
return null;
}
$ecardUrl = $response['data']['data']['dependents'][0]['ecardLink'] ?? null;
if(!empty($ecardUrl)){
log_message('error', 'Ecard Request PUSH SUCCESS | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | ecardUrl: '.$ecardUrl);
return $ecardUrl;
} else {
log_message('error', 'Ecard Request SUCCESS BUT ecardUrl EMPTY | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | response: '.json_encode($response));
return null;
}
return $this->response->setJSON($response);
}
//----------yet to start only submit claim given
public function fileUpload()
public function GetBenefDetails($requestData)
{
helper('api');
$url = getenv('VIDAL_API_BASE_URL') . '/files/upload-url';
$method = 'POST';
$function_calling_type = $requestData['return_type'] ?? 'job';
$headers = [
'Content-Type: application/json',
'x-ms-blob-type: BlockBlob',
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
];
try {
$body = [
'scope' => 'application/pdf',
'fileName' => '1760013019_73d94af7b96ddc2e3d51.png',
'file' => '/opt/lampp/htdocs/nhance/writable/uploads/claim_files/1760013019_73d94af7b96ddc2e3d51.png',
];
helper('api');
$response = call_third_party_api($url, $method, $headers, $body);
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
$method = 'POST';
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'failed.',
'data' => $response
]);
$headers = [
'Content-Type: application/json',
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
];
$policyNo = $requestData['policy_no'] ?? null;
$client_policy_id = $requestData['client_policy_id'] ?? null;
if (empty($policyNo)) {
log_message('error', 'TPA ID PULL | policy_no missing in request');
if($function_calling_type == "job"){
return ['status' => false, 'message' => 'policy_no required'];
}else{
return $this->respond(['status' => false, 'message' => 'policy_no required']);
}
}
if (empty($client_policy_id)) {
log_message('error', 'TPA ID PULL | client_policy_id missing in request');
if($function_calling_type == "job"){
return ['status' => false, 'message' => 'client_policy_id required'];
}else{
return $this->respond(['status' => false, 'message' => 'client_policy_id required']);
}
}
log_message('error', "TPA ID PULL | called for policy_no: {$policyNo} , client_policy_id: {$client_policy_id}");
// Fetch file download dates
$batchFiles = $this->db->table('batch_files f')
->select("f.created_at")
->where('f.client_policy_id', $client_policy_id)
->where('f.insurer_or_tpa', 'tpa')
->where('f.actions', 'export')
->get()
->getResultArray();
// dd($batchFiles);
if (empty($batchFiles)) {
log_message('error', 'TPA ID PULL FAILED | batchFiles is empty for this tpa id pull request');
if($function_calling_type == "job"){
return ['status' => false, 'message' => 'batchFiles not found'];
}else{
return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
}
}
$allBenef = [];
foreach ($batchFiles as $key => $value)
{
$createdAt = new \DateTime($value['created_at']);
$startDate = $createdAt->format('d/m/Y');
$endDateObj = clone $createdAt;
$endDateObj->modify('+2 days');
$endDate = $endDateObj->format('d/m/Y');
$body = [
'policyNO' => $policyNo,
'startDate' => $startDate,
'endDate' => $endDate
];
// $body = [ 'empNO' => "Mem 1" ];
log_message('error', "TPA ID PULL | API parems " . json_encode([$url, $method, $headers, $body]));
$response = call_third_party_api($url, $method, $headers, $body);
if ($response['status'] != true) {
// update file table status after the tpa id failed to update
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
$file_model = new BatchFileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
} else {
log_message('error', "Failed to update file table status.");
}
log_message('error', 'TPA ID PULL API FAILED | API failed: ' . json_encode($response));
if($function_calling_type == "job"){
return ['status' => false, 'message' => 'API call failed', 'data' => $response];
}else{
return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $response]);
}
}
$data = $response['data']['data'] ?? [];
if (!isset($data['dependents'])) {
log_message('error', "TPA ID PULL FAILED |: 'benefDetails' missing in API response: " . json_encode($data));
break;
}
$fetchedCount = count($data['dependents']);
log_message('error', "Fetched {$fetchedCount} records ");
$allBenef = array_merge($allBenef, $data['dependents']);
}
// dd($allBenef );
//save API data as JSON for analysis
$json = json_encode($allBenef, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
// $filename = time() . '.json';
$filePath = WRITEPATH . 'tmp/'.time().'_'.$requestData['file_id'].'.json';
file_put_contents($filePath, $json);
//call a job for dump JSON data to DB
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'saveMediAssitAPIData', 'payload' => [ 'file_id' => $requestData['file_id'],'json_file_path' => $filePath ]]);
// now update DB
$employeePolicyModel = new EmployeePolicyModel();
$employeePolicyData = $employeePolicyModel
->select('
employees.*,
employee_polices.id as emp_policy_id,
employee_polices.client_policy_id,
')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.is_active', 1)
->where('employee_polices.status', 'active')
->where('employees.is_active', 1)
->where('employees.emp_status', 'active')
->where('employee_polices.tpa_id IS NULL')
->where('employee_polices.client_policy_id', $client_policy_id)
->findAll();
$batch_file_success = 'success';
$updated = 0;
$totalCount = count($employeePolicyData);
$employee_policy_ids = [];
foreach ($employeePolicyData as $policy_data) {
$hasMatchForThisPolicy = false;
foreach ($allBenef as $row) {
if (
strtolower(trim($policy_data['name'] ?? '')) == strtolower(trim($row['name'] ?? '')) &&
($policy_data['emp_code'] ?? '') == ($row['empNo'] ?? '') &&
strtolower(trim($policy_data['relationship'] ?? '')) == strtolower(trim(str_replace('-', ' ', $row['relationship'] ?? ''))) &&
($policy_data['gender'] ?? '') == ($row['gender'] ?? '') &&
($policy_data['dob'] ?? '') == (change_date_format($row['dob'], 'Y-m-d H:i:s') ?? '')
) {
$hasMatchForThisPolicy = true;
// log_message('error', "✅ Match found: emp_code={$row['empNo']} policy={$row['policyNumber']}");
$sql = "UPDATE employee_polices
SET tpa_id = ?
WHERE id = ?";
$this->db->query($sql, [$row['enrollmentId'], $policy_data['emp_policy_id']]);
// for e-card send
if(strtolower(trim($policy_data['relationship'])) == 'self'){
$employee_policy_ids[] = $policy_data['emp_policy_id'];
}
if ($this->db->affectedRows() > 0) {
$updated++;
log_message('error', "✅ Updated tpa_id={$row['enrollmentId']} for emp_code={$row['empNo']} policy={$row['policyNumber']}");
} else {
log_message('error', "⚠️ No update (already set or not matched) for emp_code={$row['empNo']} policy={$row['policyNumber']}");
}
}
}
// Handle NO MATCH for this policy
if (!$hasMatchForThisPolicy) {
$nhanceSideData = [
'name' => $policy_data['name'] ?? null,
'emp_code' => $policy_data['emp_code'] ?? null,
'relationship' => $policy_data['relationship'] ?? null,
'gender' => $policy_data['gender'] ?? null,
'dob' => $policy_data['dob'] ?? null,
];
$batch_file_success = 'partially success';
log_message(
'error',
"❌ No match for Nhance = " . json_encode($nhanceSideData)
);
}
}
// send e-card
if(!empty($employee_policy_ids)){
log_message('error', "sendMailForDownloadingECard JOB PUSHED.");
Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $employee_policy_ids, 'client_policy_id' => $client_policy_id]]);
}
// update file table status after the tpa id successfully updated
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
$file_model = new BatchFileModel();
$file_model->where('id', $requestData['file_id'])->set('status', $batch_file_success)->update();
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
} else {
log_message('error', "Failed to update file table status.");
}
log_message('error', "TPA ID PULL SUCCESS | completed. Total fetched={$totalCount}, updated={$updated}");
if($function_calling_type == "job"){
return [
'status' => true,
'message' => 'Updated successfully',
'total_fetched' => $totalCount,
'total_updated' => $updated
];
}else{
return $this->respond([
'status' => true,
'message' => 'Updated successfully',
'total_fetched' => $totalCount,
'total_updated' => $updated
]);
}
} catch (\Throwable $th) {
// update file table status after the tpa id failed to update
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
$file_model = new BatchFileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
} else {
log_message('error', "Failed to update file table status.");
}
$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,
];
log_message('error', 'Exception thrown while calling GetBenefDetails API: ' . json_encode($errorData));
if($function_calling_type == "job"){
return ['status' => false, 'message' => 'API call failed', 'data' => $errorData];
}else{
return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $errorData]);
}
}
return $this->response->setJSON($response);
// {
// "status": true,
// "data": {
// "status": "SUCCESS",
// "data": {
// "signedUrl": "https://devapigw.vidalhealthtpa.com/doc-storage/api/deeplink/6912d37a9f09fc3f6be4cd9c/56fb8e76-39a4-4e4b-99f2-4748e224e4a7?se=2025-11-18T06:11:06.304Z",
// "expiresAt": "2025-11-18T06:11:06.304Z",
// "fileId": "https://devapigw.vidalhealthtpa.com/doc-storage/api/private/6912d37a9f09fc3f6be4cd9c"
// },
// "trace": "T_ID_a09327df-ea34-4874-9e3f-05ac5c0a2c68",
// "successful": true
// },
// "code": 200
// }
}
public function hospitalNetwork(){
$postData = $this->request->getJSON(true);
helper('api');
$url = ''. getenv('VIDAL_API_BASE_URL').'/hospitalnetwork';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Authorization:'. getenv('VIDAL_API_KEY').'',
'username:'. getenv('VIDAL_API_USERNAME').'',
'password:'. getenv('VIDAL_API_PASSWORD').'',
'policynumber:'. $postData['policyNo'] ?? '',
];
$body = [];
$response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'Token generation failed.',
'data' => $response
]);
}
return $this->response->setJSON($response);
}
public function eCardService(){
$postData = $this->request->getJSON(true);
helper('api');
$url = ''. getenv('VIDAL_API_BASE_URL').'/ecardservice';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Authorization:'.getenv('VIDAL_API_KEY').'',
'username:' .getenv('VIDAL_API_USERNAME').'',
'password:' .getenv('VIDAL_API_PASSWORD').'',
'PolicyNo:' .$postData['PolicyNo'] ?? '',
'enrollmentNo:' .$postData['enrollmentNo'] ?? '',
];
$body = [
];
$response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'Token generation failed.',
'data' => $response
]);
}
return $this->response->setJSON($response);
}
public function claimStatusCheck(){
$postData = $this->request->getJSON(true);
helper('api');
$url = ''. getenv('VIDAL_API_BASE_URL').'/claimpreauthservice';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Authorization:' .getenv('VIDAL_API_KEY').'',
'username:' .getenv('VIDAL_API_USERNAME').'',
'password:' .getenv('VIDAL_API_PASSWORD').'',
'PolicyNo:' .$postData['policyNo'] ?? '',
'enrollmentNo:' .$postData['enrollmentNo'] ?? '',
'empNo:' .$postData['empNo'] ?? '',
'startdate:' .$postData['startdate'] ?? '',
'enddate:' .$postData['enddate'] ?? '',
'tpaclaimNo:' .$postData['tpaclaimNo'] ?? ''
];
$body = [];
$response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'Token generation failed.',
'data' => $response
]);
}
return $this->response->setJSON($response);
}
public function enrollment()
{
$postData = $this->request->getJSON(true);
helper('api');
$url = getenv('VIDAL_API_BASE_URL').'/enrollmendataservice';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Authorization:'. getenv('VIDAL_API_KEY').'',
'username:' . getenv('VIDAL_API_USERNAME').'',
'password:' . getenv('VIDAL_API_PASSWORD').'',
'policyNo:' .$postData['policyNo'] ?? '',
'startindex:' .$postData['startindex'] ?? '',
'endindex:' .$postData['endindex'] ?? ''
];
$body = [
];
$response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'Token generation failed.',
'data' => $response
]);
}
return $this->response->setJSON($response);
}
}

View File

@ -279,6 +279,7 @@ class EmployeePolicyModel extends Model
'client_branch.branch_code as client_branch_code',
'cp.policy_no',
'cp.policy_type_id',
'cp.is_addon',
$ecard_download_link
])
->join('employees emp', 'employee_polices.employee_id = emp.id')

View File

@ -206,6 +206,14 @@
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>', '<?= $employee['client_policy_id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
<?php } ?>
<?php if($employee['relationship'] == 'Self' && in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
<?php } ?>
<?php if($employee['is_addon'] == 3 && $employee['policy_type_id'] == 3 && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
<?php } ?>
</div>
</div>
</td>
@ -780,4 +788,67 @@
}
function showReGenerateConfirmation(client_policy_id, emp_code){
Swal.fire({
title: "Do you want to Re-Generate Ecard for this family?",
showDenyButton: true,
showCancelButton: false,
confirmButtonText: "Yes",
denyButtonText: "No"
}).then((result) => {
if (result.isConfirmed) {
reGenerateEcardForSingleFamily(client_policy_id, emp_code)
}
});
}
function reGenerateEcardForSingleFamily(client_policy_id, emp_code)
{
if(!client_policy_id){
toastr.warning('Failed to re-Generate E-card', 'WARNING');
}
if(!emp_code){
toastr.warning('Failed to re-Generate E-card', 'WARNING');
}
console.log({client_policy_id, emp_code});
let url = '<?= base_url('/employee/bulkGenerateEcardAndStoreinS3') ?>';
// Data to send in the AJAX request
let requestData = {
client_policy_id: client_policy_id,
emp_code: emp_code,
};
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// Send AJAX request
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
if (response.dataStatus == true) {
toastr.success(response.message || 'Initiating successafully.', 'SUCCESS');
} else {
toastr.warning(response.status || 'Unable to regenerate e-card.', 'WARNING');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('Unable to regenerate e-card.', 'ERROR');
});
}
</script>

View File

@ -22,15 +22,13 @@ table.dataTable tbody td {
</thead>
<tbody class="font-12">
<?php for ($i = 1; $i <= $count; $i++): ?>
<tr>
<?php foreach ($tbody[$i] as $data): ?>
<td>
<?php echo $data;?>
</td>
<?php endforeach; ?>
</tr>
<?php endfor; ?>
<?php helper('excel_util_helper'); foreach ($tbody as $body) { if(check_row_is_empty_or_null($body)){break;} ?>
<tr>
<?php foreach ($body as $data){ ?>
<td><?= esc($data) ?></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div> <!-- end .table-responsive -->