diff --git a/resources/views/staff/worklist/index.blade.php b/resources/views/staff/worklist/index.blade.php index d05b375..6378253 100644 --- a/resources/views/staff/worklist/index.blade.php +++ b/resources/views/staff/worklist/index.blade.php @@ -116,19 +116,14 @@ function resetParams() { _status, _study_from, _study_to, _receive_from, _receive_to, _assign_from, _assign_to, _read_from, _read_to, _modality, _read_by = null; } + const strip_dash = str => str.replace(/^_/, ''); + function generateUrl() { const url = new URL("{{ route('staff.worklist.index') }}"); - if (_status) url.searchParams.set('status', _status); - if (_study_from) url.searchParams.set('study_from', _study_from); - if (_study_to) url.searchParams.set('study_to', _study_to); - if (_receive_from) url.searchParams.set('receive_from', _receive_from); - if (_receive_to) url.searchParams.set('receive_to', _receive_to); - if (_assign_from) url.searchParams.set('assign_from', _assign_from); - if (_assign_to) url.searchParams.set('assign_to', _assign_to); - if (_read_from) url.searchParams.set('read_from', _read_from); - if (_read_to) url.searchParams.set('read_to', _read_to); - if (_modality) url.searchParams.set('modality', _modality); - if (_read_by) url.searchParams.set('read_by', _read_by); + const params = { _status, _study_from, _study_to, _receive_from, _receive_to, _assign_from, _assign_to, _read_from, _read_to, _modality, _read_by }; + Object.keys(params).forEach(key => { + if (params[key]) url.searchParams.set(strip_dash(key), params[key]); + }); return url.toString(); }