LT-412: Study list needs default date filter
This commit is contained in:
parent
46360c0c95
commit
5d8c608e70
@ -158,7 +158,12 @@ export const UISettings = new SimpleSchema({
|
||||
type: String,
|
||||
label: 'Auto position text call-outs for measurements when creating them.',
|
||||
defaultValue: 'TRBL'
|
||||
}
|
||||
},
|
||||
studyListDateFilterNumDays: {
|
||||
type: Number,
|
||||
label: 'Number of days to be used on Study List date filter',
|
||||
min: 1
|
||||
}
|
||||
});
|
||||
|
||||
export const PublicServerConfig = new SimpleSchema({
|
||||
|
||||
@ -234,9 +234,20 @@ Template.studylistResult.onRendered(() => {
|
||||
const today = moment();
|
||||
const lastWeek = moment().subtract(6, 'days');
|
||||
const lastMonth = moment().subtract(29, 'days');
|
||||
const datePicker = instance.$('#studyDate').daterangepicker({
|
||||
const $studyDate = instance.$('#studyDate');
|
||||
const dateFilterNumDays = OHIF.uiSettings.studyListDateFilterNumDays;
|
||||
let startDate, endDate;
|
||||
|
||||
if (dateFilterNumDays) {
|
||||
startDate = moment().subtract(dateFilterNumDays - 1, 'days');
|
||||
endDate = today;
|
||||
}
|
||||
|
||||
const datePicker = $studyDate.daterangepicker({
|
||||
maxDate: today,
|
||||
autoUpdateInput: true,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
ranges: {
|
||||
Today: [today, today],
|
||||
'Last 7 Days': [lastWeek, today],
|
||||
@ -244,8 +255,13 @@ Template.studylistResult.onRendered(() => {
|
||||
}
|
||||
}).data('daterangepicker');
|
||||
|
||||
// Retrieve all studies
|
||||
search();
|
||||
if (startDate && endDate) {
|
||||
datePicker.updateInputText();
|
||||
$studyDate.trigger('change');
|
||||
} else {
|
||||
// Retrieve all studies
|
||||
search();
|
||||
}
|
||||
});
|
||||
|
||||
function resetSortingColumns(instance, sortingColumn) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user