From 1855784d366bcd3628e93a754c1a76cb5d37ee0b Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Sat, 24 Aug 2019 13:56:54 -0400 Subject: [PATCH] LP#1841089 Apply button in Patron Bill History screen in a confusing location It's possible to miss the apply button for the date range in bill history because it's located before the datepickers. The interface also allows invalid date ranges. This removes the apply button and watches the start and finish dates. If it's not first init and they are valid date objects in a valid date range, the grid refreshes with the new date range query. If start > finish they are set equal to each other to force a valid range. Signed-off-by: Dan Briem --- .../templates/staff/circ/patron/t_bill_history.tt2 | 4 ---- Open-ILS/web/js/ui/default/staff/circ/patron/bills.js | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 index d9c454397d..77cd4f9a2f 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 @@ -25,10 +25,6 @@ {{totals.selected_paid() | currency}} -
- -
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js index 308fb309ea..1842c9e2c4 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js @@ -1010,6 +1010,25 @@ function($scope, $q , egCore , patronSvc , billSvc , egPromptDialog , $location setQuery : current_grid_query } + $scope.$watch('dates.xact_start', function(new_date, old_date) { + if (new_date !== old_date && new_date) { + if (new_date.getTime() > $scope.dates.xact_finish.getTime()) { + $scope.dates.xact_finish = new_date; + } else { + $scope.actions.apply_date_range(); + } + } + }); + $scope.$watch('dates.xact_finish', function(new_date, old_date) { + if (new_date !== old_date && new_date) { + if (new_date.getTime() < $scope.dates.xact_start.getTime()) { + $scope.dates.xact_start = new_date; + } else { + $scope.actions.apply_date_range(); + } + } + }); + $scope.actions.apply_date_range = function() { // tells the grid to re-draw itself with the new query $scope.gridControls.setQuery(current_grid_query()); -- 2.11.0