LT-63 & LT-70: Study list shall have option today and study date range (from/to) to limit

This commit is contained in:
Aysel Afsar 2016-02-19 14:26:38 -05:00
parent 37c893004c
commit fb7024d20e
5 changed files with 38 additions and 9 deletions

View File

@ -50,3 +50,4 @@ anti:gagarin@=0.4.11
check
aldeed:template-extension@4.0.0
zuuk:stale-session
gilbertwat:bootstrap3-daterangepicker

View File

@ -48,6 +48,7 @@ es5-shim@4.1.14
fastclick@1.0.7
fortawesome:fontawesome@4.5.0
geojson-utils@1.0.4
gilbertwat:bootstrap3-daterangepicker@1.3.21_1
grove:less@0.1.1
hangingprotocols@0.0.1
hot-code-push@1.0.0

View File

@ -20,7 +20,7 @@
<th>
<h5>Study Date</h5>
<input type="text" class="form-control worklist-search" id="studyDate">
<input type="text" class="form-control worklist-search" name="daterange" id="studyDate" style="padding: 0;">
</th>
{{#unless isTouchDevice}}

View File

@ -18,8 +18,6 @@ search();
var studyDateFrom;
var studyDateTo;
var checkFrom = false;
var checkTo = false;
var filter;
/**
@ -66,7 +64,7 @@ function convertStringToStudyDate(dateStr) {
var y = dateStr.substring(0, 4);
var m = dateStr.substring(4, 6);
var d = dateStr.substring(6, 8);
var newDateStr = y + '/' + m + '/' + d;
var newDateStr = m + '/' + d + '/' + y;
return new Date(newDateStr);
}
@ -99,19 +97,19 @@ function search() {
if (!studies) {
return;
}
// Loop through all identified studies
studies.forEach(function(study) {
// Search the rest of the parameters that aren't done via the server call
if (isIndexOf(study.modalities, modality) &&
(new Date(studyDateFrom).setHours(0, 0, 0, 0) <= convertStringToStudyDate(study.studyDate) || !checkFrom) &&
(convertStringToStudyDate(study.studyDate) <= new Date(studyDateTo).setHours(0, 0, 0, 0) || !checkTo)) {
(new Date(studyDateFrom).setHours(0, 0, 0, 0) <= convertStringToStudyDate(study.studyDate) || !studyDateFrom || studyDateFrom === "") &&
(convertStringToStudyDate(study.studyDate) <= new Date(studyDateTo).setHours(0, 0, 0, 0) || !studyDateTo || studyDateTo === "")) {
// Insert any matching studies into the WorklistStudies Collection
WorklistStudies.insert(study);
}
});
});
}
@ -124,6 +122,17 @@ Template.worklistResult.onCreated(function() {
}
});
Template.worklistResult.onRendered(function() {
// Initialize daterangepicker
$("#studyDate").daterangepicker({
ranges: {
'Today': [moment(), moment()],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
}
});
});
Template.worklistResult.events({
'keydown input': function(e) {
if (e.which === 13) { // Enter
@ -132,6 +141,17 @@ Template.worklistResult.events({
},
'onsearch input': function() {
search();
},
'change #studyDate': function(e, template) {
var dateRange = $(e.currentTarget).val();
// Remove all space chars
dateRange = dateRange.replace(/ /g,'');
// Split dateRange into subdates
var dates = dateRange.split("-");
studyDateFrom = dates[0];
studyDateTo = dates[1];
search();
}
});

View File

@ -6,10 +6,11 @@ table#tblStudyList
thead
background-color: black
white-space: nowrap
&:hover
color: #888888
// TODO: Use padding instead of hidden inputs to keep titles
// at the same height in the header.
#numImages.worklist-search
@ -20,6 +21,12 @@ table#tblStudyList
background-color: #888888
width: 100%
::-webkit-datetime-edit-year-field:not([aria-valuenow]),
::-webkit-datetime-edit-month-field:not([aria-valuenow]),
::-webkit-datetime-edit-day-field:not([aria-valuenow]) {
color: transparent;
}
tbody
tr
height: 20px