JS optim
This commit is contained in:
parent
9341a69db6
commit
9892f4431d
@ -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;
|
_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() {
|
function generateUrl() {
|
||||||
const url = new URL("{{ route('staff.worklist.index') }}");
|
const url = new URL("{{ route('staff.worklist.index') }}");
|
||||||
if (_status) url.searchParams.set('status', _status);
|
const params = { _status, _study_from, _study_to, _receive_from, _receive_to, _assign_from, _assign_to, _read_from, _read_to, _modality, _read_by };
|
||||||
if (_study_from) url.searchParams.set('study_from', _study_from);
|
Object.keys(params).forEach(key => {
|
||||||
if (_study_to) url.searchParams.set('study_to', _study_to);
|
if (params[key]) url.searchParams.set(strip_dash(key), params[key]);
|
||||||
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);
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user