diff --git a/LesionTracker/.meteor/packages b/LesionTracker/.meteor/packages index 63fce995c..0ce8afcad 100644 --- a/LesionTracker/.meteor/packages +++ b/LesionTracker/.meteor/packages @@ -50,3 +50,4 @@ anti:gagarin@=0.4.11 check aldeed:template-extension@4.0.0 zuuk:stale-session +gilbertwat:bootstrap3-daterangepicker diff --git a/LesionTracker/.meteor/versions b/LesionTracker/.meteor/versions index dd2fc3354..3743c3e28 100644 --- a/LesionTracker/.meteor/versions +++ b/LesionTracker/.meteor/versions @@ -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 diff --git a/Packages/worklist/client/components/worklistResult/worklistResult.html b/Packages/worklist/client/components/worklistResult/worklistResult.html index 8d8842074..c96a0950c 100644 --- a/Packages/worklist/client/components/worklistResult/worklistResult.html +++ b/Packages/worklist/client/components/worklistResult/worklistResult.html @@ -20,7 +20,7 @@
Study Date
- + {{#unless isTouchDevice}} diff --git a/Packages/worklist/client/components/worklistResult/worklistResult.js b/Packages/worklist/client/components/worklistResult/worklistResult.js index 2df880305..5e631851d 100644 --- a/Packages/worklist/client/components/worklistResult/worklistResult.js +++ b/Packages/worklist/client/components/worklistResult/worklistResult.js @@ -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(); } }); diff --git a/Packages/worklist/client/components/worklistResult/worklistResult.styl b/Packages/worklist/client/components/worklistResult/worklistResult.styl index 9f3edb1e7..32a1bc298 100644 --- a/Packages/worklist/client/components/worklistResult/worklistResult.styl +++ b/Packages/worklist/client/components/worklistResult/worklistResult.styl @@ -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