161 lines
7.0 KiB
PHP
161 lines
7.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; }
|
|
.dataTables_length label { height: 21px !important; }
|
|
</style>
|
|
|
|
<script>
|
|
var pageHideMainNavTitle = true;
|
|
var pageTitle = 'Non-EB Claim Reports';
|
|
</script>
|
|
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row mb-3">
|
|
<div class="form-group col-md-3">
|
|
<label>Policy Type</label>
|
|
<select class="form-control" id="report_policy_type">
|
|
<option value="">All</option>
|
|
<?php if (isset($policy_types)): foreach ($policy_types as $pt): ?>
|
|
<option value="<?= $pt['id'] ?>"><?= $pt['policy_type'] ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label>Account Manager</label>
|
|
<select class="form-control" id="report_acm">
|
|
<option value="">All</option>
|
|
<?php if (isset($account_manager)): foreach ($account_manager as $am): ?>
|
|
<option value="<?= $am['first_name'] ?>"><?= $am['first_name'] ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label>Start Date</label>
|
|
<input type="text" class="form-control report-date" id="report_start_date" value="<?= $default_start ?? '' ?>" placeholder="dd-mm-yyyy">
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label>End Date</label>
|
|
<input type="text" class="form-control report-date" id="report_end_date" value="<?= $default_end ?? '' ?>" placeholder="dd-mm-yyyy">
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-12 text-right">
|
|
<button class="btn btn-primary" onclick="generateReport()">Generate Report</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-responsive" id="report_table_div">
|
|
<table data-custom-table-css="table" id="report-datatable" class="table w-100 nowrap table-centered" cellspacing="0">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th>S.No</th>
|
|
<th>Status</th>
|
|
<th>Policy Type</th>
|
|
<th>Claim Number</th>
|
|
<th>Nhance Ref</th>
|
|
<th>Client</th>
|
|
<th>Insurer</th>
|
|
<th>Loss Date</th>
|
|
<th>Nature of Loss</th>
|
|
<th>Loss Location</th>
|
|
<th>Loss Estimate</th>
|
|
<th>Surveyor</th>
|
|
<th>Loss Assessed</th>
|
|
<th>Settled Amount</th>
|
|
<th>ACM</th>
|
|
<th>Created Date</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
if (typeof flatpickr !== 'undefined') {
|
|
$('.report-date').flatpickr({ dateFormat: 'd-m-Y' });
|
|
}
|
|
|
|
if ($('#report-datatable').length) {
|
|
$('#report-datatable').DataTable({
|
|
scrollX: true,
|
|
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, -1], [10, 20, 50, 100, 'All']],
|
|
buttons: [
|
|
{ extend: 'csv', text: '<i class="mdi mdi-file-delimited"></i> CSV', className: 'app-btn-primary', title: 'Non-EB-Claim-Report' },
|
|
{ extend: 'excel', text: '<i class="mdi mdi-file-excel"></i> EXCEL', title: 'Non-EB-Claim-Report', sheetName: 'Claims Report', 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></div>',
|
|
searchPlaceholder: "Search",
|
|
emptyTable: '<div class="text-center text-muted">No Data found. Please generate a report.</div>'
|
|
},
|
|
paging: true, pageLength: 50, ordering: true,
|
|
});
|
|
$('.dataTables_length label').css('height', '21px');
|
|
}
|
|
});
|
|
|
|
function generateReport() {
|
|
var requestData = {
|
|
policy_type_id: $('#report_policy_type').val(),
|
|
acm_name: $('#report_acm').val(),
|
|
start_date: $('#report_start_date').val(),
|
|
end_date: $('#report_end_date').val(),
|
|
};
|
|
|
|
if (!requestData.start_date || !requestData.end_date) {
|
|
toastr.warning('Please select Start and End dates.');
|
|
return false;
|
|
}
|
|
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
var url = '<?= base_url("/non-eb-claim/reports") ?>';
|
|
|
|
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
|
if (response.status == true) {
|
|
var table = $('#report-datatable').DataTable();
|
|
table.clear();
|
|
if (response.data && response.data.length > 0) {
|
|
response.data.forEach(function(row, idx) {
|
|
table.row.add([
|
|
idx + 1,
|
|
row.status || 'N/A',
|
|
row.policy_type_name || 'N/A',
|
|
row.claim_number || 'N/A',
|
|
row.nhance_claim_ref_no || 'N/A',
|
|
row.client_name || 'N/A',
|
|
row.insurer_name || 'N/A',
|
|
row.loss_date || 'N/A',
|
|
row.nature_of_loss || 'N/A',
|
|
row.loss_location || 'N/A',
|
|
row.loss_estimate || '',
|
|
row.surveyor_name || '',
|
|
row.loss_assessed_value || '',
|
|
row.settled_amount || '',
|
|
row.acm_name || '',
|
|
row.ticket_created_date || '',
|
|
]);
|
|
});
|
|
}
|
|
table.draw();
|
|
} else {
|
|
toastr.error(response.message || 'Error fetching report', 'Error');
|
|
}
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
}, function() {
|
|
toastr.error('An error occurred.', 'Error');
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
}
|
|
</script>
|