From c76310d9512b64dab0a9717839804787f7235661 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Sun, 4 Oct 2015 22:05:58 -0400 Subject: [PATCH] webstaff: users with negative balance Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../staff/admin/local/circ/neg_balance_users.tt2 | 55 ++++++++++++++++++++++ .../src/templates/staff/admin/local/t_splash.tt2 | 18 ++++--- .../staff/admin/local/circ/neg_balance_users.js | 46 ++++++++++++++++++ 3 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js diff --git a/Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2 b/Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2 new file mode 100644 index 0000000000..73d7ec85da --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2 @@ -0,0 +1,55 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Users with Negative Balances"); + ctx.page_app = "egAdminCirc"; + ctx.page_ctrl = 'NegBalances'; +%] + +[% BLOCK APP_JS %] + + + + +[% END %] + +
+
+ [% l('Patrons with Negative Balances') %] +
+
+ +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + +[% END %] diff --git a/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 b/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 index 8aa67de9af..c55235fe9b 100644 --- a/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 @@ -22,8 +22,8 @@ @@ -42,8 +42,8 @@ @@ -62,8 +62,8 @@ @@ -80,6 +80,12 @@ [% l('Field Documentation') %] +
diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js b/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js new file mode 100644 index 0000000000..43fa8780b8 --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js @@ -0,0 +1,46 @@ + +angular.module('egAdminCirc', + ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod']) + +.controller('NegBalances', + ['$scope','$q','$timeout','$location','$window','egCore','egGridDataProvider', +function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvider) { + + egCore.startup.go(); // standalone mode requires manual startup + + $scope.grid_provider = egGridDataProvider.instance({}); + + // API does not currenlty support paging, so it's all or none. + $scope.grid_provider.get = function(offset, count) { + if (!$scope.context_org) return $q.when(); + + var deferred = $q.defer(); + + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.users.negative_balance', + egCore.auth.token(), $scope.context_org.id()) + .then(deferred.resolve, null, deferred.notify); + + return deferred.promise; + } + + $scope.org_changed = function(org) { + $scope.context_org = org; // hmm, why necessary. + $scope.grid_provider.refresh(); + } + + // NOTE: Chrome only allows one tab/window to open per user + // action. Only the first patron will be displayed. + $scope.get_user = function(selected) { + if (!selected.length) return; + angular.forEach(selected, function(data) { + $timeout(function() { + var url = $location.absUrl().replace( + /admin\/local\/.*/, + 'circ/patron/' + data.usr.id() + '/checkout'); + $window.open(url, '_blank') + }); + }); + } +}]) -- 2.11.0