nhance/app/Views/ticket_history.php
2026-04-16 15:28:06 +05:30

103 lines
4.0 KiB
PHP

<div class="row">
<div class="col-12">
<div class="card-body">
<div class="table-responsive ticket-history-table-wrap">
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100">
<thead class="bg-light">
<tr>
<th>Label</th>
<!-- <th>Old Value</th>
<th>New Value</th> -->
<th>Change</th>
<th>User</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
<?php if (isset($ticket_history)) { ?>
<?php foreach($ticket_history as $index => $row){ ?>
<tr>
<td><?php echo $row['display_name']; ?></td>
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
<!-- <td><?php //echo $row['new_value']; ?></td> -->
<td><?php echo !empty($row['modified_by'])? $row['modified_by'] : "Created by employee"; ?> <?= $row['updated_by'] == "0" ? "(API)" : ""; ?></td>
<!-- <td><?php //echo $row['created_at']; ?></td> -->
<td><?php echo date("d-m-Y h:i:s A", strtotime($row['created_at'])) ?? " - "; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- end col-->
<style>
.ticket-history-table-wrap {
overflow: hidden;
}
</style>
<script>
$(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'>>" + // 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: 'Ticket_History',
// },
// {
// extend: 'excel',
// text: 'Excel',
// title: 'Ticket_History',
// exportOptions: {
// orthogonal: 'sort'
// },
// }
// ],
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'>>" +
"<'row'<'col-sm-12'tr>>",
autoWidth: false,
scrollY: "320px",
scrollCollapse: true,
columns: [
{ width: "13%" },
{ width: "47.5%" },
{ width: "17.5%" },
{ width: "22%" }
],
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: false,
info: false,
ordering: false,
});
ticketsTable.DataTable().columns.adjust();
ticketsTable.closest('.dataTables_wrapper').find('.dataTables_scrollHeadInner').css('width', '');
ticketsTable.closest('.dataTables_wrapper').find('.dataTables_scrollHead').css('overflow', 'hidden');
} else {
console.error("Table atet found.");
}
});
</script>