213 lines
7.4 KiB
PHP
213 lines
7.4 KiB
PHP
<?php
|
|
helper('datatable_view');
|
|
$tf_header_labels = ['Claim Number', 'Emp Code', 'Emp name', 'Corporate name'];
|
|
$tf_col_count = count($tf_header_labels);
|
|
$tf_col_max_len = array_fill(0, $tf_col_count, 0);
|
|
for ($i = 0; $i < $tf_col_count; $i++) {
|
|
$tf_col_max_len[$i] = mb_strlen($tf_header_labels[$i]);
|
|
}
|
|
$feedback_rows = $feedback_data ?? [];
|
|
if (is_array($feedback_rows)) {
|
|
foreach ($feedback_rows as $data) {
|
|
$tf_col_max_len[0] = max($tf_col_max_len[0], mb_strlen((string) ($data['claim_number'] ?: 'N/A')));
|
|
$tf_col_max_len[1] = max($tf_col_max_len[1], mb_strlen((string) ($data['emp_code'] ?: 'N/A')));
|
|
$tf_col_max_len[2] = max($tf_col_max_len[2], mb_strlen((string) ($data['emp_name'] ?: 'N/A')));
|
|
$tf_col_max_len[3] = max($tf_col_max_len[3], mb_strlen((string) ($data['client_name'] ?: 'N/A')));
|
|
}
|
|
}
|
|
$tf_col_min_px = [120, 88, 120, 140];
|
|
$tf_col_max_px = [360, 200, 400, 520];
|
|
$tf_col_width_px = nhance_dt_column_widths_px($tf_header_labels, $tf_col_max_len, $tf_col_min_px, $tf_col_max_px);
|
|
?>
|
|
<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>
|
|
<?php for ($i = 0; $i < $tf_col_count; $i++) : ?>
|
|
#ticket-feedback-list-table_wrapper .dataTables_scrollHead table thead th:nth-child(<?= $i + 1 ?>),
|
|
#ticket-feedback-list-table thead th:nth-child(<?= $i + 1 ?>) {
|
|
min-width: <?= (int) $tf_col_width_px[$i] ?>px;
|
|
width: <?= (int) $tf_col_width_px[$i] ?>px;
|
|
box-sizing: border-box;
|
|
vertical-align: middle;
|
|
overflow: visible !important;
|
|
}
|
|
#ticket-feedback-list-table tbody td:nth-child(<?= $i + 1 ?>) {
|
|
width: <?= (int) $tf_col_width_px[$i] ?>px;
|
|
max-width: <?= (int) $tf_col_width_px[$i] ?>px;
|
|
min-width: <?= (int) $tf_col_width_px[$i] ?>px;
|
|
box-sizing: border-box;
|
|
vertical-align: middle;
|
|
}
|
|
<?php endfor; ?>
|
|
#ticket-feedback-list-table tbody td {
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.dataTables_length label {height: 21px !important;}
|
|
|
|
</style>
|
|
<script>
|
|
var pageHideMainNavTitle = true;
|
|
var pageTitle = 'Claim Feedback List';
|
|
</script>
|
|
|
|
|
|
<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 Feedback List </h4>
|
|
</div>
|
|
|
|
</div> -->
|
|
<div class="table-responsive">
|
|
<table data-custom-table-css="table" id="ticket-feedback-list-table" class="table w-100 nowrap">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th>Claim Number</th>
|
|
<th>Emp Code</th>
|
|
<th>Emp name</th>
|
|
<th>Corporate name</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (isset($feedback_data)) { ?>
|
|
<?php foreach($feedback_data as $data){ ?>
|
|
<tr onclick="viewFeedbackForm(<?php echo $data['id']; ?>)">
|
|
<td><?php echo $data['claim_number'] ?: 'N/A'; ?></td>
|
|
<td><?php echo $data['emp_code'] ?: 'N/A'; ?></td>
|
|
<td><?php echo $data['emp_name'] ?: 'N/A'; ?></td>
|
|
<td><?php echo $data['client_name'] ?: 'N/A'; ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div>
|
|
</div>
|
|
</div>
|
|
</div><!-- end col -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-------------------------------------------------------------------------------------------------->
|
|
|
|
<script>
|
|
|
|
// Datatable document ready
|
|
$(document).ready(function() {
|
|
|
|
var ticketsTable = $('#ticket-feedback-list-table');
|
|
|
|
if (ticketsTable.length) {
|
|
|
|
nhanceListDataTableBeforeInit();
|
|
var nhTicketFeedbackTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({
|
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
|
"<'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: [
|
|
{
|
|
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>',
|
|
exportOptions: {
|
|
orthogonal: 'sort'
|
|
},
|
|
title: 'claim-List',
|
|
sheetName: 'claim-List',
|
|
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,
|
|
pageLength: 10,
|
|
ordering: false,
|
|
columnDefs: [
|
|
<?php for ($i = 0; $i < $tf_col_count; $i++) : ?>
|
|
{ targets: <?= $i ?>, width: '<?= (int) $tf_col_width_px[$i] ?>px' },
|
|
<?php endfor; ?>
|
|
],
|
|
}));
|
|
nhanceListDataTableAfterInit();
|
|
nhanceListDataTableBindAdjust(nhTicketFeedbackTable);
|
|
} else {
|
|
console.error("Table atet found.");
|
|
}
|
|
});
|
|
|
|
|
|
function viewFeedbackForm(ticket_id){
|
|
|
|
console.log("Ticket ID : ",ticket_id);
|
|
var md5Hash_ticket_id = md5(ticket_id);
|
|
console.log("MD5 Ticket ID : ",md5Hash_ticket_id);
|
|
|
|
// alert(md5Hash);
|
|
|
|
feedbackPage = `<?= base_url("claims-feedback-form/") ?>${md5Hash_ticket_id}/1`
|
|
|
|
// window.location.href = feedbackPage;
|
|
window.open(feedbackPage, "_blank");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|