TPA : ecard , claim status , tpa pull

This commit is contained in:
Gowtham M 2026-01-02 13:07:20 +05:30
commit fee8839caf
20 changed files with 828 additions and 379 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');
@ -530,7 +531,7 @@ $routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuer
$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');
@ -814,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

@ -6103,7 +6103,7 @@ class ClientController extends AdminController
$empServiceController = new EmployeeServiceController();
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1248']);
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1252']);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);

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);
}
@ -1502,14 +1515,14 @@ class EmployeeController extends AdminController
}
// exit();
}
else
{
if($mode !== 2)
{
$data['message'] = 'Inprogress... Comeback later! or Contact support';
return view('errors/404', $data);
}
}
// else
// {
// if($mode !== 2)
// {
// $data['message'] = 'Inprogress... Comeback later! or Contact support';
// return view('errors/404', $data);
// }
// }
//in else generate PDF and upload it in s3
// echo 'else';
@ -1646,20 +1659,27 @@ class EmployeeController extends AdminController
// echo '<br>PDF generated and uploaded to S3 successfully.<br>';
unlink($temp_local_path);
// exit();
// if ($mode == 1) {
// // Inline view
// return $this->response
// ->setHeader('Content-Type', 'application/pdf')
// ->setHeader('Content-Disposition', 'inline; filename="' . $filename . '"')
// ->setBody($dompdf->output());
// } else {
// // Force download
// return $this->response
// ->setHeader('Content-Type', 'application/pdf')
// ->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"')
// ->setBody($dompdf->output());
// }
if($s3->exists($s3_key)) //2 => for bulk generate so skip s3 check and generate PDF
{
//get pre signed url & make it download
$s3_url = $s3->getPresignedUrl($s3_key );
$pdf = file_get_contents($s3_url['url']);
if ($mode == 1) {
// Inline view
return $this->response
->setHeader('Content-Type', 'application/pdf')
->setHeader('Content-Disposition', 'inline; filename="' . $s3_key . '"')
->setBody($pdf);
} else if($mode == 0){
// echo 'Force download';//die();
return $this->response
->setHeader('Content-Type', 'application/pdf')
->setHeader('Content-Disposition', 'attachment; filename="' . $s3_key . '"')
->setBody($pdf);
}
// exit();
}
// $this->myLogger->logme('error', 'generateIDCardForEmployee function completed successfully.');
@ -1671,6 +1691,20 @@ class EmployeeController extends AdminController
}
public function sanitizeFilePart(string $value): string
{
// Trim spaces
$value = trim($value);
// Replace ANY unsafe character (including /) with underscore
$value = preg_replace('/[^A-Za-z0-9._()-]/', '_', $value);
// Collapse multiple underscores
$value = preg_replace('/_+/', '_', $value);
return $value;
}
// --------------------------------------------------------------------------------------------------------------------
public function viewECard()
@ -3289,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();
@ -4019,187 +4058,211 @@ class EmployeeController extends AdminController
exit;
}
public function bulkGenerateEcardAndStoreinS3(array $params = [])
public function bulkGenerateEcardAndStoreinS3(array $params = [])
{
/**
* ---------------------------
* 1. Detect mode + collect inputs
* ---------------------------
*/
$request = \Config\Services::request();
$isCli = is_cli();
$client_policy_id = $params['client_policy_id'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$emp_pk = $params['emp_pk'] ?? null;
$batch_size = $params['batch_size'] ?? null;
$batch_no = $params['batch_no'] ?? null;
$execution_mode = $params['execution_mode'] ?? 'sequential';//parallel
$total_batches = $params['total_batches'] ?? 0;//parallel
if (is_cli()) {
$mode = 'CLI';
/* ---------------------------------------------------------
* 1. INPUTS (shared for WEB + CLI)
* --------------------------------------------------------- */
$client_policy_id = $params['client_policy_id'] ?? (!$isCli ? $request->getGet('client_policy_id') : null);
$emp_code = $params['emp_code'] ?? (!$isCli ? $request->getGet('emp_code') : null);
$emp_pk = $params['emp_pk'] ?? (!$isCli ? $request->getGet('emp_pk') : null);
} elseif (empty($params) && $this->request->getMethod() === 'get') {
$mode = 'WEB';
$batch_size = (int) ($params['batch_size'] ?? (!$isCli ? $request->getGet('batch_size') : 100));
$batch_size = $batch_size > 0 ? $batch_size : 100;
$client_policy_id = $this->request->getGet('client_policy_id');
$emp_code = $this->request->getGet('emp_code');
$emp_pk = $this->request->getGet('emp_pk');
$execution_mode = $this->request->getGet('execution_mode') ?? 'sequential';
$batch_size = (int) ($this->request->getGet('batch_size') ?? 100);
if($client_policy_id == null || empty($client_policy_id) || $client_policy_id == '')
{
return $this->respond(['status' => false, 'code' => 200, 'message' => 'client_policy_id is necessary'], 200);
$batch_no = isset($params['batch_no']) ? (int) $params['batch_no'] : null;
$total_batches = (int) ($params['total_batches'] ?? 0);
$execution_mode = $params['execution_mode'] ?? (!$isCli ? $request->getGet('execution_mode') : 'sequential');
$execution_mode = in_array($execution_mode, ['sequential', 'parallel']) ? $execution_mode : 'sequential';
$is_dry_run = $params['is_dry_run'] ?? (!$isCli ? $request->getGet('is_dry_run') : false);
$log_search_context = 'ECARD_BULK_TO_S3';
if($is_dry_run)
{
$log_search_context = 'ECARD_BULK_TO_S3_DRY_RUN';
}
// Cursor (KEY FIX: avoids OFFSET issues)
$last_emp_id = (int) ($params['last_emp_id'] ?? 0);
$this->myLogger->logme('error', "$log_search_context"." INIT - ". json_encode([
'cli' => $isCli,
'policy' => $client_policy_id,
'batch_no' => $batch_no,
'last_emp_id' => $last_emp_id,
'mode' => $execution_mode,
'is_dry_run' => $is_dry_run
]));
/* ---------------------------------------------------------
* 2. WEB DISPATCHER (QUEUE CREATOR)
* --------------------------------------------------------- */
if (!$isCli && empty($params)) {
if (empty($client_policy_id)) {
return $this->respond(['status' => false, 'message' => 'client_policy_id required'], 200);
}
/**
* ---------------------------
* 2. Calculate total records
* ---------------------------
*/
$total = $this->employeePolicyModel
// COUNT QUERY (same filters as worker)
$countBuilder = $this->employeePolicyModel->builder()
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employees.emp_status', 'active')
->where('employees.is_active', '1')
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
->where('employee_polices.status', 'active')
->where('employee_polices.is_active', '1')
->where('employee_polices.client_policy_id', $client_policy_id)
->countAllResults();
->where([
'employees.emp_status' => 'active',
'employees.is_active' => '1',
'employee_polices.status' => 'active',
'employee_polices.is_active' => '1',
'employee_polices.client_policy_id' => $client_policy_id
])
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''");
if ($emp_code) $countBuilder->where('employees.emp_code', $emp_code);
if ($emp_pk) $countBuilder->where('employees.id', $emp_pk);
$total = (int) $countBuilder->countAllResults();
if ($total === 0) {
$this->myLogger->logme('error', "$log_search_context". 'No records found. Queue skipped.');
return $this->respond(['status' => 'NO_RECORDS'], 200);
}
$total_batches = (int) ceil($total / $batch_size);
// echo $total_batches;die();
$this->myLogger->logme('error', "$log_search_context".'Queueing jobs - '. json_encode([
'total' => $total,
'batches' => $total_batches,
'mode' => $execution_mode
]));
$basePayload = [
'client_policy_id' => $client_policy_id,
'batch_size' => $batch_size,
'total_batches' => $total_batches,
'execution_mode' => $execution_mode,
'emp_code' => $emp_code,
'emp_pk' => $emp_pk,
'last_emp_id' => 0,
'is_dry_run' => $is_dry_run
];
/**
* ---------------------------
* 3. Push JOB per batch
* ---------------------------
*/
if ($execution_mode === 'parallel') {
for ($batch_no = 1; $batch_no <= $total_batches; $batch_no++) {
for ($i = 1; $i <= $total_batches; $i++) {
Jobs::addJob([
'job_name' => 'bulkGenerateEcardAndStoreinS3',
'payload' => [
'client_policy_id' => $client_policy_id,
'emp_code' => $emp_code,
'emp_pk' => $emp_pk,
'batch_size' => $batch_size,
'batch_no' => $batch_no,
'total_batches' => $total_batches,
'execution_mode' => 'parallel',
],
'payload' => array_merge($basePayload, ['batch_no' => $i])
]);
}
} else {
Jobs::addJob([
'job_name' => 'bulkGenerateEcardAndStoreinS3',
'payload' => array_merge($basePayload, ['batch_no' => 1])
]);
}
if ($execution_mode === 'sequential') {
Jobs::addJob([
'job_name' => 'bulkGenerateEcardAndStoreinS3',
'payload' => [
'client_policy_id' => $client_policy_id,
'batch_size' => $batch_size,
'batch_no' => $batch_no ?? 1,
'total_batches' => $total_batches,
'execution_mode' => 'sequential',
],
]);
}
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);
}
return $this->respond(['status' => true, 'code' => 200, 'message' => 'E-card generation started',
'total' => $total,
'batches' => $total_batches,], 200);
// return [
// 'status' => true,
// 'message' => 'E-card generation started',
// 'total' => $total,
// 'batches' => $total_batches,
// ];
}
//else {
// return true;
// }
/* ---------------------------------------------------------
* 3. CLI WORKER (ACTUAL PROCESSOR)
* --------------------------------------------------------- */
if ($batch_no === null) {
$this->myLogger->logme('error', "$log_search_context".'Worker called without batch_no');
return;
}
/**
* ---------------------------
* 4. Build query (CLI execution)
* ---------------------------
*/
$builder = $this->employeePolicyModel
->select('
$this->myLogger->logme('error', "$log_search_context"."START Batch {$batch_no}");
$builder = $this->employeePolicyModel->builder();
$builder->select('
employee_polices.client_policy_id,
employees.emp_code,
employees.id as emp_id,
tpa.short_name,
employees.client_id,
employee_polices.rand_string,
employees.id as emp_id
employee_polices.rand_string
')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('employees', 'employees.id = employee_polices.employee_id')
->join('tpa', 'tpa.id = client_policy.tpa_id')
->where('employees.emp_status', 'active')
->where('employees.is_active', '1')
->where([
'employees.emp_status' => 'active',
'employees.is_active' => '1',
'employee_polices.status' => 'active',
'employee_polices.is_active' => '1',
'employee_polices.client_policy_id' => $client_policy_id
])
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
->where('employee_polices.status', 'active')
->where('employee_polices.is_active', '1')
->where('employee_polices.client_policy_id', $client_policy_id);
->orderBy('employees.id', 'ASC');
if (!empty($emp_code)) {
$builder->where('employees.emp_code', $emp_code);
if ($emp_code) $builder->where('employees.emp_code', $emp_code);
if ($emp_pk) $builder->where('employees.id', $emp_pk);
if ($last_emp_id) $builder->where('employees.id >', $last_emp_id);
$rows = $builder->get($batch_size)->getResultArray();
$rowCount = count($rows);
$this->myLogger->logme('error', "$log_search_context"." Batch {$batch_no} fetched {$rowCount} rows");
if ($rowCount === 0) {
$this->myLogger->logme('error', "$log_search_context"." Batch {$batch_no} empty. STOPPING.");
return;
}
if (!empty($emp_pk)) {
$builder->where('employees.id', $emp_pk);
}
foreach ($rows as $row) {
$this->myLogger->logme('error', "$log_search_context".' Processing - '. json_encode([
'emp_id' => $row['emp_id'],
'emp_code' => $row['emp_code'],
'policy' => $row['client_policy_id']
]));
/**
* ---------------------------
* 5. Apply batching (only if provided)
* ---------------------------
*/
if (!empty($batch_size) && !empty($batch_no)) {
$offset = ($batch_no - 1) * $batch_size;
$builder->limit($batch_size, $offset);
}
$res = $builder->findAll();
/**
* ---------------------------
* 6. Process batch
* ---------------------------
*/
foreach ($res as $row) {
$ecard_gen_res = $this->generateIDCardForEmployee(
$row['rand_string'],
0,
2 // skip S3 check, force regenerate
);
// print_rr([
// 'batch' => $batch_no,
// 'emp' => $row['emp_code'],
// 'res' => $ecard_gen_res,
// ]);
// echo date('Y-m-d H:i:s') . PHP_EOL;
}
if ($execution_mode === 'sequential' && $batch_no < $total_batches) {
Jobs::addJob([
'job_name' => 'bulkGenerateEcardAndStoreinS3',
'payload' => [
'client_policy_id' => $client_policy_id,
'batch_size' => $batch_size,
'batch_no' => ($batch_no + 1),
'total_batches' => $total_batches,
'execution_mode' => 'sequential',
],
]);
if(!$is_dry_run) //for tesing skip generate ecard and just log only
{
$ecard_gen_res = $this->generateIDCardForEmployee($row['rand_string'],0,2); // 2 means skip S3 check
}
// echo "BATCH {$batch_no} COMPLETED @ " . date('Y-m-d H:i:s') . PHP_EOL;
return array($batch_no);
$this->myLogger->logme('error', "$log_search_context".' processed - '. json_encode([
'emp_id' => $row['emp_id'],
'emp_code' => $row['emp_code'],
'policy' => $row['client_policy_id'],
// 'ecard_gen_res' => $ecard_gen_res
]));//check
}
$new_last_emp_id = end($rows)['emp_id'];
/* ---------------------------------------------------------
* 4. SEQUENTIAL RE-QUEUE (SAFE)
* --------------------------------------------------------- */
if ($execution_mode === 'sequential' && $rowCount === $batch_size) {
$this->myLogger->logme('info', "$log_search_context"."Re-queueing next batch - " . json_encode([
'next_batch' => $batch_no + 1,
'last_emp_id' => $new_last_emp_id
]));
Jobs::addJob([
'job_name' => 'bulkGenerateEcardAndStoreinS3',
'payload' => [
'client_policy_id' => $client_policy_id,
'batch_size' => $batch_size,
'batch_no' => $batch_no + 1,
'execution_mode' => 'sequential',
'last_emp_id' => $new_last_emp_id,
'emp_code' => $emp_code,
'emp_pk' => $emp_pk,
'is_dry_run' => $is_dry_run
]
]);
}
$this->myLogger->logme('error', "$log_search_context". "END Batch {$batch_no}");
}

View File

@ -2928,6 +2928,11 @@ class EmployeeRestController extends AdminController
$data['ticket_settled_status_id'] = 44;
$data['claim_subject'] = "Claim GTLI";
$data['sum_insured_label'] = "Sum Assured";
} else if ($ClientPolicyValue['policy_type_id'] == 72){
$data['ticket_type_id'] = 72;
$data['ticket_settled_status_id'] = 76;
$data['claim_subject'] = "Claim OPD";
$data['sum_insured_label'] = "Sum Insured";
} else {
$policyGroup = 'gmc';
$data['ticket_type_id'] = 1;
@ -3625,7 +3630,7 @@ class EmployeeRestController extends AdminController
WHEN cp.policy_type_id = 1 THEN 2
WHEN cp.policy_type_id = 6 THEN 3
WHEN cp.policy_type_id = 7 THEN 4
ELSE NULL
ELSE cp.policy_type_id
END AS ticket_type_id
from employees emp
@ -3653,6 +3658,9 @@ class EmployeeRestController extends AdminController
if ($fetchData['ticket_type_id'] == 1 && !empty($fetchData['tpa_no'])) {
$results = $claimStatusQuery->findAll(2);
$fetchData['claim_status_id'] = $results[1]['id'] ?? $results[0]['id'];
} else if ($fetchData['ticket_type_id'] == 72 && !empty($fetchData['tpa_no'])) {
$results = $claimStatusQuery->findAll(2);
$fetchData['claim_status_id'] = $results[1]['id'] ?? $results[0]['id'];
} else {
$fetchData['claim_status_id'] = $claimStatusQuery->first()['id'];
}
@ -3918,6 +3926,7 @@ class EmployeeRestController extends AdminController
1 => 2,
6 => 3,
7 => 4,
72 => 72,
];
foreach ($policy_type_ids as $value) {

View File

@ -1196,6 +1196,20 @@ class EmployeeServiceController extends AdminController
}
}
// check the employee code if dublicate exist
if(($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment'))
{
$res = check_emp_code_duplication($family, $file);
// dd($res);
if($res['status'])
{
foreach ($res['row_ids'] as $row_id) {
array_push($result['error_summary'],26);
$result['error_data'][ $row_id ]['emp_id']['error'][] = "Employee Code is already exist in the system";
}
}
}
//check self avaialbe either same policy DB level(i.e.) gMC parents
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
{

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

@ -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

@ -76,7 +76,7 @@ class TicketController extends BaseController
$this->ticketMasterModel = new TicketMasterModel();
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI", 8 => "Motor"];
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI", 8 => "Motor", 72 => "OPD"];
$this->priorityType = [
1 => "Low",
2 => "Medium",
@ -287,7 +287,45 @@ class TicketController extends BaseController
13 => ['cancel_remark' => 'Cancel Remark'],
47 => ['cancel_remark' => 'Cancel Remark'],
53 => ['cancel_remark' => 'Cancel Remark'],
58 => ['cancel_remark' => 'Cancel Remark']
58 => ['cancel_remark' => 'Cancel Remark'],
// OPD claim status
67 => ['non_id_reason' => 'Non ID Reason'],
69 => ['raised_date' => 'Raised Date'],
70 => ['raised_date' => 'Raised Date'],
71 => [
'claim_number' => 'Claim Number',
'registration_date' => 'Registration Date'
],
72 => ['query_received_date' => 'Query Received Date'],
73 => [
'denial_reason' => 'Denial Reason',
'denial_date' => 'Denial Date'
],
74 => [
'approved_amount' => 'Approved Amount',
'approved_date' => 'Approved Date',
'approved_letter' => 'Approved Letter',
'approved_description' => 'Approved Description'
],
75 => ['pay_initiate_date' => 'Payment Initiated Date'],
76 => [
'utr_details' => 'UTR Details',
'settled_date' => 'Settled Date',
'settle_letter' => 'Settle Letter'
],
78 => ['cancel_remark' => 'Cancel Remark'],
79 => [
'return_remark' => 'Return Remark',
'awb_no_courier_name' => 'AWB No Courier Name'
],
];
$this->nonIDReason = [
@ -335,7 +373,12 @@ class TicketController extends BaseController
55 => [],
56 => [],
57 => [],
60 => []
60 => [],
68 => [],
77 => [],
80 => [],
81 => [],
];
$this->ticketMasterModel = new TicketMasterModel();
@ -703,7 +746,8 @@ class TicketController extends BaseController
'priorityType' => $this->priorityType,
'relationshipType' => $this->relationshipType,
'modeOFIntimate' => $this->modeOFIntimate,
'nonIDReason' => $this->nonIDReason
'nonIDReason' => $this->nonIDReason,
'claim_ticket_type_id' => $ticket_type
];
switch ($ticket_type) {
@ -719,6 +763,9 @@ class TicketController extends BaseController
case 8:
$data['ticket_form'] = 'Motor';
break;
case 72:
$data['ticket_form'] = 'OPD';
break;
}
// Fetch ACM Users
@ -741,8 +788,9 @@ class TicketController extends BaseController
$claim_status_id = 35;
}else if($ticket_type == 8){
$claim_status_id = 62;
}
else{
}else if($ticket_type == 72){
$claim_status_id = 67;
}else{
$claim_status_id = 1;
}
}
@ -757,7 +805,9 @@ class TicketController extends BaseController
$data['claim_type'] = $this->claimType[2];
}
$data['client_for_motor'] = $this->clientModel->select('id,client_name,phone')->where('client_type', 2)->where('is_active', 1)->findAll();
if($ticket_type == 8){
$data['client_for_motor'] = $this->clientModel->select('id,client_name,phone')->where('client_type', 2)->where('is_active', 1)->findAll();
}
$this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type");
@ -2013,9 +2063,13 @@ class TicketController extends BaseController
}
}
if($lastMatchedStatus == 1){
if($lastMatchedStatus == 1 || $lastMatchedStatus == 67){
if(!empty($incoming_form_values['tpa_no'])){
$lastMatchedStatus = 2;
if($lastMatchedStatus == 1){
$lastMatchedStatus = 2;
}else if($lastMatchedStatus == 67){
$lastMatchedStatus = 68;
}
}
}

View File

@ -514,6 +514,47 @@ if (!function_exists('name_and_empid_check_in_db')) {
}
}
if (!function_exists('check_emp_code_duplication')) {
function check_emp_code_duplication($family_data, $actionArr)
{
$employeeModel = new EmployeeModel();
$row_ids = [];
$status = false;
$client_id = $actionArr['client_id'];
$policy_id = $actionArr['policy_id'];
$client_branch_id = $actionArr['client_branch_id'];
$current_action = $actionArr['action'];
foreach ($family_data as $rkey => $row) {
if ($current_action != 'dependent_addition' || (isset($row['temp']) && $row['temp']['source'] != 'db')) {
$res = $employeeModel
->join('client_policy cp', "employees.client_id = cp.client_id")
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
->where("cp.id", $policy_id)
->where("employees.client_id", $client_id)
->where("employees.client_branch_id", $client_branch_id)
->where("employees.is_active", 1)
->where("employees.emp_status", 'active')
->where("ep.is_active", 1)
->where("ep.status", 'active')
->where('TRIM(emp_code)', trim($row[1]))
->findAll();
if(count($res) > 0){
$row_ids[] = $row[0];
}
}
}
if(!empty($row_ids)){
$status = true;
}
return ['status' => $status, 'row_ids' => $row_ids];
}
}
if (!function_exists('check_dependent_conflict')) {
function check_dependent_conflict($family_data, $policy_terms, $actionArr, $is_lgbtq)
{

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

@ -548,6 +548,11 @@ function fetchFileError(file_id) {
"<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break;
case 26:
file_error_html +=
"<strong>Duplicate Employee code found</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break;
case 100:
hasError14 = true;
error_code = 14;

View File

@ -38,7 +38,7 @@
<!-- Header Section -->
<div class="row mb-3">
<div class="col-6 d-flex align-items-center">
<h4 class="mb-0">Claim GMC</h4>
<h4 class="mb-0"><?= isset($claim_ticket_type_id) && $claim_ticket_type_id == 72 ? 'Claim OPD' : 'Claim GMC' ?></h4>
</div>
<div class="col-6 text-right">
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
@ -49,7 +49,7 @@
<?php } ?>
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="<?= isset($claim_ticket_type_id) && $claim_ticket_type_id == 72 ? 72 : 1 ?>">
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
@ -681,6 +681,29 @@
showClass = '.payment';
}
// OPD
if (value == 69 || value == 70) { // CDA & INFORMATION REQUIRED
showClass = '.cda_ir';
} else if (value == 71) { // UNDER PROCESS - CLAIM NO. UPDATION
showClass = '.up_cnu';
} else if (value == 72) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
showClass = '.up_qdr';
} else if (value == 73) { // REJECTED
showClass = '.rejected';
} else if (value == 74) { // APPROVED
showClass = '.approved';
} else if (value == 76) { // SETTLED
showClass = '.settled';
} else if (value == 78) { // CANCELLED
showClass = '.canceled';
} else if (value == 79) { // RETURNED
showClass = '.returned';
} else if (value == 67) { // NON ID
showClass = '.non_id';
} else if (value == 75) { // PAYMENT INITIATED
showClass = '.payment';
}
// Show the relevant section and enable required attributes
if (showClass) {
// $(showClass).show().find('input, textarea').attr('required', true);
@ -708,7 +731,7 @@
console.log('Selected Value:', selectedVal);
console.log('Element ID:', elementId);
if (selectedVal == 2 || selectedVal == 14) {
if (selectedVal == 2 || selectedVal == 14 || selectedVal == 68 || selectedVal == 79) {
$field = $('#non_id_reason')
$field.prop('required', false);
} else if (selectedVal == 1) {
@ -1134,7 +1157,7 @@
$.each(data, function(index, item) {
// console.log(item);
if (ticket_type == 1 && item.policy_type_id != 1) {
if ((ticket_type == 1 && item.policy_type_id != 1) || (ticket_type == 72 && item.policy_type_id == 72)) {
$('#emp_client_policy').append($('<option>', {
value: item.client_policy_value,
text: item.client_policy_name,

View File

@ -62,7 +62,7 @@
<?php
if (!isset($view_ticket_page)) {
if ($selected_ticket_type == 1) {
if ($selected_ticket_type == 1 || $selected_ticket_type == 72) {
include('ticket_form_gmc.php');
} else if ($selected_ticket_type == 8) {
include('ticket_form_motor.php');
@ -714,6 +714,17 @@
$('#emp_client_policy_data_list').append(option).select2();
}
} else if (ticket_type == 72) {
if (item.policy_type == 72) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#emp_client_policy_data_list').append(option).select2();
}
} else {
// console.log("inside else condition");
}
@ -1119,6 +1130,7 @@
function setMemberData(input) {
var selectedOption = $(input).find(':selected');
var ticket_type_id = $('#ticket_type_id').val();
// Retrieve the data-* attributes
var empId = selectedOption.data('empid');
@ -1140,13 +1152,21 @@
if (tpaNo == "") {
$('#claim_status_id').val(1)
if(ticket_type_id == 1){
$('#claim_status_id').val(1)
}else{
$('#claim_status_id').val(67)
}
$('#non_id_reason').attr('required', true);
var $label = $("#non_id_reason_lable_id");
$label.text('*');
} else {
$('#claim_status_id').val(2)
if(ticket_type_id == 1){
$('#claim_status_id').val(2)
}else{
$('#claim_status_id').val(68)
}
$('#non_id_reason').attr('required', false);
var $label = $("#non_id_reason_lable_id");
$label.text("");

View File

@ -29,6 +29,7 @@
<option value="3">EDLI</option>
<option value="4">GTLI</option>
<option value="8">Motor</option>
<option value="72">OPD</option>
</select>
</div>
</div>

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 -->