984 lines
46 KiB
PHP
984 lines
46 KiB
PHP
<style>
|
|
.table th,
|
|
.table td {
|
|
padding: 8px;
|
|
}
|
|
|
|
table.dataTable tbody td {
|
|
padding: 4px 4px !important;
|
|
}
|
|
|
|
.col-12 {
|
|
|
|
max-width: 98% !important;
|
|
}
|
|
|
|
.dataTables_filter {
|
|
position: absolute;
|
|
}
|
|
|
|
.right-align-input {
|
|
text-align: right;
|
|
}
|
|
|
|
.addbtnStyle {
|
|
margin-left: 20px !important;
|
|
}
|
|
.dataTables_length label {height: 21px !important;}
|
|
.text-custom-grey{
|
|
font-size: 0.65em;
|
|
color: #6c757d !important;
|
|
}
|
|
|
|
.emp-name-cell {
|
|
font-weight: 500;
|
|
}
|
|
|
|
.tpa-id-truncate {
|
|
cursor: default;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.policy-type-icon {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
margin-right: 6px;
|
|
font-size: 0.95rem;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.policy-type-icon--cashless {
|
|
color: #0ea5e9;
|
|
}
|
|
|
|
.policy-type-icon--reimbursement {
|
|
color: #f59e0b;
|
|
}
|
|
|
|
/* Claim source pill — text only, fixed width (DUMP_TPA); hidden when no value */
|
|
.claim-source-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-sizing: border-box;
|
|
padding: 0 4px;
|
|
border-radius: 999px;
|
|
font-size: 0.52rem;
|
|
font-weight: 600;
|
|
line-height: 1.3;
|
|
white-space: nowrap;
|
|
text-align: center;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
width: 8.75em;
|
|
min-width: 8.75em;
|
|
max-width: 8.75em;
|
|
}
|
|
.claim-source-badge--tpa {
|
|
background: #d1fae5;
|
|
color: #047857;
|
|
}
|
|
.claim-source-badge--user {
|
|
background: #dbeafe;
|
|
color: #1d4ed8;
|
|
}
|
|
.claim-source-badge--dump-tpa {
|
|
background: #ede9fe;
|
|
color: #6d28d9;
|
|
}
|
|
.claim-source-badge--dump {
|
|
background: #ffedd5;
|
|
color: #c2410c;
|
|
}
|
|
.claim-source-badge--crm {
|
|
background: #fce7f3;
|
|
color: #9d174d;
|
|
}
|
|
|
|
.tpa-push-status-item {
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
cursor: default;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
#scroll-horizontal-datatable_wrapper .dt-buttons {
|
|
position: relative;
|
|
}
|
|
|
|
#scroll-horizontal-datatable_wrapper .dt-button-collection {
|
|
z-index: 9999 !important;
|
|
}
|
|
|
|
#scroll-horizontal-datatable_wrapper .ticket-backend-export-menu {
|
|
display: none;
|
|
background: #00999E;
|
|
border: 1px solid #00999E;
|
|
border-radius: .25rem;
|
|
box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
|
|
padding: .25rem 0;
|
|
}
|
|
|
|
#scroll-horizontal-datatable_wrapper .ticket-backend-export-menu .dropdown-item {
|
|
display: block;
|
|
width: 100%;
|
|
padding: .4rem .9rem;
|
|
clear: both;
|
|
color: #fff;
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
#scroll-horizontal-datatable_wrapper .ticket-backend-export-menu .dropdown-item:hover {
|
|
background-color: #007A7E;
|
|
color: #fff;
|
|
}
|
|
|
|
</style>
|
|
<style>
|
|
.table th:nth-child(1),
|
|
.table td:nth-child(1) {
|
|
max-width: 200px !important;
|
|
min-width: 100px !important;
|
|
overflow: hidden !important;
|
|
text-overflow: ellipsis !important;
|
|
white-space: nowrap !important;
|
|
}
|
|
|
|
#scroll-horizontal-datatable tbody tr:hover {
|
|
background-color: #e0e0e0;
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<!-- <div class="row" style="padding-bottom: 10px;">
|
|
<div class="col-6" style="align-self: center;">
|
|
<h4 style="position: relative;">Claim List </h4>
|
|
</div>
|
|
|
|
</div> -->
|
|
<div class="table-responsive">
|
|
<table data-custom-table-css="table" class="table mb-0 nowrap w-100 table-centered" cellspacing="0" id="scroll-horizontal-datatable">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th>Status </th>
|
|
<th>Policy Type </th>
|
|
<th>Claim number </th>
|
|
<th>TPA ID </th>
|
|
<th>Emp Name </th>
|
|
<th>Insured Name </th>
|
|
<th>Corporate name </th>
|
|
<th>Claim Type </th>
|
|
|
|
<th style="display: none;">ACM</th>
|
|
<th style="display: none;">Insurer</th>
|
|
<th style="display: none;">TPA</th>
|
|
<th style="display: none;">Policy No</th>
|
|
<th style="display: none;">Priority</th>
|
|
<th style="display: none;">Relationship</th>
|
|
<th style="display: none;">Emp Mobile</th>
|
|
<th style="display: none;">Emp Email</th>
|
|
<th style="display: none;">Emp Personal Email</th>
|
|
<th style="display: none;">Mode of Intimation</th>
|
|
<th style="display: none;">Hospital Name</th>
|
|
<th style="display: none;">DOA</th>
|
|
<th style="display: none;">DOD</th>
|
|
<th style="display: none;">Claim Amount</th>
|
|
<th style="display: none;">POD No.</th>
|
|
<th style="display: none;">Date of Join</th>
|
|
<th style="display: none;">Date of Inception</th>
|
|
<th style="display: none;">DOB</th>
|
|
<th style="display: none;">Date of Accident</th>
|
|
<th style="display: none;">Date of Death</th>
|
|
<th style="display: none;">Date of Intimate</th>
|
|
<th style="display: none;">Sum Insured</th>
|
|
<th style="display: none;">Raised Date</th>
|
|
<th style="display: none;">Registration Date</th>
|
|
<th style="display: none;">Query Received Date</th>
|
|
<th style="display: none;">Denial Date</th>
|
|
<th style="display: none;">Approved Date</th>
|
|
<th style="display: none;">Settled Date</th>
|
|
<th style="display: none;">Denial Reason</th>
|
|
<th style="display: none;">Approved Letter</th>
|
|
<th style="display: none;">Approved Amount</th>
|
|
<th style="display: none;">UTR Details</th>
|
|
<th style="display: none;">Settle Letter</th>
|
|
<th style="display: none;">Return Remark</th>
|
|
<th style="display: none;">Cancel Remark</th>
|
|
<th style="display: none;">AWB No. and Courier Name</th>
|
|
<th style="display: none;">Non ID Reason</th>
|
|
<th style="display: none;">Payment Initiate Date</th>
|
|
<th style="display: none;">Approved Description</th>
|
|
|
|
|
|
<th>TAT</th>
|
|
|
|
<!-- role based delete option -->
|
|
<?php if(in_array(get_role_id(), [1,2,5]) ) { ?>
|
|
<th>ACTION</th>
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (isset($ticket_data)) { ?>
|
|
<?php foreach($ticket_data as $index => $row){ ?>
|
|
<tr data-id="<?= $row['id']; ?>" style="cursor: pointer;">
|
|
|
|
<td data-toggle="tooltip" data-placement="top"
|
|
|
|
|
|
title=" <?php
|
|
if ($row['claim_status_id'] == 8) {
|
|
if ($row['is_head_approved'] == 0) {
|
|
echo 'Waiting for approvel';
|
|
} elseif ($row['is_head_approved'] == 1) {
|
|
echo 'Rejection approved';
|
|
} elseif ($row['is_head_approved'] == 2) {
|
|
echo 'Rejection not approved';
|
|
} else {
|
|
echo $row['status'];
|
|
}
|
|
} else {
|
|
echo $row['status'];
|
|
}
|
|
?>">
|
|
|
|
|
|
<span class="status-tooltip">
|
|
<?php
|
|
if (in_array($row['claim_status_id'],[8,23,33,43])) {
|
|
if ($row['is_head_approved'] == 0) {
|
|
echo $row['status'] . ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
|
} elseif ($row['is_head_approved'] == 1) {
|
|
echo $row['status'] . ' <i class="mdi mdi-check-circle" style="color:green;" aria-hidden="true"></i>';
|
|
} elseif ($row['is_head_approved'] == 2) {
|
|
echo $row['status'] . ' <i class="mdi mdi-close-circle-outline" style="color:red;" aria-hidden="true"></i>';
|
|
} else {
|
|
echo $row['status'];
|
|
}
|
|
} else {
|
|
echo $row['status'];
|
|
}
|
|
?>
|
|
</span>
|
|
<?php if (!empty($row['ticket_updated_date'])): ?>
|
|
<span class="text-custom-grey"><br><?= "Updated at ".$row['ticket_updated_date']; ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
|
|
<td><?php
|
|
$claimSrc = $row['claim_created_by'] ?? '';
|
|
$claimSrcClassMap = [
|
|
'TPA' => 'claim-source-badge--tpa',
|
|
'USER' => 'claim-source-badge--user',
|
|
'DUMP_TPA' => 'claim-source-badge--dump-tpa',
|
|
'DUMP' => 'claim-source-badge--dump',
|
|
'CRM' => 'claim-source-badge--crm',
|
|
];
|
|
$claimSrcClass = $claimSrcClassMap[$claimSrc] ?? null;
|
|
$policyTypeLabel = str_replace('Claim-', '', $ticket_type[$row['ticket_type_id']] ?? 'N/A');
|
|
// $tpaClaimTypeRaw = trim((string)($row['tpa_claim_type'] ?? ''));
|
|
// $tpaClaimType = strtolower($tpaClaimTypeRaw);
|
|
// $policyTypeIconHtml = '';
|
|
|
|
// if ($tpaClaimType !== '') {
|
|
// if (strpos($tpaClaimType, 'cash') !== false) {
|
|
// $policyTypeIconHtml = '<span class="policy-type-icon policy-type-icon--cashless" title="Cashless"><i class="mdi mdi-hospital-box-outline" aria-hidden="true"></i></span>';
|
|
// } elseif (strpos($tpaClaimType, 'reimburse') !== false) {
|
|
// $policyTypeIconHtml = '<span class="policy-type-icon policy-type-icon--reimbursement" title="Reimbursement"><i class="mdi mdi-cash-refund" aria-hidden="true"></i></span>';
|
|
// }
|
|
// }
|
|
|
|
// echo $policyTypeIconHtml . esc($policyTypeLabel);
|
|
echo esc($policyTypeLabel);
|
|
if ($claimSrcClass !== null) {
|
|
echo '<br><span class="claim-source-badge ' . esc($claimSrcClass, 'attr') . '">' . esc($claimSrc == "CRM" ? "STAFF" : $claimSrc) . '</span>';
|
|
}
|
|
?></td>
|
|
<td><?php echo $row['claim_no'] ?: 'N/A' ; ?>
|
|
<?php if (!empty($row['ticket_created_date'])): ?>
|
|
<span class="text-custom-grey"><br><?= "Created at ".$row['ticket_created_date']; ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?php
|
|
$tpaNo = $row['tpa_no'] ?: 'N/A';
|
|
$tpaNoMaxLen = 10;
|
|
if ($tpaNo !== 'N/A' && strlen($tpaNo) > $tpaNoMaxLen) {
|
|
echo '<span class="tpa-id-truncate" data-toggle="tooltip" data-placement="top" title="' . esc($tpaNo, 'attr') . '">' . esc(substr($tpaNo, 0, $tpaNoMaxLen) . '...') . '</span>';
|
|
} else {
|
|
echo esc($tpaNo);
|
|
}
|
|
?></td>
|
|
<td class="emp-name-cell"><?php echo $row['emp_name'] ?: 'N/A'; ?>
|
|
<span class="text-custom-grey"><br><?php echo $row['emp_code'] ?: 'N/A'; ?></span>
|
|
</td>
|
|
<td><?php echo $row['insured_name'] ?: 'N/A'; ?></td>
|
|
<td><?php echo $row['short_name'] ?: 'N/A'; ?></td>
|
|
<td class="emp-name-cell"><?php
|
|
$typeId = $row['ticket_type_id'] ?? 0;
|
|
$claimKey = $row['claim_type'] ?? '';
|
|
if ($typeId == 1) {
|
|
echo isset($claimType[1][$claimKey]) ? $claimType[1][$claimKey] : 'N/A';
|
|
} else {
|
|
echo isset($claimType[2][$claimKey]) ? $claimType[2][$claimKey] : 'N/A';
|
|
}
|
|
?>
|
|
<span class="text-custom-grey"><br><?php echo !empty($row['tpa_claim_type']) ? esc($row['tpa_claim_type']) : 'N/A'; ?></span>
|
|
</td>
|
|
|
|
<td style="display: none;"><?php echo $row['acm_name']; ?></td>
|
|
<td style="display: none;"><?php echo $row['insurer_name']; ?></td>
|
|
<td style="display: none;"><?php echo $row['tpa_name']; ?></td>
|
|
<td style="display: none;"><?php echo $row['policy_no']; ?></td>
|
|
<td style="display: none;"><?php echo ($priorityType ?? [])[$row['priority'] ?? 0] ?? ''; ?></td>
|
|
<td style="display: none;"><?php echo $row['relationship']; ?></td>
|
|
<td style="display: none;"><?php echo $row['emp_mobile']; ?></td>
|
|
<td style="display: none;"><?php echo $row['emp_mail']; ?></td>
|
|
<td style="display: none;"><?php echo $row['emp_personal_mail']; ?></td>
|
|
<td style="display: none;"><?php echo ($modeOFIntimate ?? [])[$row['mode_of_intimation'] ?? ''] ?? ''; ?></td>
|
|
<td style="display: none;"><?php echo $row['hospital_name']; ?></td>
|
|
<td style="display: none;"><?php echo change_date_format($row['doa'], null, 'd-m-Y'); ?></td>
|
|
<td style="display: none;"><?php echo $row['dod']; ?></td>
|
|
<td style="display: none;"><?php echo $row['claim_amount']; ?></td>
|
|
<td style="display: none;"><?php echo $row['pod_no']; ?></td>
|
|
<td style="display: none;"><?php echo $row['date_of_join']; ?></td>
|
|
<td style="display: none;"><?php echo $row['date_of_incep']; ?></td>
|
|
<td style="display: none;"><?php echo $row['dob']; ?></td>
|
|
<td style="display: none;"><?php echo $row['date_of_accident']; ?></td>
|
|
<td style="display: none;"><?php echo $row['date_of_death']; ?></td>
|
|
<td style="display: none;"><?php echo $row['date_of_intimat']; ?></td>
|
|
<td style="display: none;"><?php echo $row['si_amt']; ?></td>
|
|
<td style="display: none;"><?php echo $row['raised_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['registration_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['query_received_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['denial_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['approved_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['settled_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['denial_reason']; ?></td>
|
|
<td style="display: none;"><?php echo $row['approved_letter']; ?></td>
|
|
<td style="display: none;"><?php echo $row['approved_amount']; ?></td>
|
|
<td style="display: none;"><?php echo $row['utr_details']; ?></td>
|
|
<td style="display: none;"><?php echo $row['settle_letter']; ?></td>
|
|
<td style="display: none;"><?php echo $row['return_remark']; ?></td>
|
|
<td style="display: none;"><?php echo $row['cancel_remark']; ?></td>
|
|
<td style="display: none;"><?php echo $row['awb_no_courier_name']; ?></td>
|
|
<td style="display: none;"><?php echo $row['non_id_reason']; ?></td>
|
|
<td style="display: none;"><?php echo $row['pay_initiate_date']; ?></td>
|
|
<td style="display: none;"><?php echo $row['approved_description']; ?></td>
|
|
|
|
|
|
<td><?php echo $row['tat']; ?></td>
|
|
|
|
<!-- role based delete option -->
|
|
<?php if(in_array(get_role_id(), [1,2,5]) ) { ?>
|
|
<td>
|
|
<div class="btn-group dropdown">
|
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
|
<div class="dropdown-menu dropdown-menu-right">
|
|
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removeClaim(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
|
</a>
|
|
<a class="dropdown-item" href="javascript:void(0);" onclick="showTpaClaimPushLogs(event, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
|
<i class="mdi mdi-text-box-search-outline mr-2 text-muted font-18 vertical-middle"></i>TPA Push Logs
|
|
</a>
|
|
<?php $tpaPushSuccess = !empty($row['tpa_claim_push_reference_no']); ?>
|
|
<span class="dropdown-item-text tpa-push-status-item px-3 py-2 <?= $tpaPushSuccess ? 'text-success' : 'text-danger' ?>">
|
|
TPA PUSH : <?= $tpaPushSuccess ? 'Success.' : 'Failed.' ?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div>
|
|
</div>
|
|
</div>
|
|
</div><!-- end col -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-------------------------------------------------------------------------------------------------->
|
|
|
|
<script>
|
|
window.ticketTableInstance = window.ticketTableInstance || null;
|
|
window.ticketTableIsDeleteEnabled = <?= in_array(get_role_id(), [1,2,5]) ? 'true' : 'false'; ?>;
|
|
window.ticketTypeMap = <?= json_encode($ticket_type ?? []); ?>;
|
|
window.priorityTypeMap = <?= json_encode($priorityType ?? []); ?>;
|
|
window.modeOfIntimateMap = <?= json_encode($modeOFIntimate ?? []); ?>;
|
|
window.claimTypeMap = <?= json_encode($claimType ?? []); ?>;
|
|
|
|
function escapeHtml(value) {
|
|
if (value === null || value === undefined) return '';
|
|
return String(value)
|
|
.replace(/&/g, '&')
|
|
.replace(/</g, '<')
|
|
.replace(/>/g, '>')
|
|
.replace(/"/g, '"')
|
|
.replace(/'/g, ''');
|
|
}
|
|
|
|
function asText(value) {
|
|
if (value === null || value === undefined || value === '') return 'N/A';
|
|
return escapeHtml(value);
|
|
}
|
|
|
|
function getTruncatedTpaIdHtml(tpaNo) {
|
|
var value = (tpaNo === null || tpaNo === undefined || tpaNo === '') ? 'N/A' : String(tpaNo);
|
|
var maxLen = 10;
|
|
if (value === 'N/A' || value.length <= maxLen) {
|
|
return escapeHtml(value);
|
|
}
|
|
return '<span class="tpa-id-truncate" data-toggle="tooltip" data-placement="top" title="' + escapeHtml(value) + '">' +
|
|
escapeHtml(value.substring(0, maxLen) + '...') +
|
|
'</span>';
|
|
}
|
|
|
|
function getClaimTypeLabel(row) {
|
|
var typeId = Number(row.ticket_type_id || 0);
|
|
var claimKey = row.claim_type || '';
|
|
if (!window.claimTypeMap[typeId]) return '';
|
|
return window.claimTypeMap[typeId][claimKey] || '';
|
|
}
|
|
|
|
function getClaimSourceBadgeHtml(claimCreatedBy) {
|
|
var map = {
|
|
'TPA': 'claim-source-badge--tpa',
|
|
'USER': 'claim-source-badge--user',
|
|
'DUMP_TPA': 'claim-source-badge--dump-tpa',
|
|
'DUMP': 'claim-source-badge--dump',
|
|
'CRM': 'claim-source-badge--crm'
|
|
};
|
|
var key = claimCreatedBy || '';
|
|
var cls = map[key];
|
|
if (!cls) {
|
|
return '';
|
|
}
|
|
var label = key === 'CRM' ? 'STAFF' : key;
|
|
return '<span class="claim-source-badge ' + cls + '">' + escapeHtml(label) + '</span>';
|
|
}
|
|
|
|
function getPolicyTypeIconHtml(tpaClaimType) {
|
|
var type = (tpaClaimType || '').toString().trim().toLowerCase();
|
|
if (!type) return '';
|
|
if (type.indexOf('cash') !== -1) {
|
|
return '<span class="policy-type-icon policy-type-icon--cashless" title="Cashless"><i class="mdi mdi-hospital-box-outline" aria-hidden="true"></i></span>';
|
|
}
|
|
if (type.indexOf('reimburse') !== -1) {
|
|
return '<span class="policy-type-icon policy-type-icon--reimbursement" title="Reimbursement"><i class="mdi mdi-cash-refund" aria-hidden="true"></i></span>';
|
|
}
|
|
return '';
|
|
}
|
|
|
|
function getStatusDisplay(row) {
|
|
var status = row.status || '';
|
|
var claimStatusId = Number(row.claim_status_id || 0);
|
|
var approved = Number(row.is_head_approved);
|
|
var statusesWithIcon = [8, 23, 33, 43];
|
|
|
|
if (statusesWithIcon.indexOf(claimStatusId) !== -1) {
|
|
if (approved === 0) return escapeHtml(status) + ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
|
if (approved === 1) return escapeHtml(status) + ' <i class="mdi mdi-check-circle" style="color:green;" aria-hidden="true"></i>';
|
|
if (approved === 2) return escapeHtml(status) + ' <i class="mdi mdi-close-circle-outline" style="color:red;" aria-hidden="true"></i>';
|
|
}
|
|
|
|
return escapeHtml(status);
|
|
}
|
|
|
|
function getStatusTooltip(row) {
|
|
var status = row.status || '';
|
|
if (Number(row.claim_status_id) === 8) {
|
|
if (Number(row.is_head_approved) === 0) return 'Waiting for approvel';
|
|
if (Number(row.is_head_approved) === 1) return 'Rejection approved';
|
|
if (Number(row.is_head_approved) === 2) return 'Rejection not approved';
|
|
}
|
|
return status;
|
|
}
|
|
|
|
function getTpaPushStatusMenuItem(row) {
|
|
var ref = row.tpa_claim_push_reference_no;
|
|
var isSuccess = ref !== null && ref !== undefined && String(ref).trim() !== '';
|
|
var statusClass = isSuccess ? 'text-success' : 'text-danger';
|
|
var statusLabel = isSuccess ? 'TPA PUSH : Success.' : 'TPA PUSH : Failed.';
|
|
return '<span class="dropdown-item-text tpa-push-status-item px-3 py-2 ' + statusClass + '">' + escapeHtml(statusLabel) + '</span>';
|
|
}
|
|
|
|
function getActionCell(row) {
|
|
if (!window.ticketTableIsDeleteEnabled) return '';
|
|
var id = escapeHtml(row.id || '');
|
|
return '' +
|
|
'<td>' +
|
|
' <div class="btn-group dropdown">' +
|
|
' <a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>' +
|
|
' <div class="dropdown-menu dropdown-menu-right">' +
|
|
' <a class="dropdown-item delete" data-id="' + id + '" onclick="removeClaim(this, \'' + id + '\')">' +
|
|
' <i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete' +
|
|
' </a>' +
|
|
' <a class="dropdown-item" href="javascript:void(0);" onclick="showTpaClaimPushLogs(event, \'' + id + '\')">' +
|
|
' <i class="mdi mdi-text-box-search-outline mr-2 text-muted font-18 vertical-middle"></i>TPA Push Logs' +
|
|
' </a>' +
|
|
getTpaPushStatusMenuItem(row) +
|
|
' </div>' +
|
|
' </div>' +
|
|
'</td>';
|
|
}
|
|
|
|
function buildTicketRowHtml(row) {
|
|
var statusUpdated = row.ticket_updated_date ? '<span class="text-custom-grey"><br>Updated at ' + escapeHtml(row.ticket_updated_date) + '</span>' : '';
|
|
var claimCreated = row.ticket_created_date ? '<span class="text-custom-grey"><br>Created at ' + escapeHtml(row.ticket_created_date) + '</span>' : '';
|
|
var policyType = (window.ticketTypeMap[row.ticket_type_id] || '').replace('Claim-', '');
|
|
// var policyTypeIcon = getPolicyTypeIconHtml(row.tpa_claim_type);
|
|
var claimSourceBadge = getClaimSourceBadgeHtml(row.claim_created_by);
|
|
var modeOfIntimation = window.modeOfIntimateMap[row.mode_of_intimation] || '';
|
|
var priority = window.priorityTypeMap[row.priority || 0] || '';
|
|
|
|
return '' +
|
|
'<tr data-id="' + escapeHtml(row.id) + '" style="cursor: pointer;">' +
|
|
'<td data-toggle="tooltip" data-placement="top" title="' + escapeHtml(getStatusTooltip(row)) + '">' +
|
|
'<span class="status-tooltip">' + getStatusDisplay(row) + '</span>' +
|
|
statusUpdated +
|
|
'</td>' +
|
|
// '<td>' + policyTypeIcon + asText(policyType) + (claimSourceBadge ? '<br>' + claimSourceBadge : '') + '</td>' +
|
|
'<td>' + asText(policyType) + (claimSourceBadge ? '<br>' + claimSourceBadge : '') + '</td>' +
|
|
'<td>' + asText(row.claim_no) + claimCreated + '</td>' +
|
|
'<td>' + getTruncatedTpaIdHtml(row.tpa_no) + '</td>' +
|
|
'<td class="emp-name-cell">' + asText(row.emp_name) + '<span class="text-custom-grey"><br>' + asText(row.emp_code) + '</span></td>' +
|
|
'<td>' + asText(row.insured_name) + '</td>' +
|
|
'<td>' + asText(row.short_name) + '</td>' +
|
|
'<td class="emp-name-cell">' + asText(getClaimTypeLabel(row)) + '<span class="text-custom-grey"><br>' + asText(row.tpa_claim_type) + '</span></td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.acm_name || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.insurer_name || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.tpa_name || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.policy_no || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(priority) + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.relationship || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.emp_mobile || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.emp_mail || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.emp_personal_mail || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(modeOfIntimation) + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.hospital_name || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.doa || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.dod || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.claim_amount || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.pod_no || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.date_of_join || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.date_of_incep || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.dob || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.date_of_accident || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.date_of_death || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.date_of_intimat || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.si_amt || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.raised_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.registration_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.query_received_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.denial_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.approved_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.settled_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.denial_reason || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.approved_letter || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.approved_amount || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.utr_details || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.settle_letter || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.return_remark || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.cancel_remark || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.awb_no_courier_name || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.non_id_reason || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.pay_initiate_date || '') + '</td>' +
|
|
'<td style="display: none;">' + escapeHtml(row.approved_description || '') + '</td>' +
|
|
'<td>' + escapeHtml(row.tat || '') + '</td>' +
|
|
getActionCell(row) +
|
|
'</tr>';
|
|
}
|
|
|
|
function applyTicketRows(rows) {
|
|
var table = $('#scroll-horizontal-datatable');
|
|
var tbody = table.find('tbody');
|
|
var html = '';
|
|
|
|
(rows || []).forEach(function (row) {
|
|
html += buildTicketRowHtml(row);
|
|
});
|
|
|
|
if (window.ticketTableInstance) {
|
|
window.ticketTableInstance.clear();
|
|
tbody.html(html);
|
|
window.ticketTableInstance.rows.add(tbody.find('tr')).draw(false);
|
|
window.ticketTableInstance.columns.adjust();
|
|
} else {
|
|
tbody.html(html);
|
|
}
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
}
|
|
|
|
window.updateTicketTableRows = applyTicketRows;
|
|
|
|
$(document).ready(function() {
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
});
|
|
|
|
// Datatable document ready
|
|
$(document).ready(function() {
|
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
|
|
|
if (ticketsTable.length && !window.ticketTableInstance) {
|
|
window.ticketTableInstance = ticketsTable.DataTable({
|
|
scrollX: true,
|
|
// dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
|
// "<'row'<'col-sm-12'tr>>" +
|
|
// "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
|
// buttons: [{
|
|
// extend: 'csv',
|
|
// text: 'CSV',
|
|
// title: 'Claim-List',
|
|
// },
|
|
// {
|
|
// extend: 'excel',
|
|
// text: 'Excel',
|
|
// title: 'claim-List',
|
|
// exportOptions: {
|
|
// orthogonal: 'sort'
|
|
// },
|
|
// },
|
|
// {
|
|
// text: 'New Claim',
|
|
// className: 'buttons-html5 addbtnStyle',
|
|
// action: function(e, dt, node, config) {
|
|
// openTicketTypeAskModal()
|
|
// }
|
|
// }
|
|
// ],
|
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
|
"<'row'<'col-sm-12'tr>>" +
|
|
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
|
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
|
buttons: [
|
|
{
|
|
text: '<i class="mdi mdi-filter" ></i><span class=" btn-custom"> Filter </span>',
|
|
className: 'btn app-btn-primary mr-2',
|
|
action: function(e, dt, node, config) {
|
|
openTicketFilterNav();
|
|
}
|
|
},
|
|
{
|
|
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
|
className: 'btn app-btn-primary mr-2',
|
|
action: function(e, dt, node, config) {
|
|
openTicketTypeAskModal()
|
|
}
|
|
},
|
|
{
|
|
text: '<span class="btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
|
className: 'btn app-btn-secondary ticket-backend-export-btn',
|
|
name: 'ticketBackendExport',
|
|
action: function(e, dt, node, config) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
var $btn = $(node);
|
|
var $wrap = $btn.closest('.dt-buttons');
|
|
var $menu = $wrap.find('.ticket-backend-export-menu');
|
|
|
|
if (!$menu.length) {
|
|
$menu = $(
|
|
'<div class="dropdown-menu ticket-backend-export-menu show" style="position:absolute;z-index:9999;min-width:140px;display:block;">' +
|
|
'<a class="dropdown-item ticket-export-csv" href="javascript:void(0);"><i class="mdi mdi-file-delimited mr-1"></i> CSV</a>' +
|
|
'<a class="dropdown-item ticket-export-excel" href="javascript:void(0);"><i class="mdi mdi-file-excel mr-1"></i> Excel</a>' +
|
|
'</div>'
|
|
);
|
|
$wrap.css('position', 'relative').append($menu);
|
|
$menu.css({
|
|
top: ($btn.position().top + $btn.outerHeight()) + 'px',
|
|
left: $btn.position().left + 'px'
|
|
});
|
|
|
|
$menu.on('click', '.ticket-export-csv', function(ev) {
|
|
ev.preventDefault();
|
|
ev.stopPropagation();
|
|
$menu.hide();
|
|
triggerTicketExport('csv');
|
|
});
|
|
$menu.on('click', '.ticket-export-excel', function(ev) {
|
|
ev.preventDefault();
|
|
ev.stopPropagation();
|
|
$menu.hide();
|
|
triggerTicketExport('excel');
|
|
});
|
|
} else {
|
|
$menu.toggle();
|
|
if ($menu.is(':visible')) {
|
|
$menu.css({
|
|
top: ($btn.position().top + $btn.outerHeight()) + 'px',
|
|
left: $btn.position().left + 'px',
|
|
display: 'block'
|
|
});
|
|
}
|
|
}
|
|
|
|
setTimeout(function() {
|
|
$(document).one('click.ticketExportMenu', function() {
|
|
$menu.hide();
|
|
});
|
|
}, 0);
|
|
}
|
|
}
|
|
],
|
|
language: {
|
|
search: `
|
|
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
|
|
_INPUT_
|
|
<i class="mdi mdi-magnify datatable-search-icon"
|
|
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666;"></i>
|
|
<i class="mdi mdi-close-circle datatable-clear-icon"
|
|
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666; display:none;"></i>
|
|
</div>`,
|
|
searchPlaceholder: "Search",
|
|
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
|
},
|
|
paging: true, // Enable pagination
|
|
pageLength: 10, // Set default number of rows per page (optional)
|
|
ordering: false,
|
|
});
|
|
window.ticketTableInstance.columns.adjust();
|
|
} else if (!ticketsTable.length) {
|
|
console.error("Table not found.");
|
|
}
|
|
});
|
|
|
|
function viewTicket(ticket_id){
|
|
|
|
// $('.loader').fadeIn();
|
|
// $('.loader-mask').fadeIn();
|
|
|
|
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id;
|
|
window.location.href = url;
|
|
|
|
|
|
}
|
|
|
|
function forceShowTpaClaimPushLogsModal() {
|
|
var modalEl = document.getElementById('tpaClaimPushLogsModal');
|
|
if (!modalEl) {
|
|
return;
|
|
}
|
|
|
|
if (modalEl.parentNode !== document.body) {
|
|
document.body.appendChild(modalEl);
|
|
}
|
|
|
|
modalEl.style.display = 'block';
|
|
modalEl.classList.add('show', 'in');
|
|
modalEl.removeAttribute('aria-hidden');
|
|
modalEl.setAttribute('aria-modal', 'true');
|
|
document.body.classList.add('modal-open');
|
|
|
|
if (!document.querySelector('.modal-backdrop.tpa-claim-push-logs-backdrop')) {
|
|
var backdrop = document.createElement('div');
|
|
backdrop.className = 'modal-backdrop fade show in tpa-claim-push-logs-backdrop';
|
|
document.body.appendChild(backdrop);
|
|
}
|
|
}
|
|
|
|
function hideTpaClaimPushLogsModal() {
|
|
var modalEl = document.getElementById('tpaClaimPushLogsModal');
|
|
if (!modalEl) {
|
|
return;
|
|
}
|
|
|
|
if (typeof jQuery !== 'undefined' && jQuery.fn && typeof jQuery.fn.modal === 'function') {
|
|
$('#tpaClaimPushLogsModal').modal('hide');
|
|
}
|
|
|
|
modalEl.classList.remove('show', 'in');
|
|
modalEl.style.display = 'none';
|
|
modalEl.setAttribute('aria-hidden', 'true');
|
|
modalEl.removeAttribute('aria-modal');
|
|
document.body.classList.remove('modal-open');
|
|
document.body.style.removeProperty('padding-right');
|
|
$('.modal-backdrop').remove();
|
|
}
|
|
|
|
function openTpaClaimPushLogsModal() {
|
|
var $modal = $('#tpaClaimPushLogsModal');
|
|
if (!$modal.length) {
|
|
return;
|
|
}
|
|
|
|
if ($modal.parent()[0] !== document.body) {
|
|
$modal.appendTo('body');
|
|
}
|
|
|
|
try {
|
|
if (typeof jQuery !== 'undefined' && jQuery.fn && typeof jQuery.fn.modal === 'function') {
|
|
$modal.off('shown.bs.modal.tpaLogs').on('shown.bs.modal.tpaLogs', function() {
|
|
$('.modal-backdrop').last().addClass('tpa-claim-push-logs-backdrop');
|
|
});
|
|
$modal.modal('show');
|
|
setTimeout(function() {
|
|
if ((!$modal.hasClass('show') && !$modal.hasClass('in')) || !$modal.is(':visible')) {
|
|
forceShowTpaClaimPushLogsModal();
|
|
}
|
|
}, 120);
|
|
return;
|
|
}
|
|
|
|
if (window.bootstrap && bootstrap.Modal) {
|
|
var modalEl = document.getElementById('tpaClaimPushLogsModal');
|
|
if (modalEl && typeof bootstrap.Modal.getOrCreateInstance === 'function') {
|
|
bootstrap.Modal.getOrCreateInstance(modalEl).show();
|
|
return;
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.error('TPA claim push logs modal open failed:', e);
|
|
}
|
|
|
|
forceShowTpaClaimPushLogsModal();
|
|
}
|
|
|
|
function showTpaClaimPushLogs(event, ticketId) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
|
|
var $content = $('#tpaClaimPushLogsContent');
|
|
var $titleMeta = $('#tpaClaimPushLogsTicketId');
|
|
|
|
$titleMeta.text('Claim ID: ' + ticketId);
|
|
$content.text('Loading...');
|
|
openTpaClaimPushLogsModal();
|
|
|
|
var url = '<?= base_url('ticket/tpa-claim-push-logs') ?>';
|
|
sendAjaxRequestForGlobal(url, 'GET', { ticket_id: ticketId }, function(response) {
|
|
if (response.status === true && response.data) {
|
|
if (response.data.has_logs) {
|
|
$content.text(response.data.logs);
|
|
} else {
|
|
$content.text('No TPA claim push logs found for this claim.');
|
|
}
|
|
return;
|
|
}
|
|
$content.text(response.message || 'Failed to load TPA claim push logs.');
|
|
toastr.warning(response.message || 'Failed to load TPA claim push logs.', 'Warning');
|
|
}, function(xhr) {
|
|
var message = 'Failed to load TPA claim push logs.';
|
|
if (xhr.responseJSON && xhr.responseJSON.message) {
|
|
message = xhr.responseJSON.message;
|
|
}
|
|
$content.text(message);
|
|
toastr.error(message, 'Error');
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var $modal = $('#tpaClaimPushLogsModal');
|
|
if ($modal.length && $modal.parent()[0] !== document.body) {
|
|
$modal.appendTo('body');
|
|
}
|
|
|
|
$(document).on('click', '#tpaClaimPushLogsModal [data-dismiss="modal"]', function(e) {
|
|
e.preventDefault();
|
|
hideTpaClaimPushLogsModal();
|
|
});
|
|
});
|
|
|
|
function removeClaim(input, ticket_id) {
|
|
|
|
confirmActionSweertAlert("Do you want to delete this Claim?", "Yes, Proceed!", "No, Cancel").then((confirmed) => {
|
|
if (confirmed) {
|
|
let url = '<?= base_url('ticket/remove') ?>';
|
|
|
|
// Include `pt_id` in the AJAX request if necessary
|
|
let requestData = { ticket_id: ticket_id };
|
|
|
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
|
console.log('Data fetched successfully:', response);
|
|
|
|
if (response.status === true) {
|
|
toastr.success(response.message, 'Success');
|
|
window.location.reload();
|
|
} else {
|
|
toastr.warning(response.message, 'Warning');
|
|
}
|
|
}, function(xhr, status, error) {
|
|
console.error('Error fetching data:', error);
|
|
console.error(xhr.responseText);
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function triggerTicketExport(format) {
|
|
var exportUrl = '<?= base_url('ticket/export') ?>';
|
|
|
|
// Reuse the same filter parameters that were last applied to the table
|
|
var stored = localStorage.getItem('filterData');
|
|
var filterData = stored ? JSON.parse(stored) : {};
|
|
|
|
filterData['export_format'] = format;
|
|
|
|
// Export only rows currently visible in DataTables (respects search box)
|
|
if (window.ticketTableInstance) {
|
|
var ids = window.ticketTableInstance
|
|
.rows({ search: 'applied' })
|
|
.nodes()
|
|
.to$()
|
|
.map(function () {
|
|
return $(this).data('id');
|
|
})
|
|
.get()
|
|
.filter(function (id) {
|
|
return id !== null && id !== undefined && id !== '';
|
|
});
|
|
|
|
filterData['export_ids'] = ids.join(',');
|
|
}
|
|
|
|
var $form = $('<form method="POST" style="display:none;"></form>').attr('action', exportUrl);
|
|
|
|
$.each(filterData, function(name, value) {
|
|
if (String(name).toLowerCase().indexOf('csrf') !== -1) {
|
|
return;
|
|
}
|
|
if (name === 'export_ids' || (value !== null && value !== undefined && value !== '')) {
|
|
$form.append($('<input type="hidden">').attr('name', name).val(value));
|
|
}
|
|
});
|
|
|
|
$('body').append($form);
|
|
$form.submit();
|
|
setTimeout(function() { $form.remove(); }, 3000);
|
|
}
|
|
|
|
$(document).on('click', 'tbody tr', function (e) {
|
|
// Exclude clicks on any elements inside the last column (actions)
|
|
if ($(e.target).closest('td').index() !== $(this).children('td').length - 1) {
|
|
const id = $(this).data('id');
|
|
console.log('Ticket ID', id)
|
|
viewTicket(id);
|
|
}
|
|
});
|
|
|
|
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
if (typeof openTicketFilterNav !== 'function') {
|
|
console.log('Developer Notice: The file ticket_search.php must be loaded by the controller for the filters to work, not ticket_list.php.');
|
|
}
|
|
});
|
|
</script>
|