webstaff: wire the date filter into the payments grid in billing xact history
authorJason Etheridge <jason@esilibrary.com>
Fri, 27 Feb 2015 05:20:24 +0000 (00:20 -0500)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:11 +0000 (13:39 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>

Open-ILS/web/js/ui/default/staff/circ/patron/bills.js

index 1546edc..2c7d18d 100644 (file)
@@ -708,6 +708,14 @@ function($scope,  $q , egCore , patronSvc , billSvc , egPromptDialog , $location
        ['$scope','$q','egCore','patronSvc','billSvc','$location',
 function($scope,  $q , egCore , patronSvc , billSvc , $location) {
 
+    // generate a grid query with the current date widget values.
+    function current_grid_query() {
+        return {
+            'payment_ts' : {between : $scope.date_range()},
+            'xact.usr' : billSvc.userId
+        }
+    }
+
     $scope.gridControls = {
         selectedItems : function(){return []},
         activateItem : function(item) {
@@ -716,12 +724,12 @@ function($scope,  $q , egCore , patronSvc , billSvc , $location) {
         setSort : function() {
             return [{'payment_ts' : 'DESC'}, 'id'];
         },
-        setQuery : function() {
-            return {
-                'payment_ts' : {between : $scope.date_range()},
-                'xact.usr' : billSvc.userId
-            }
-        }
+        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());
     }
 
     $scope.showFullDetails = function(all) {