nhance/app/Views/ticket_list.php
2026-05-06 20:00:24 +05:30

695 lines
35 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;
}
.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;
}
</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&nbsp;</th>
<th>Policy Type&nbsp;</th>
<th>Claim number&nbsp;</th>
<th>TPA ID&nbsp;</th>
<th>Emp ID&nbsp;</th>
<th>Emp name&nbsp;</th>
<th>Insured Name&nbsp;</th>
<th>Corporate name&nbsp;</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;">Claim Type</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'] . '&nbsp;<i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 1) {
echo $row['status'] . '&nbsp;<i class="mdi mdi-check-circle" style="color:green;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 2) {
echo $row['status'] . '&nbsp;<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);
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 echo $row['tpa_no'] ?: 'N/A'; ?></td>
<td><?php echo $row['emp_code'] ?: 'N/A'; ?></td>
<td><?php echo $row['emp_name'] ?: 'N/A'; ?></td>
<td><?php echo $row['insured_name'] ?: 'N/A'; ?></td>
<td><?php echo $row['short_name'] ?: 'N/A'; ?></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 isset($priorityType[$row['priority'] ?? 0]) ? $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 isset($modeOFIntimate[$row['mode_of_intimation'] ?? '']) ? $modeOFIntimate[$row['mode_of_intimation']] : ''; ?></td>
<td style="display: none;">
<?php
$typeId = $row['ticket_type_id'] ?? 0;
$claimKey = $row['claim_type'] ?? '';
if ($typeId == 1) {
echo isset($claimType[1][$claimKey]) ? $claimType[1][$claimKey] : '';
} else {
echo isset($claimType[2][$claimKey]) ? $claimType[2][$claimKey] : '';
}
?>
</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>
</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, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
function asText(value) {
if (value === null || value === undefined || value === '') return 'N/A';
return escapeHtml(value);
}
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 '';
}
return '<span class="claim-source-badge ' + cls + '">' + escapeHtml(key) + '</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) + '&nbsp;<i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
if (approved === 1) return escapeHtml(status) + '&nbsp;<i class="mdi mdi-check-circle" style="color:green;" aria-hidden="true"></i>';
if (approved === 2) return escapeHtml(status) + '&nbsp;<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 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>' +
' </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(row.claim_no) + claimCreated + '</td>' +
'<td>' + asText(row.tpa_no) + '</td>' +
'<td>' + asText(row.emp_code) + '</td>' +
'<td>' + asText(row.emp_name) + '</td>' +
'<td>' + asText(row.insured_name) + '</td>' +
'<td>' + asText(row.short_name) + '</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(getClaimTypeLabel(row)) + '</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();
} 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()
}
},
{
extend: 'collection',
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
className: 'btn app-btn-secondary ',
buttons: [
{
extend: 'csv',
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
className: 'app-btn-primary ',
title: 'Claim-List',
},
{
extend: 'excel',
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
title: 'claim-List',
sheetName: 'claim-List',
exportOptions: {
orthogonal: 'sort'
},
className: 'app-btn-primary ',
}
]
}
],
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,
});
} 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 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);
});
}
});
}
$(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>