This commit is contained in:
Dr Masroor Ehsan 2025-01-21 11:33:40 +06:00
parent b58abde84b
commit 9341a69db6

View File

@ -155,17 +155,37 @@ function generateUrl() {
resetParams(); resetParams();
const ranges = [ const ranges = [
{picker: fp_study, from: '_study_from', to: '_study_to'}, {picker: fp_study, type: 'study'},
{picker: fp_receive, from: '_receive_from', to: '_receive_to'}, {picker: fp_receive, type: 'receive'},
{picker: fp_assign, from: '_assign_from', to: '_assign_to'}, {picker: fp_assign, type: 'assign'},
{picker: fp_read, from: '_read_from', to: '_read_to'} {picker: fp_read, type: 'read'}
]; ];
ranges.forEach(range => { ranges.forEach(range => {
const selectedDates = range.picker.selectedDates; const selectedDates = range.picker.selectedDates;
if (selectedDates.length === 2) { if (selectedDates.length === 2) {
window[range.from] = formatDate(selectedDates[0]); const fromDate = formatDate(selectedDates[0]);
window[range.to] = formatDate(selectedDates[1]); 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;
}
} }
}); });