746 lines
28 KiB
PHP
Executable File
746 lines
28 KiB
PHP
Executable File
<?php
|
||
helper('datatable_view');
|
||
$fl_header_labels = [
|
||
'S.No', 'File name', 'Client', 'Client Branch', 'Policy',
|
||
'Event', 'User/Time', 'Status', 'Action',
|
||
];
|
||
$fl_col_count = count($fl_header_labels);
|
||
$fl_col_max_len = array_fill(0, $fl_col_count, 0);
|
||
for ($i = 0; $i < $fl_col_count; $i++) {
|
||
$fl_col_max_len[$i] = mb_strlen($fl_header_labels[$i]);
|
||
}
|
||
// Prefer readable defaults for server-side pages (row lengths unknown at render).
|
||
$fl_col_max_len[1] = max($fl_col_max_len[1], 28);
|
||
$fl_col_max_len[2] = max($fl_col_max_len[2], 12);
|
||
$fl_col_max_len[3] = max($fl_col_max_len[3], 14);
|
||
$fl_col_max_len[4] = max($fl_col_max_len[4], 22);
|
||
$fl_col_max_len[5] = max($fl_col_max_len[5], 14);
|
||
$fl_col_max_len[6] = max($fl_col_max_len[6], 28);
|
||
$fl_col_max_len[7] = max($fl_col_max_len[7], 12);
|
||
$fl_col_min_px = [48, 100, 72, 80, 120, 88, 160, 96, 72];
|
||
$fl_col_max_px = [64, 320, 180, 180, 360, 160, 320, 200, 88];
|
||
$fl_col_width_px = nhance_dt_column_widths_px($fl_header_labels, $fl_col_max_len, $fl_col_min_px, $fl_col_max_px);
|
||
?>
|
||
<style>
|
||
.modal-full-width {
|
||
width: 95% !important;
|
||
max-width: none;
|
||
}
|
||
|
||
.reload:hover {
|
||
cursor: pointer;
|
||
}
|
||
|
||
.column-header { margin-right: 10px; /* Adjust this value as needed */ }
|
||
|
||
/* Compact table + buttons (NHance) */
|
||
#file-list-table tbody td {
|
||
padding: 6px 12px !important;
|
||
font-size: 13px;
|
||
line-height: 1.25;
|
||
}
|
||
#file-list-table_wrapper .dataTables_scrollHead table thead th,
|
||
#file-list-table thead th {
|
||
padding: 6px 2.35rem 6px 12px !important;
|
||
font-size: 13px;
|
||
line-height: 1.25;
|
||
}
|
||
|
||
#file-list-table .font-12 {
|
||
font-size: 12px;
|
||
}
|
||
|
||
/* Action dropdown toggle in rows */
|
||
#file-list-table .dropdown-toggle.btn-sm {
|
||
padding: 4px 9px !important;
|
||
font-size: 13px;
|
||
line-height: 1.2;
|
||
}
|
||
|
||
/* DataTables toolbar buttons (Export/Filter/Clear Filter) */
|
||
#file-list-table_wrapper .dt-buttons .btn {
|
||
padding: 6px 13px !important;
|
||
font-size: 13px;
|
||
}
|
||
|
||
#file-list-table_wrapper .dt-buttons .btn .btn-custom {
|
||
font-size: 13px;
|
||
}
|
||
|
||
#file-list-table{
|
||
width: 100% !important;
|
||
}
|
||
|
||
#file-list-table thead th{
|
||
white-space: nowrap;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
#file-list-table_wrapper .datatable-search-wrapper{
|
||
width: auto !important;
|
||
}
|
||
|
||
#file-list-table_wrapper .dataTables_filter input{
|
||
padding-right: 34px !important;
|
||
width: 220px !important;
|
||
}
|
||
|
||
#file-list-table_wrapper .row.align-items-center{
|
||
flex-wrap: nowrap;
|
||
}
|
||
|
||
#file-list-table_wrapper .dataTables_info,
|
||
#file-list-table_wrapper .dataTables_length,
|
||
#file-list-table_wrapper .dataTables_paginate{
|
||
white-space: nowrap;
|
||
}
|
||
|
||
#file-list-table_wrapper .datatable-search-icon,
|
||
#file-list-table_wrapper .datatable-clear-icon{
|
||
right: 11px !important;
|
||
}
|
||
|
||
/*
|
||
* One horizontal scrollbar (same as batch_list):
|
||
* - No .dataTables_scrollBody → outer .table-responsive scrolls wide columns.
|
||
* - With .dataTables_scrollBody → outer stays visible (custom.css / nh-dt-no-outer-scroll);
|
||
* only the inner DT strip scrolls. Do not force overflow-x:auto on the outer wrapper
|
||
* or you get a second scrollbar under the pagination row.
|
||
*/
|
||
#file-list-page .card-body > .table-responsive:not(:has(.dataTables_scrollBody)) {
|
||
overflow-x: auto !important;
|
||
-webkit-overflow-scrolling: touch;
|
||
max-width: 100%;
|
||
}
|
||
#file-list-page .card-body > .table-responsive:has(.dataTables_scrollBody) {
|
||
overflow-x: visible !important;
|
||
-webkit-overflow-scrolling: auto;
|
||
max-width: 100%;
|
||
}
|
||
|
||
</style>
|
||
<style>
|
||
<?php for ($i = 0; $i < $fl_col_count; $i++) : ?>
|
||
#file-list-table_wrapper .dataTables_scrollHead table thead th:nth-child(<?= $i + 1 ?>),
|
||
#file-list-table thead th:nth-child(<?= $i + 1 ?>) {
|
||
min-width: <?= (int) $fl_col_width_px[$i] ?>px;
|
||
width: <?= (int) $fl_col_width_px[$i] ?>px;
|
||
box-sizing: border-box;
|
||
vertical-align: middle;
|
||
overflow: visible !important;
|
||
}
|
||
#file-list-table tbody td:nth-child(<?= $i + 1 ?>) {
|
||
width: <?= (int) $fl_col_width_px[$i] ?>px;
|
||
max-width: <?= (int) $fl_col_width_px[$i] ?>px;
|
||
min-width: <?= (int) $fl_col_width_px[$i] ?>px;
|
||
box-sizing: border-box;
|
||
vertical-align: middle;
|
||
}
|
||
<?php endfor; ?>
|
||
#file-list-table tbody td:nth-child(1),
|
||
#file-list-table tbody td:nth-child(2),
|
||
#file-list-table tbody td:nth-child(3),
|
||
#file-list-table tbody td:nth-child(4),
|
||
#file-list-table tbody td:nth-child(5),
|
||
#file-list-table tbody td:nth-child(6),
|
||
#file-list-table tbody td:nth-child(7),
|
||
#file-list-table tbody td:nth-child(8) {
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
#file-list-table tbody td:nth-child(9) {
|
||
overflow: visible;
|
||
text-overflow: clip;
|
||
}
|
||
</style>
|
||
|
||
<div class="col-12" id="file-list-page">
|
||
<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;">Files</h4>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="table-responsive">
|
||
<table data-custom-table-css="table" class="table mb-0 nowrap w-100 table-centered" cellspacing="0" id="file-list-table">
|
||
<thead class="bg-light">
|
||
<tr>
|
||
<th class="font-weight-medium"><div class="column-header">S.No</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">File name</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Client</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Client Branch</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Policy</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Event</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">User/Time</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Status</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Action</div></th>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody class="font-12">
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
|
||
|
||
<div id="full-width-modal-emp-list" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel"
|
||
aria-hidden="true">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="fullWidthModalLabel">Upload Employee List <span
|
||
id="title_header_name"></span></h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body" id="emp_data_success">
|
||
|
||
</div>
|
||
<!-- <div class="modal-footer">
|
||
<button type="button" class="btn btn-primary">Save changes</button>
|
||
</div> -->
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</div><!-- /.modal -->
|
||
|
||
|
||
<!-- Center modal content for reupload file-->
|
||
<div class="modal fade" id="file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="myCenterModalLabel">ReUpload the file</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="parsley-examples" id="uploadForm" action="<?php echo base_url() . 'employee/upload' ?>"
|
||
method="post"
|
||
enctype="multipart/form-data">
|
||
<input type="hidden" id="file_client_id" name="client_id">
|
||
<input type="hidden" id="file_policy_id" name="policy_id">
|
||
<input type="hidden" id="file_branch_id" name="branch_id">
|
||
<input type="hidden" id="file_upload_actions" name="upload-action-type">
|
||
<input type="file" id="fileInput" name="emplist" required
|
||
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||
<small class="text-muted d-block">Allowed: XLS, XLSX. Size : 25MB</small>
|
||
<button type="submit" class="btn btn-primary">Upload</button>
|
||
</form>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</div><!-- /.modal -->
|
||
|
||
|
||
<script>
|
||
|
||
$('body').on('click', '.view_emp_list', function() {
|
||
|
||
console.log('file_id', 'file_id');
|
||
$('#emp_data_success').empty();
|
||
$('#title').html(' ');
|
||
var file_id = $(this).attr('data-id');
|
||
console.log(file_id);
|
||
|
||
var queryParams = {
|
||
file_id: file_id,
|
||
};
|
||
|
||
console.log('queryParams', queryParams)
|
||
const queryString = objectToQueryString(queryParams);
|
||
console.log('queryString', queryString)
|
||
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
var uri = '<?= base_url('util/view-success-emp-list') ?>?' + queryString
|
||
console.log(uri)
|
||
|
||
$.ajax({
|
||
url: uri,
|
||
data: {
|
||
file_id: file_id,
|
||
},
|
||
type: "GET",
|
||
dataType: 'json',
|
||
processData: false,
|
||
contentType: false,
|
||
success: function(res) {
|
||
|
||
console.log(res);
|
||
|
||
if (res) {
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}, 1000);
|
||
}
|
||
|
||
var title = " - ";
|
||
|
||
if (res.file_data) {
|
||
title += (res.file_data.file_name || "") + " - ";
|
||
title += (res.file_data.short_name || "") + " - ";
|
||
title += (res.file_data.policy_name || "") + " - ";
|
||
title += (res.file_data.action || "") + " - ";
|
||
title += (res.file_data.status || "");
|
||
}
|
||
|
||
$('#title_header_name').html(title);
|
||
destroyEmpUploadListDataTable();
|
||
$('#emp_data_success').html(res.data);
|
||
initEmpUploadListDataTable();
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
toastr.warning('Something went wrong', 'Warning');
|
||
|
||
}, 1000);
|
||
}
|
||
});
|
||
|
||
})
|
||
|
||
function destroyEmpUploadListDataTable() {
|
||
if ($.fn.DataTable && $.fn.DataTable.isDataTable('#tech-companies-1')) {
|
||
$('#tech-companies-1').DataTable().clear().destroy();
|
||
}
|
||
}
|
||
|
||
function initEmpUploadListDataTable() {
|
||
var $table = $('#tech-companies-1');
|
||
if (!$table.length || !$.fn.DataTable) {
|
||
return;
|
||
}
|
||
|
||
destroyEmpUploadListDataTable();
|
||
|
||
if (typeof nhanceListDataTableBeforeInit === 'function') {
|
||
nhanceListDataTableBeforeInit();
|
||
}
|
||
|
||
var dtOptions = {
|
||
ordering: true,
|
||
searching: true,
|
||
paging: true,
|
||
pageLength: 10,
|
||
order: [[0, 'asc']],
|
||
autoWidth: false,
|
||
scrollX: false,
|
||
scrollY: false,
|
||
scrollCollapse: false,
|
||
sScrollX: '',
|
||
sScrollY: '',
|
||
sScrollXInner: '',
|
||
bScrollCollapse: false,
|
||
responsive: false,
|
||
language: {
|
||
paginate: {
|
||
first: 'First',
|
||
last: 'Last',
|
||
next: 'Next',
|
||
previous: 'Previous'
|
||
}
|
||
}
|
||
};
|
||
|
||
var empUploadTable = typeof nhanceMergeListDataTableOptions === 'function'
|
||
? $table.DataTable(nhanceMergeListDataTableOptions(dtOptions))
|
||
: $table.DataTable(dtOptions);
|
||
|
||
if (typeof nhanceListDataTableAfterInit === 'function') {
|
||
nhanceListDataTableAfterInit();
|
||
}
|
||
if (typeof nhanceListDataTableBindAdjust === 'function') {
|
||
nhanceListDataTableBindAdjust(empUploadTable);
|
||
}
|
||
|
||
// Modal is often still animating when HTML is injected — re-measure after shown
|
||
$('#full-width-modal-emp-list')
|
||
.off('shown.bs.modal.empUploadList')
|
||
.on('shown.bs.modal.empUploadList', function () {
|
||
if ($.fn.DataTable.isDataTable('#tech-companies-1')) {
|
||
$('#tech-companies-1').DataTable().columns.adjust();
|
||
}
|
||
});
|
||
|
||
setTimeout(function () {
|
||
if ($.fn.DataTable.isDataTable('#tech-companies-1')) {
|
||
$('#tech-companies-1').DataTable().columns.adjust();
|
||
}
|
||
}, 0);
|
||
}
|
||
|
||
$('#full-width-modal-emp-list').on('hidden.bs.modal', function () {
|
||
destroyEmpUploadListDataTable();
|
||
$('#emp_data_success').empty();
|
||
});
|
||
|
||
|
||
$('body').on('click', '.upload_button', function() {
|
||
|
||
$('#uploadForm')[0].reset();
|
||
console.log('file_id');
|
||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||
console.log(fileId); // Use fileId as needed
|
||
$('#file_client_id').val(fileId.client_id)
|
||
$('#file_policy_id').val(fileId.client_policy_id)
|
||
$('#file_branch_id').val(fileId.client_branch_id)
|
||
$('#file_upload_actions').val(fileId.action)
|
||
})
|
||
|
||
$('body').on('click', '.truncate2', function(event) {
|
||
|
||
event.preventDefault();
|
||
// console.log(event);
|
||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||
console.log('Truncate File ID' + fileId);
|
||
|
||
Swal.fire({
|
||
title: "Do you want to truncate data from uploaded file?",
|
||
showCancelButton: true,
|
||
confirmButtonText: "Delete",
|
||
confirmButtonColor: "#ff3333",
|
||
}).then((result) => {
|
||
|
||
console.log(result);
|
||
|
||
if (result.isConfirmed) {
|
||
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId;
|
||
// console.log('Truncate API URL : ', apiURL);
|
||
|
||
$.ajax({
|
||
url: apiURL,
|
||
method: 'GET',
|
||
headers: {
|
||
"X-Requested-With": "XMLHttpRequest"
|
||
},
|
||
success: function(response) {
|
||
|
||
// console.log('Truncate Response', response)
|
||
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}, 1000);
|
||
|
||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||
Swal.fire({
|
||
title: "Deleted!",
|
||
icon: "success"
|
||
});
|
||
|
||
window.location.reload(true);
|
||
|
||
} else if (response.code === 404 && response.dataStatus === false) {
|
||
console.error('No data found', response);
|
||
handleNoDataFound(response, fileId);
|
||
} else {
|
||
Swal.fire({
|
||
title: "Failed!",
|
||
text: 'Something went wrong! Try later',
|
||
icon: "error"
|
||
});
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
console.error('Error fetching data from API:', error);
|
||
toastr.error('Something went wrong! Try later', 'Error');
|
||
}
|
||
});
|
||
}
|
||
|
||
});
|
||
})
|
||
|
||
function handleNoDataFound(response, fileId) {
|
||
if (response.role == 1 || response.role == 5) {
|
||
Swal.fire({
|
||
title: response.message,
|
||
showCancelButton: true,
|
||
confirmButtonText: "Delete",
|
||
confirmButtonColor: "#ff3333",
|
||
}).then((result) => {
|
||
|
||
console.log(result);
|
||
if (result.isConfirmed) {
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId + '/' + <?= get_role_id(); ?>;
|
||
|
||
$.ajax({
|
||
url: apiURL,
|
||
method: 'GET',
|
||
headers: {
|
||
"X-Requested-With": "XMLHttpRequest"
|
||
},
|
||
success: function(response) {
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}, 1000);
|
||
|
||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||
Swal.fire({
|
||
title: "Deleted!",
|
||
icon: "success"
|
||
});
|
||
|
||
window.location.reload(true);
|
||
|
||
} else if (response.code === 404 && response.dataStatus === false) {
|
||
console.error('No data found', response);
|
||
Swal.fire({
|
||
title: "Failed!",
|
||
text: response.message,
|
||
icon: "error"
|
||
});
|
||
} else {
|
||
Swal.fire({
|
||
title: "Failed!",
|
||
text: 'Something went wrong! Try later',
|
||
icon: "error"
|
||
});
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}, 1000);
|
||
|
||
console.error('Error fetching data from API:', error);
|
||
console.error('Something went wrong! Try later', 'Error');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
} else {
|
||
Swal.fire({
|
||
title: "Failed!",
|
||
text: response.message,
|
||
icon: "error"
|
||
});
|
||
}
|
||
}
|
||
|
||
$('#uploadForm').submit(function(event) {
|
||
|
||
event.preventDefault();
|
||
|
||
var isValid = $('#uploadForm').parsley().validate();
|
||
if (!isValid) {
|
||
console.log('Form is Empty', 'Warning');
|
||
return false;
|
||
}
|
||
|
||
// Create FormData object
|
||
var formData = new FormData($(this)[0]);
|
||
for (var pair of formData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
|
||
// return false;
|
||
$.ajax({
|
||
url: $(this).attr("action"),
|
||
type: "POST",
|
||
data: formData,
|
||
processData: false, // Prevent jQuery from automatically processing the data
|
||
contentType: false, // Let jQuery handle the content type
|
||
headers: {
|
||
// "Content-Type":"multipart/form-data",
|
||
"X-Requested-With": "XMLHttpRequest"
|
||
},
|
||
success: function(response) {
|
||
|
||
console.log(response);
|
||
$('#uploadForm')[0].reset();
|
||
|
||
if (response.code === 200 && response.dataStatus === true && response
|
||
.data !== "") {
|
||
toastr.success(
|
||
'File upload successs, Data validation is in-progress',
|
||
'Success');
|
||
$('.close').click()
|
||
window.location.reload(true);
|
||
} else if (response.code === 404 && response.dataStatus === false) {
|
||
console.error('no data found', response);
|
||
// alert(response.message);
|
||
toastr.error(response.message, 'Failed');
|
||
window.location.reload(true);
|
||
} else {
|
||
console.error('Something went wrong!');
|
||
// alert('Something went wrong! Try later');
|
||
toastr.error('Something went wrong! Try later', 'Error');
|
||
window.location.reload(true);
|
||
}
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Request failed, handle error
|
||
console.error("Request failed:", status, error);
|
||
toastr.error('Something went wrong! Try later', 'Error');
|
||
$('#uploadForm')[0].reset();
|
||
window.location.reload(true);
|
||
}
|
||
});
|
||
|
||
return false;
|
||
})
|
||
|
||
$('body').on('click', '.reload', function() {
|
||
|
||
console.log('status');
|
||
status = this.getAttribute('data-id')
|
||
console.log(status);
|
||
if (status == 'inprogress') {
|
||
window.location.reload(true);
|
||
}
|
||
})
|
||
|
||
$(document).ready(function() {
|
||
|
||
window.fileListTableInstance = window.fileListTableInstance || null;
|
||
window.uploadListFilters = window.uploadListFilters || {
|
||
client_id: '',
|
||
client_branch_id: '',
|
||
policy_id: '',
|
||
event_type: '',
|
||
insurer_or_tpa: '',
|
||
action_type: '',
|
||
start_date: '',
|
||
end_date: '',
|
||
use_default_date: '1'
|
||
};
|
||
|
||
(function seedUploadListFiltersFromUrl() {
|
||
const urlParams = new URLSearchParams(window.location.search);
|
||
['client_id', 'event_type', 'insurer_or_tpa', 'action_type', 'start_date', 'end_date'].forEach(function(key) {
|
||
if (urlParams.get(key)) {
|
||
window.uploadListFilters[key] = urlParams.get(key);
|
||
}
|
||
});
|
||
if (urlParams.get('client_branch_id') || urlParams.get('branch_id')) {
|
||
window.uploadListFilters.client_branch_id = urlParams.get('client_branch_id') || urlParams.get('branch_id');
|
||
}
|
||
if (urlParams.get('policy_id') || urlParams.get('client_policy_id')) {
|
||
window.uploadListFilters.policy_id = urlParams.get('policy_id') || urlParams.get('client_policy_id');
|
||
}
|
||
if (urlParams.get('client_id') || urlParams.get('client_branch_id') || urlParams.get('policy_id') || urlParams.get('event_type') || urlParams.get('start_date') || urlParams.get('end_date') || urlParams.get('insurer_or_tpa') || urlParams.get('action_type') || urlParams.get('tab_type')) {
|
||
// Match legacy filter redirect: when any filter/tab param is present without dates, do not force 90-day default.
|
||
if (!urlParams.get('start_date') && !urlParams.get('end_date') && urlParams.get('tab_type')) {
|
||
window.uploadListFilters.use_default_date = '0';
|
||
}
|
||
}
|
||
})();
|
||
|
||
nhanceListDataTableBeforeInit();
|
||
window.fileListTableInstance = $('#file-list-table').DataTable(nhanceMergeListDataTableOptions({
|
||
processing: true,
|
||
serverSide: true,
|
||
deferRender: true,
|
||
searchDelay: 400,
|
||
pageLength: 10,
|
||
scrollX: false,
|
||
scrollY: false,
|
||
scrollCollapse: false,
|
||
autoWidth: false,
|
||
responsive: false,
|
||
columns: (function() {
|
||
var cols = [];
|
||
for (var i = 0; i < <?= (int) $fl_col_count ?>; i++) {
|
||
cols.push({ data: String(i), orderable: false });
|
||
}
|
||
return cols;
|
||
})(),
|
||
ajax: {
|
||
url: '<?= base_url("employee/upload/file-list/datatable") ?>',
|
||
type: 'POST',
|
||
data: function(d) {
|
||
return $.extend({}, d, window.uploadListFilters || {});
|
||
}
|
||
},
|
||
dom: "<'row'<'col-sm-7'f><'col-sm-5 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 mr-2',
|
||
buttons: [
|
||
{
|
||
extend: 'csv',
|
||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||
title: 'Employee-Upload-List',
|
||
className: 'app-btn-primary ',
|
||
exportOptions: {
|
||
columns: ':not(:last-child)'
|
||
},
|
||
}
|
||
]
|
||
},
|
||
{
|
||
text: '<i class="mdi mdi-filter" ></i><span class=" btn-custom"> Filter </span>',
|
||
className: 'btn app-btn-primary mr-2',
|
||
action: function(e, dt, node, config) {
|
||
openPolicyFilterNav(1);
|
||
}
|
||
},
|
||
{
|
||
text: '<i class="mdi mdi-filter-remove"></i><span class="btn-custom"> Clear Filter </span>',
|
||
className: 'btn app-btn-info mr-2 hide-clear-filter',
|
||
action: function(e, dt, node, config) {
|
||
clearFilterData();
|
||
}
|
||
}
|
||
],
|
||
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,
|
||
ordering: false,
|
||
columnDefs: [
|
||
<?php for ($i = 0; $i < $fl_col_count; $i++) : ?>
|
||
{ targets: <?= $i ?>, width: '<?= (int) $fl_col_width_px[$i] ?>px' },
|
||
<?php endfor; ?>
|
||
],
|
||
initComplete: function () {
|
||
$(this.api().table().container()).closest('.table-responsive').addClass('nh-dt-no-outer-scroll');
|
||
},
|
||
drawCallback: function() {
|
||
$('[data-toggle="tooltip"]').tooltip({ container: 'body' });
|
||
}
|
||
}));
|
||
nhanceListDataTableAfterInit();
|
||
nhanceListDataTableBindAdjust(window.fileListTableInstance);
|
||
|
||
});
|
||
|
||
</script>
|