nhance/app/Views/ticket_history.php
2025-04-03 17:39:06 +05:30

75 lines
2.7 KiB
PHP

<div class="row">
<div class="col-12">
<div class="card-body">
<div class="table-responsive">
<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 $row['modified_by'] ?? "Created by employee"; ?></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-->
<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'
// },
// }
// ],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 10, // Set default number of rows per page (optional)
ordering: false,
});
} else {
console.error("Table atet found.");
}
});
</script>