From 9341a69db6585e014cb5268fa456b9f45b6fc3d9 Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Tue, 21 Jan 2025 11:33:40 +0600 Subject: [PATCH] FIX js --- .../views/staff/worklist/index.blade.php | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/resources/views/staff/worklist/index.blade.php b/resources/views/staff/worklist/index.blade.php index 63928c6..d05b375 100644 --- a/resources/views/staff/worklist/index.blade.php +++ b/resources/views/staff/worklist/index.blade.php @@ -155,17 +155,37 @@ function generateUrl() { resetParams(); const ranges = [ - {picker: fp_study, from: '_study_from', to: '_study_to'}, - {picker: fp_receive, from: '_receive_from', to: '_receive_to'}, - {picker: fp_assign, from: '_assign_from', to: '_assign_to'}, - {picker: fp_read, from: '_read_from', to: '_read_to'} + {picker: fp_study, type: 'study'}, + {picker: fp_receive, type: 'receive'}, + {picker: fp_assign, type: 'assign'}, + {picker: fp_read, type: 'read'} ]; ranges.forEach(range => { const selectedDates = range.picker.selectedDates; if (selectedDates.length === 2) { - window[range.from] = formatDate(selectedDates[0]); - window[range.to] = formatDate(selectedDates[1]); + const fromDate = formatDate(selectedDates[0]); + const toDate = formatDate(selectedDates[1]); + + switch (range.type) { + case 'study': + _study_from = fromDate; + _study_to = toDate; + break; + case 'receive': + _receive_from = fromDate; + _receive_to = toDate; + break; + case 'assign': + _assign_from = fromDate; + _assign_to = toDate; + break; + case 'read': + _read_from = fromDate; + _read_to = toDate; + break; + } + } });