From 69c2483f3272b112e2978ec3ea2d132cc4ad282f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 11 Feb 2015 10:54:22 -0500 Subject: [PATCH] webstaff: Apply date filter range on command in billing xact history Adds an Apply button for apply changes to the date filter to the grid. Signed-off-by: Bill Erickson Signed-off-by: Jason Etheridge Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../staff/circ/patron/t_bill_history.tt2 | 1 + .../js/ui/default/staff/circ/patron/bills.js | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 11 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 6739d7e6bf..aef6084274 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 @@ -21,6 +21,7 @@
[% l('Selected Paid:') %]
{{totals.selected_paid() | currency}}
+
[% l('Start Date:') %]
[% l('End Date:') %]
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 1d6f37123e..1546edcd61 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 @@ -612,6 +612,9 @@ function($scope, $q , $routeParams , egCore , patronSvc , billSvc , egPromptDia $scope.bill_tab = $routeParams.history_tab; $scope.totals = {}; + // link page controller actions defined by sub-controllers here + $scope.actions = {}; + var start = new Date(); // now - 1 year start.setFullYear(start.getFullYear() - 1), $scope.dates = { @@ -633,24 +636,31 @@ function($scope, $q , $routeParams , egCore , patronSvc , billSvc , egPromptDia ['$scope','$q','egCore','patronSvc','billSvc','egPromptDialog','$location','egBilling', function($scope, $q , egCore , patronSvc , billSvc , egPromptDialog , $location , egBilling) { + // generate a grid query with the current date widget values. + function current_grid_query() { + return { + '-or' : [ + {'summary.balance_owed' : {'<>' : 0}}, + {'summary.last_payment_ts' : {'<>' : null}} + ], + xact_start : {between : $scope.date_range()}, + usr : billSvc.userId + } + } + $scope.gridControls = { selectedItems : function(){return []}, activateItem : function(item) { $scope.showFullDetails([item]); }, - setQuery : function() { - // open-ils.actor.user.transactions.history.have_bill_or_payment - return { - '-or' : [ - {'summary.balance_owed' : {'<>' : 0}}, - {'summary.last_payment_ts' : {'<>' : null}} - ], - xact_start : {between : $scope.date_range()}, - usr : billSvc.userId - } - } + // this sets the query on page load + setQuery : current_grid_query } + $scope.actions.apply_date_range = function() { + // tells the grid to re-draw itself with the new query + $scope.gridControls.setQuery(current_grid_query()); + } // TODO; move me to service function selected_payment_info() { -- 2.43.2