242 lines
11 KiB
PHP
242 lines
11 KiB
PHP
<style>
|
|
.col-12 { max-width: 98% !important; }
|
|
.filter-sidebar {
|
|
height: 100%; width: 0; position: fixed; z-index: 1001; top: 0; right: 0;
|
|
background-color: #f8f9fa; overflow-x: hidden; transition: 0.5s;
|
|
box-shadow: -2px 0 5px rgba(0,0,0,0.1); display: flex; flex-direction: column;
|
|
}
|
|
.filter-sidebar-header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #dee2e6; flex-shrink: 0; }
|
|
.filter-sidebar-header .closebtn { font-size: 28px; text-decoration: none; color: #6c757d; }
|
|
.filter-sidebar .closebtn:hover { color: #000; }
|
|
.filter-sidebar-content { padding: 20px; flex-grow: 1; overflow-y: auto; }
|
|
.filter-sidebar-footer { padding: 15px 20px; display: flex; justify-content: flex-end; border-top: 1px solid #dee2e6; flex-shrink: 0; gap: 10px; }
|
|
</style>
|
|
|
|
<div id="claim-filter-sidebar" class="filter-sidebar">
|
|
<div class="filter-sidebar-header">
|
|
<h4 class="m-0">Filter</h4>
|
|
<a href="javascript:void(0)" class="closebtn" onclick="closeFilterNav()">×</a>
|
|
</div>
|
|
<div class="filter-sidebar-content">
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label for="filter_policy_type">Policy Type</label>
|
|
<select class="form-control" id="filter_policy_type" name="policy_type_id">
|
|
<option value="0">Select Policy Type</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-12">
|
|
<label for="filter_insurer">Insurer</label>
|
|
<select class="form-control" id="filter_insurer" name="insurer_id">
|
|
<option value="0">Select Insurer</option>
|
|
<?php if (isset($insurer_list)): foreach ($insurer_list as $ins): ?>
|
|
<option value="<?= $ins['id'] ?>"><?= $ins['name'] ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="filter_claim_no">Claim No</label>
|
|
<input type="text" class="form-control" id="filter_claim_no" name="claim_number">
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="filter_nhance_ref">Nhance Ref No</label>
|
|
<input type="text" class="form-control" id="filter_nhance_ref" name="nhance_claim_ref_no">
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="filter_client">Client Name</label>
|
|
<select class="form-control" id="filter_client" name="client_id">
|
|
<option value="0">Select Client</option>
|
|
<?php if (isset($client_list)): foreach ($client_list as $cl): ?>
|
|
<option value="<?= $cl['id'] ?>"><?= $cl['client_name'] ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="filter_claim_status">Status</label>
|
|
<select class="form-control" id="filter_claim_status" name="claim_status_id">
|
|
<option value="0">Select Status</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label>Date Type</label>
|
|
<select class="form-control" id="filter_date_type" name="date_type" onchange="toggleDateField()">
|
|
<option value="0">Select Date Type</option>
|
|
<?php if (isset($date_type)): foreach ($date_type as $k => $v): ?>
|
|
<option value="<?= $k ?>"><?= $v ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12" style="display:none;" id="date_div">
|
|
<label>Date</label>
|
|
<div class="input-icon">
|
|
<input type="text" id="reportrange" class="form-control" readonly style="caret-color:transparent;">
|
|
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
|
</div>
|
|
<input type="hidden" id="startDate">
|
|
<input type="hidden" id="endDate">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="filter-sidebar-footer">
|
|
<a href="#" class="btn btn-secondary" id="clear-filters" onclick="clearFilters()">Clear</a>
|
|
<a class="btn btn-primary" onclick="fetchClaimListData();">Submit</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row" id="claim_list_div">
|
|
<?php include('non_eb_claim_list.php'); ?>
|
|
</div>
|
|
|
|
<!-- Policy Type Selection Modal — commented out; Add button now goes directly to new claim page -->
|
|
<!-- <div class="modal fade" id="policyTypeModal" tabindex="-1" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Select Policy Type</h5>
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<select class="form-control" id="new_claim_policy_type">
|
|
<option value="">Select Policy Type</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="modal-footer">
|
|
<button class="btn btn-primary" onclick="goToNewClaim()">Proceed</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
<script>
|
|
var pageHideMainNavTitle = true;
|
|
var pageTitle = 'Non-EB Claims';
|
|
|
|
// function goToNewClaim() {
|
|
// var pt = $('#new_claim_policy_type').val();
|
|
// if (!pt) { toastr.warning('Please select a Policy Type'); return; }
|
|
// window.location.href = '<?= base_url("non-eb-claim/new/") ?>' + pt;
|
|
// }
|
|
function openFilterNav() { document.getElementById("claim-filter-sidebar").style.width = "350px"; }
|
|
function closeFilterNav() { document.getElementById("claim-filter-sidebar").style.width = "0"; }
|
|
function toggleDateField() {
|
|
var dt = $('#filter_date_type').val();
|
|
if (dt && dt != '0') { $('#date_div').show(); } else { $('#date_div').hide(); }
|
|
}
|
|
function clearFilters() {
|
|
$('#filter_policy_type').val('0');
|
|
$('#filter_insurer').val('0').trigger('change');
|
|
$('#filter_claim_no').val('');
|
|
$('#filter_nhance_ref').val('');
|
|
$('#filter_client').val('0').trigger('change');
|
|
$('#filter_claim_status').val('0').trigger('change');
|
|
$('#filter_date_type').val('0');
|
|
$('#date_div').hide();
|
|
localStorage.removeItem('nonEbFilterData');
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#filter_client').select2();
|
|
$('#filter_claim_status').select2();
|
|
$('#filter_insurer').select2();
|
|
});
|
|
|
|
var allClaimStatuses = <?= isset($claim_status) ? json_encode($claim_status) : '[]' ?>;
|
|
|
|
$('#filter_policy_type').on('change', function() {
|
|
var ptype = $(this).val();
|
|
$('#filter_claim_status').empty().append('<option value="">Select Status</option>');
|
|
for (var i = 0; i < allClaimStatuses.length; i++) {
|
|
if (allClaimStatuses[i]['ticket_type'] == ptype) {
|
|
$('#filter_claim_status').append($('<option>', {
|
|
value: allClaimStatuses[i]['id'],
|
|
text: allClaimStatuses[i]['claim_status']
|
|
}));
|
|
}
|
|
}
|
|
});
|
|
|
|
function fetchClaimListData() {
|
|
closeFilterNav();
|
|
|
|
var requestData = {
|
|
policy_type_id: $('#filter_policy_type').val(),
|
|
claim_number: $('#filter_claim_no').val(),
|
|
nhance_claim_ref_no: $('#filter_nhance_ref').val(),
|
|
claim_status_id: $('#filter_claim_status').val(),
|
|
client_id: $('#filter_client').val(),
|
|
insurer_id: $('#filter_insurer').val(),
|
|
start_date: $('#startDate').val(),
|
|
end_date: $('#endDate').val(),
|
|
date_type: $('#filter_date_type').val(),
|
|
};
|
|
|
|
function isEmpty(v) { return v === null || v === undefined || v.toString().trim() === '' || v == 0; }
|
|
|
|
if (isEmpty(requestData.policy_type_id) && isEmpty(requestData.claim_number) && isEmpty(requestData.nhance_claim_ref_no) && isEmpty(requestData.claim_status_id) && isEmpty(requestData.client_id) && isEmpty(requestData.insurer_id) && isEmpty(requestData.date_type)) {
|
|
toastr.warning('Please enter at least one search criteria.');
|
|
return false;
|
|
}
|
|
|
|
if (requestData.date_type && requestData.date_type != '0') {
|
|
if (!requestData.start_date || !requestData.end_date) { toastr.warning('Please select both dates.'); return false; }
|
|
}
|
|
|
|
localStorage.setItem('nonEbFilterData', JSON.stringify(requestData));
|
|
|
|
var url = '<?= base_url('/non-eb-claim/list') ?>';
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
|
|
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
|
if (response.status == true) {
|
|
$('#claim_list_div').empty().html(response.html);
|
|
} else {
|
|
toastr.error(response.message || 'Error', 'Error');
|
|
}
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
}, function(xhr, status, error) {
|
|
console.error('Error:', error);
|
|
toastr.error('An error occurred.', 'Error');
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
let filterData = localStorage.getItem('nonEbFilterData');
|
|
filterData = filterData ? JSON.parse(filterData) : null;
|
|
if (filterData) {
|
|
var url = '<?= base_url('/non-eb-claim/list') ?>';
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
sendAjaxRequestForGlobal(url, 'POST', filterData, function(response) {
|
|
if (response.status == true) { $('#claim_list_div').empty().html(response.html); }
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
}, function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); });
|
|
|
|
$('#filter_policy_type').val(filterData.policy_type_id);
|
|
$('#filter_claim_no').val(filterData.claim_number);
|
|
$('#filter_nhance_ref').val(filterData.nhance_claim_ref_no);
|
|
$('#filter_client').val(filterData.client_id);
|
|
$('#filter_insurer').val(filterData.insurer_id);
|
|
$('#filter_date_type').val(filterData.date_type);
|
|
}
|
|
});
|
|
</script>
|