LT-412: Study list needs default date filter

This commit is contained in:
Leonardo Campos 2017-02-14 23:50:46 -02:00
parent 46360c0c95
commit 5d8c608e70
2 changed files with 25 additions and 4 deletions

View File

@ -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({

View File

@ -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) {