Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2026-05-11 09:49:43 +05:30
commit 0fdc656df3
9 changed files with 63 additions and 36 deletions

View File

@ -3785,6 +3785,14 @@ class EmployeeRestController extends AdminController
$this->handleCliamFiles($file_data, $ticket_id, $ticket_message_id);
// Merge all uploaded PDFs for this ticket into a single combined PDF
try {
helper('merge_pdf');
merge_ticket_pdfs((int) $ticket_id);
} catch (\Throwable $e) {
log_message('error', 'EmployeeRestController::initiateClaim | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
}
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
if (gettype($mail_sent_status) == 'array') {
$message = 'Claim Iniated Successfully';
@ -3923,16 +3931,6 @@ class EmployeeRestController extends AdminController
}
}
// Merge all uploaded PDFs for this ticket into a single combined PDF
if ($pdf_exist_in_the_file) {
try {
helper('merge_pdf');
merge_ticket_pdfs((int) $ticket_id);
} catch (\Throwable $e) {
log_message('error', 'EmployeeRestController::handleCliamFiles | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
}
}
$count = $this->ticketMaster->where('id', $ticket_id)->where('is_active', 1)->where('tpa_claim_push_reference_no IS NULL')->countAllResults();
log_message('error', 'Ticket validation | Ticket ID: ' . $ticket_id . ' | Matching active tickets with NULL TPA reference: ' . $count);
if ($count > 0 && $pdf_exist_in_the_file && $tpa_claim_push == true) {
@ -5454,6 +5452,14 @@ class EmployeeRestController extends AdminController
$result = $this->handleCliamFiles($file_data, $ticket_id, null, false, true);
if (! empty($result)) {
// Merge all uploaded PDFs for this ticket into a single combined PDF
try {
helper('merge_pdf');
merge_ticket_pdfs((int) $ticket_id);
} catch (\Throwable $e) {
log_message('error', 'EmployeeRestController::uploadIRDocs | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
}
// $this->ticketMaster->where('id', $ticket_id)->set(['required_docs', $required_docs])->update();
db_connect()->query(
"UPDATE ticket_master SET required_docs = ? WHERE id = ?",

View File

@ -92,7 +92,7 @@ class FhplApiController extends BaseController
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type='application/pdf'", 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
->where('tm.id', $claimId)
->get()
->getRowArray();

View File

@ -113,7 +113,7 @@ class HealthIndiaApiController extends BaseController
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type='application/pdf'", 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
->where('tm.id', $claimId)
->get()
->getRowArray();

View File

@ -67,7 +67,7 @@ class MediAssistApiController extends BaseController
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 and cf.mime_type = 'application/pdf'", 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
->where('tm.id', $claimId)
->get()
->getRowArray(); // single record

View File

@ -2066,16 +2066,6 @@ class TicketController extends BaseController
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
if ($return_value) {
// Merge all uploaded PDFs for this ticket into a single combined PDF
try {
helper('merge_pdf');
merge_ticket_pdfs((int) $ticket_id, [
'ticket_type' => (int) ($ticket_data['ticket_type_id'] ?? 1),
]);
} catch (\Throwable $e) {
log_message('error', 'TicketController::updateTicket | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
}
$mail_responce = null;
if($old_ticket_data['claim_status_id'] != $ticket_data['claim_status_id']){
//mail trigger part
@ -2413,7 +2403,7 @@ class TicketController extends BaseController
$claimFiles = new ClaimFilesModel();
$file_record = $claimFiles->where('id', $claim_file_id)->where('is_active', 1)->first();
if ($file_record === null || (int) ($file_record['file_type'] ?? 0) !== 2) {
if ($file_record === null || ! in_array((int) ($file_record['file_type'] ?? 0), [2, 4], true)) {
throw PageNotFoundException::forPageNotFound();
}
@ -3687,6 +3677,13 @@ class TicketController extends BaseController
$employeeRest = new EmployeeRestController();
$result = $employeeRest->handleCliamFiles($file_data, $ticket_id);
if(!empty($result)){
// Merge all uploaded PDFs for this ticket into a single combined PDF
try {
helper('merge_pdf');
merge_ticket_pdfs((int) $ticket_id);
} catch (\Throwable $e) {
log_message('error', 'TicketController::upload_url | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
}
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
}else{
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
@ -3714,7 +3711,7 @@ class TicketController extends BaseController
->select("
*,
CASE
WHEN file_type = 2 AND url IS NOT NULL AND url != ''
WHEN file_type IN (2, 4) AND url IS NOT NULL AND url != ''
THEN CONCAT('" . base_url('downloadClaimFile/') . "', id)
ELSE url
END AS url

View File

@ -168,7 +168,7 @@ class VidalApiController extends BaseController
->join('policy_type pt', 'pt.id = cp.policy_type_id', 'left')
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.client_policy_id = cp.id', 'left')
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 and cf.mime_type = 'application/pdf'", 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
->where('tm.id', $claimId)
->get()
->getRowArray(); // single record

View File

@ -696,7 +696,7 @@ class VoloApiController extends BaseController
cf.url as filePath
')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type = 'application/pdf'", 'left')
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
->where('tm.id', $claimId)
->get()
->getRowArray();

View File

@ -185,6 +185,27 @@
<?php if(in_array(get_role_id(), [1,2,3,4,5]) || (in_array(ENROLLMENT_TEAM_ID, user_team()) || in_array(CLAIMS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<?php
// Exactly one tab-pane must be active initially; claims_dash/leads_dash used to each set
// $isActive so dual-team staff saw both panes (Bootstrap shows every .active pane).
$dash_show_pending_nav = in_array(get_role_id(), [1, 2, 3, 5]);
$dash_show_claims_nav = (get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID, user_team())) || in_array(get_role_id(), [1, 5]);
$dash_show_leads_nav = (get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_team())) || in_array(get_role_id(), [1, 5]);
$dash_default_pane = null;
if ($dash_show_pending_nav) {
$dash_default_pane = 'pending';
} elseif ($dash_show_claims_nav) {
$dash_default_pane = 'claims';
} elseif ($dash_show_leads_nav) {
$dash_default_pane = 'leads';
}
$dash_pending_pane_active = ($dash_default_pane === 'pending') ? 'active show' : '';
$dash_claims_pane_active = ($dash_default_pane === 'claims') ? 'active show' : '';
$dash_leads_pane_active = ($dash_default_pane === 'leads') ? 'active show' : '';
?>
<!-- <div class="row" id="client_add"> -->
<div class="row" id="client_add" style="margin-top:12px!important">
<div class="col-12">
@ -222,9 +243,6 @@
<?php } ?>
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
<?php
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team()) ? 'active show' : '';
?>
<li class="nav-item d-flex justify-content-center align-items-center">
<a href="#claims-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1 dash-anchor nav-dash" id="claims_tab">
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_claims.png" alt="Logo" height="14" class="inactive_claims">
@ -237,9 +255,9 @@
&nbsp;&nbsp;&nbsp;&nbsp;
<?php endif; ?>
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
<?php
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'active show' : '';
?>
<!-- <?php
// $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'active show' : '';
?> -->
<li class="nav-item d-flex justify-content-center align-items-center ">
<a href="#leads-dash-tab " data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1 dash-anchor nav-dash" id="leads_tab" >
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_leads_and_bds_renewal.png" alt="Logo" height="14" class="inactive_leads">

View File

@ -475,13 +475,19 @@
}
}
function claimFileIsLocalUpload(item) {
// file_type 2 = uploaded claim doc, 4 = merged combined PDF (both stored on disk)
return item.file_type == 2 || item.file_type === '2'
|| item.file_type == 4 || item.file_type === '4';
}
function claimFileViewSupported(item) {
var mime = String(item.mime_type || '').toLowerCase();
if (mime === 'application/pdf' || mime === 'image/png' || mime === 'image/jpeg') {
return true;
}
var ext = '';
if (item.file_type == 2 || item.file_type === '2') {
if (claimFileIsLocalUpload(item)) {
ext = claimFileListExtension(item.file_name) || claimFileListExtension(item.doc_name);
} else {
ext = claimFileListExtensionFromUrl(item.url);
@ -493,14 +499,14 @@
}
function claimFileViewOpenUrl(item, base_url) {
if (item.file_type == 2 || item.file_type === '2') {
if (claimFileIsLocalUpload(item)) {
return base_url + 'viewClaimFile/' + encodeURIComponent(item.id);
}
return String(item.url || '');
}
function claimFileDownloadOpenUrl(item, base_url) {
if (item.file_type == 2 || item.file_type === '2') {
if (claimFileIsLocalUpload(item)) {
return base_url + 'downloadClaimFile/' + encodeURIComponent(item.id);
}
return String(item.url || '');