nhance/app/Views/ticket_list.php

191 lines
7.1 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;
}
</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;
}
</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 id="scroll-horizontal-datatable" class="table w-100 nowrap">
<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>TAT</th>
</tr>
</thead>
<tbody>
<?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?>
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
<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="fa fa-check-circle" style="color:green;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 2) {
echo $row['status'] . '&nbsp;<i class="fa fa-times-circle" style="color:red;" aria-hidden="true"></i>';
} else {
echo $row['status'];
}
} else {
echo $row['status'];
}
?>
</span>
</td>
<td><?php echo str_replace("Claim-", "", $ticket_type[$row['ticket_type_id']] ?? ""); ?></td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['emp_name']; ?></td>
<td><?php echo $row['insured_name']; ?></td>
<td><?php echo $row['short_name']; ?></td>
<td><?php echo $row['tat']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<!-------------------------------------------------------------------------------------------------->
<script>
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
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()
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
ordering: false,
});
} else {
console.error("Table atet found.");
}
});
function viewTicket(ticket_id){
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id
window.location.href = url
}
</script>