diff --git a/app/Views/ticket_search.php b/app/Views/ticket_search.php index 9abd8e4e..171a6167 100644 --- a/app/Views/ticket_search.php +++ b/app/Views/ticket_search.php @@ -126,9 +126,8 @@
- - + +
@@ -227,6 +226,7 @@ function fetchTicketListData() { closeFilterNav(); + var ticket_type = $('#ticket_type').val(); var pod_no = $('#pod_no').val(); var claim_no = $('#claim_no').val(); @@ -242,9 +242,24 @@ var end_date = $('#endDate').val(); var date_type = $('#date_type').val(); + function isEmpty(value) { + return value === null || value === undefined || value.toString().trim() === '' || value == 0; + } + + if (isEmpty(claim_no) && isEmpty(emp_code) && isEmpty(claim_status) && isEmpty(emp_mobile_no) && isEmpty(tpa_id) && isEmpty(client_id) && isEmpty(insurer_id) && isEmpty(date_type)) { + toastr.warning('Please enter at least one search criteria.'); + return false; + } + + if (date_type) { + if (!start_date || !end_date) { + toastr.warning('Please select both Start Date and End Date.'); + return false; + } + } + var requestData = { ticket_type_id: ticket_type, - pod_no: pod_no, claim_number: claim_no, emp_code: emp_code, claim_status_id: claim_status, @@ -412,22 +427,24 @@ $('#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(''); + $('#claim_status').val('0').select2(); + $('#tpa_id').val('0').select2(); + $('#client_id').val('0').select2(); + $('#insurer_id').val('0').select2(); + // 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)); + // localStorage.setItem('filterData', JSON.stringify(filterData)); window.location.href = ""; });