453 lines
16 KiB
PHP
453 lines
16 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="ticket-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="ticket_type"> Claim Type <span class="text-danger"></span></label>
|
|
<select class="form-control" id="ticket_type" name="ticket_type">
|
|
<option value="0">Select claim Type</option>
|
|
<?php
|
|
if (isset($ticket_type) && count($ticket_type)) {
|
|
foreach ($ticket_type as $key => $value) {
|
|
echo "<option value='" . $key . "'>" . $value . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
|
|
<select class="form-control" id="insurer_id" name="insurer_id">
|
|
<option value="0">Select Insurer</option>
|
|
<?php
|
|
if (isset($insurer_list) && count($insurer_list)) {
|
|
foreach ($insurer_list as $key => $value) {
|
|
echo "<option value='" . $value['id'] . "'>" . $value['name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="tpa_id">TPA<span class="text-danger"></span></label>
|
|
<select class="form-control" id="tpa_id" name="tpa_id">
|
|
<option value="0">Select TPA</option>
|
|
<?php
|
|
if (isset($tpa_list) && count($tpa_list)) {
|
|
foreach ($tpa_list as $key => $value) {
|
|
echo "<option value='" . $value['id'] . "'>" . $value['name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="claim_no">Claim No<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="claim_no" name="claim_no">
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="client_id"> Corporate Name <span class="text-danger"></span></label>
|
|
<select class="form-control" id="client_id" name="client_id">
|
|
<option value="0">Select Corporate</option>
|
|
<?php
|
|
if (isset($client_list) && count($client_list)) {
|
|
foreach ($client_list as $key => $value) {
|
|
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="emp_code">Employee ID<span class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="emp_code" name="emp_code">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="emp_mobile_no">Employee Mobile No<span
|
|
class="text-danger"></span></label>
|
|
<input type="text" class="form-control" id="emp_mobile_no" name="emp_mobile_no">
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="claim_status">Status<span class="text-danger"></span></label>
|
|
<select class="form-control" id="claim_status" name="claim_status">
|
|
<option value="0">Select status</option>
|
|
<?php /*
|
|
if (isset($claim_status) && count($claim_status)) {
|
|
foreach ($claim_status as $key => $value) {
|
|
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
|
|
}
|
|
}
|
|
*/ ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label>Date Type<span class="text-danger"></span></label>
|
|
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
|
|
<option value="0">Select Date Type</option>
|
|
<?php
|
|
if (isset($date_type) && count($date_type)) {
|
|
foreach ($date_type as $key => $value) {
|
|
echo "<option value='" . $key . "'>" . $value . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12" style="display: none;" id="date_div">
|
|
<label>Date<span class="text-danger"></span></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">Clear</a>
|
|
<a class="btn btn-primary" id="get-emp-list" onclick="fetchTicketListData();">Submit</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row" id="ticket_list_div">
|
|
<?php include('ticket_list.php'); ?>
|
|
</div>
|
|
|
|
|
|
<!-- end page title -->
|
|
|
|
<script>
|
|
function openTicketFilterNav() {
|
|
document.getElementById("ticket-filter-sidebar").style.width = "350px";
|
|
}
|
|
|
|
function closeFilterNav() {
|
|
document.getElementById("ticket-filter-sidebar").style.width = "0";
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Initialize select2
|
|
$('#client_id').select2();
|
|
$('#claim_status').select2();
|
|
$('#insurer_id').select2();
|
|
$('#tpa_id').select2();
|
|
|
|
|
|
});
|
|
|
|
$('#ticket_type').on('change', function() {
|
|
var ticket_type = $('#ticket_type').val();
|
|
var claim_status = <?= isset($claim_status) ? json_encode($claim_status) : '[]' ?>;
|
|
$('#claim_status').empty();
|
|
$('#claim_status').append($('<option>', {
|
|
value: '',
|
|
text: 'Select Claim Status'
|
|
}));
|
|
|
|
// console.log('Claim Status:', claim_status);
|
|
for (var i = 0; i < claim_status.length; i++) {
|
|
if (claim_status[i]['ticket_type'] == ticket_type) {
|
|
$('#claim_status').append($('<option>', {
|
|
value: claim_status[i]['id'], // Use 'id' as the value
|
|
text: claim_status[i]['claim_status'] // Use 'claim_status' as the text
|
|
}));
|
|
}
|
|
}
|
|
})
|
|
|
|
function fetchTicketListData() {
|
|
closeFilterNav();
|
|
var ticket_type = $('#ticket_type').val();
|
|
var pod_no = $('#pod_no').val();
|
|
var claim_no = $('#claim_no').val();
|
|
var emp_code = $('#emp_code').val();
|
|
var claim_status = $('#claim_status').val();
|
|
var emp_mobile_no = $('#emp_mobile_no').val();
|
|
var tpa_id = $('#tpa_id').val();
|
|
var client_id = $('#client_id').val();
|
|
var insurer_id = $('#insurer_id').val();
|
|
var tpa_id = $('#tpa_id').val();
|
|
|
|
var start_date = $('#startDate').val();
|
|
var end_date = $('#endDate').val();
|
|
var date_type = $('#date_type').val();
|
|
|
|
var requestData = {
|
|
ticket_type_id: ticket_type,
|
|
pod_no: pod_no,
|
|
claim_number: claim_no,
|
|
emp_code: emp_code,
|
|
claim_status_id: claim_status,
|
|
emp_mobile: emp_mobile_no,
|
|
tpa_id: tpa_id,
|
|
client_id: client_id,
|
|
insurer_id: insurer_id,
|
|
tpa_id: tpa_id,
|
|
start_date: start_date,
|
|
end_date: end_date,
|
|
date_type: date_type,
|
|
};
|
|
|
|
let filterData = requestData;
|
|
localStorage.setItem('filterData', JSON.stringify(filterData));
|
|
|
|
console.log("requestData", requestData);
|
|
|
|
var url = '<?= base_url('/ticket/list') ?>';
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
|
|
|
console.log('Filter Responce', response);
|
|
|
|
if (response.status == true) {
|
|
$('#ticket_list_div').empty();
|
|
$('#ticket_list_div').html(response.html);
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
|
|
} else {
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
let message = response.message;
|
|
toastr.error(message, 'Error');
|
|
}
|
|
|
|
}, function(xhr, status, error) {
|
|
console.error('Error fetching data:', error);
|
|
console.error(xhr.responseText);
|
|
toastr.error('An error occurred while fetching the data.', 'Error');
|
|
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
let filterData = localStorage.getItem('filterData');
|
|
|
|
filterData = filterData ? JSON.parse(filterData) : null;
|
|
|
|
console.log('Filter Data', filterData);
|
|
|
|
if (filterData) {
|
|
|
|
var url = '<?= base_url('/ticket/list') ?>';
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
sendAjaxRequestForGlobal(url, 'POST', filterData, function(response) {
|
|
|
|
console.log('Filter Responce', response);
|
|
|
|
if (response.status == true) {
|
|
$('#ticket_list_div').empty();
|
|
$('#ticket_list_div').html(response.html);
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
|
|
} else {
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
let message = response.message;
|
|
toastr.error(message, 'Error');
|
|
}
|
|
|
|
}, function(xhr, status, error) {
|
|
console.error('Error fetching data:', error);
|
|
console.error(xhr.responseText);
|
|
toastr.error('An error occurred while fetching the data.', 'Error');
|
|
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
|
|
$('#ticket_type').val(filterData.ticket_type_id);
|
|
$('#pod_no').val(filterData.pod_no);
|
|
$('#claim_no').val(filterData.claim_number);
|
|
$('#emp_code').val(filterData.emp_code);
|
|
$('#claim_status').val(filterData.claim_status_id);
|
|
$('#emp_mobile_no').val(filterData.emp_mobile);
|
|
$('#tpa_id').val(filterData.tpa_id);
|
|
$('#client_id').val(filterData.client_id);
|
|
$('#insurer_id').val(filterData.insurer_id);
|
|
$('#tpa_id').val(filterData.tpa_id);
|
|
$('#date_type').val(filterData.date_type);
|
|
if(filterData.date_type == '0'){
|
|
$('#date_div').hide();
|
|
}else{
|
|
$('#date_div').show();
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<script>
|
|
|
|
$(function() {
|
|
|
|
const url = new URL(window.location.href);
|
|
const params = new URLSearchParams(url.search);
|
|
|
|
// Get start and end dates from URL parameters, or use default values
|
|
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
|
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
|
|
|
// Parse the dates to moment objects
|
|
var start = moment(startDateParam, 'DD-MM-YYYY');
|
|
var end = moment(endDateParam, 'DD-MM-YYYY');
|
|
|
|
// var start = moment().subtract(29, 'days');
|
|
// var end = moment();
|
|
|
|
function cb(start, end) {
|
|
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
|
$('#startDate').val(start.format('DD-MM-YYYY'));
|
|
$('#endDate').val(end.format('DD-MM-YYYY'));
|
|
}
|
|
|
|
$('#reportrange').daterangepicker({
|
|
startDate: start,
|
|
endDate: end,
|
|
locale: {
|
|
format: 'DD-MM-YYYY'
|
|
},
|
|
ranges: {
|
|
'Today': [moment(), moment()],
|
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
|
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
}
|
|
}, cb);
|
|
|
|
cb(start, end);
|
|
|
|
|
|
$(document).on('click', '#clear-filters', function(e) {
|
|
|
|
e.preventDefault(); // Stops the browser from following the link
|
|
|
|
console.log('Clear Filters Area');
|
|
|
|
localStorage.removeItem('filterData');
|
|
|
|
$('#ticket_type').val('0');
|
|
$('#pod_no').val('');
|
|
$('#claim_no').val('');
|
|
$('#emp_code').val('');
|
|
$('#claim_status').val('0');
|
|
$('#emp_mobile_no').val('');
|
|
$('#tpa_id').val('0');
|
|
$('#client_id').val('0');
|
|
$('#insurer_id').val('0');
|
|
$('#date_div').hide();
|
|
$('#date_type').val('0');
|
|
$('#start_date').val('');
|
|
$('#end_date').val('');
|
|
|
|
// Reset the date range picker to default
|
|
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
|
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
|
cb(start, end); // Update the displayed date range
|
|
|
|
localStorage.setItem('filterData', JSON.stringify(filterData));
|
|
window.location.href = "<?= base_url("/ticket/list") ?>";
|
|
});
|
|
|
|
});
|
|
|
|
function hideDateField(input = null)
|
|
{
|
|
let val = $('#date_type').val();
|
|
|
|
if(input){
|
|
val = input;
|
|
}
|
|
|
|
if(val != 0){
|
|
$('#date_div').show();
|
|
}else{
|
|
$('#date_div').hide();
|
|
$('#start_date').val('');
|
|
$('#end_date').val('');
|
|
}
|
|
}
|
|
|
|
</script>
|