nhance/app/Views/ticket_list.php

136 lines
4.0 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>
<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>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><?php echo $row['status']; ?></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['insurer_name']; ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['tat']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<!-------------------------------------------------------------------------------------------------->
<script>
// 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) {
newClaim()
}
}
],
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
}
function newClaim(){
let url = '<?= base_url('ticket/new'); ?>'
window.location.href = url
}
</script>