Skip to content

Commit

Permalink
Added a way of choosing custom date range for time filter
Browse files Browse the repository at this point in the history
  • Loading branch information
k-joseph committed Jul 9, 2015
1 parent 1d03968 commit 1474c44
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
20 changes: 20 additions & 0 deletions omod/src/main/webapp/fragments/topArea.gsp
Expand Up @@ -10,6 +10,9 @@
jq('#searchText').focus();
jq("#chart-previous-searches-display").hide();
jq("#custom-date-dialog-content").hide();
jq("#ui-datepicker-start").datepicker();
jq("#ui-datepicker-stop").datepicker();
showHistorySuggestionsOnLoad();
displayBothPersonalAndGlobalNotes();
Expand Down Expand Up @@ -266,6 +269,18 @@
}
});
jq("#ui-datepicker-stop").change(function(event) {
var start = jq("#ui-datepicker-start").val();
var stop = jq("#ui-datepicker-stop").val();
var startDate = new Date(start);
var stopDate = new Date(stop);
if(stopDate.setHours(0, 0, 0, 0) > startDate.setHours(0, 0, 0, 0)) {
jq("#submit-custom-date-filter").removeAttr('disabled');
} else {
jq("#submit-custom-date-filter").attr('disabled','disabled');
}
});
});
Expand Down Expand Up @@ -748,6 +763,11 @@
<a class="single_filter_option" onclick="filterResultsUsingTime('custom')">Custom</a>
<a class="single_filter_option" onclick="filterResultsUsingTime('anyTime')">Any Time</a>
</div>
<div id="custom-date-dialog-content">
<p>Start: <input type="text" id="ui-datepicker-start"></p><br />
<p>Stop: <input type="text" id="ui-datepicker-stop"></p><br />
<p><input type="button" id="submit-custom-date-filter" value="Submit" disabled /></p>
</div>
</div>
</div>
<div class="dropdown" id="location_dropdown">
Expand Down
6 changes: 4 additions & 2 deletions omod/src/main/webapp/resources/scripts/views_factory.js
Expand Up @@ -1210,7 +1210,7 @@ function refresh_data(json) {
if (numberOfResults === 0 && json.searchSuggestions.length > 0
&& json.search_phrase === "") {
noResultsMessageNote = "<br /><br /><br /><br /><p style='color:black;'><b>NOTE:</b> If this is the first time you are accessing this patient's chart, <b>Indexing patient data could still be in progress. </b>"
+ "So refresh the page a few moments from now. Otherwise the <b>patient has no data</b> (observations, allergies and appointments) in the Database</p>";
+ "So refresh the page a few moments from now. Otherwise the <b>patient has no data</b> (observations, allergies and appointments) that matches the current search or filter tried</p>";
}

if (noResultsMessageNote !== "") {
Expand Down Expand Up @@ -1616,7 +1616,7 @@ function filterResultsUsingTime(selectedPeriod) {
var selectedPeriodText = "Any Time";

if (selectedPeriod === "custom") {// TODO custom implementation

invokeDialog("#custom-date-dialog-content", "Choose Date Range", "245px")
} else {// TODO non custom time
if (selectedPeriod === "anyTime") {
// do nothing
Expand Down Expand Up @@ -1687,6 +1687,8 @@ function filterResultsUsingTime(selectedPeriod) {
selectedPeriodText = "Last 3 Months";
} else if (selectedPeriod === "thisYear") {
selectedPeriodText = "This Year";
} else if(selectedPeriod === "custom") {
selectedPeriodText = "Custom";
}
$("#time_anchor").text(selectedPeriodText);
}
Expand Down

0 comments on commit 1474c44

Please sign in to comment.