From: Bill Erickson Date: Fri, 25 Apr 2014 21:08:57 +0000 (-0400) Subject: browser staff : port holds to grid; kill eglist for patron app X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0dd9628d9f99dbe511f93e8a8c5981b039f30d37;p=working%2FEvergreen.git browser staff : port holds to grid; kill eglist for patron app Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2 index 0edf08ff96..7a99b7b12d 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -6,13 +6,15 @@ %] [% BLOCK APP_JS %] - + + + diff --git a/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 index cff9262d77..b18a3bb522 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 @@ -1,9 +1,19 @@ -
-
- [% INCLUDE 'staff/circ/patron/t_holds_actions.tt2' %] -
-
+ + + + + + + + + + + -[% INCLUDE 'staff/circ/patron/t_holds_table.tt2' %] diff --git a/Open-ILS/src/templates/staff/circ/patron/t_holds_actions.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_holds_actions.tt2 deleted file mode 100644 index 2bc4e501d8..0000000000 --- a/Open-ILS/src/templates/staff/circ/patron/t_holds_actions.tt2 +++ /dev/null @@ -1,34 +0,0 @@ -
- - - - - -
- - -
- - [% INCLUDE 'staff/parts/column_picker.tt2' listname='holds' %] -
- diff --git a/Open-ILS/src/templates/staff/circ/patron/t_holds_table.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_holds_table.tt2 deleted file mode 100644 index 0d99f2fb67..0000000000 --- a/Open-ILS/src/templates/staff/circ/patron/t_holds_table.tt2 +++ /dev/null @@ -1,60 +0,0 @@ -[% -COLUMNS = [ -{label => l('Hold ID'), name => 'hold.id', display => 1}, -{label => l('Current Copy'), name => 'hold.current_copy.barcode' display => 1}, -{label => l('Request Date'), name => 'hold.request_time' display => 1}, -{label => l('Capture Date'), name => 'hold.capture_time' display => 1}, -{label => l('Available Date'), name => 'hold.shelf_time' display => 1}, -{label => l('Type'), name => 'hold.hold_type' display => 1}, -{label => l('Pickup Library'), name => 'hold.pickup_lib.shortname' display => 1}, -{label => l('Title'), name => 'mvr.title', display => 1}, -{label => l('Author'), name => 'mvr.author', display => 1} -] -%] - - -
-
- - -
-
-
[% l('No Holds To Display') %]
-
-
- -
-
- - - - - - - - - - - - - - -
# - {{col.label}} -
{{$index + 1}} - - {{holds.fieldValue(hold_data, col.name)}} -
-
-
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 48a368d1a4..b390d77270 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -8,7 +8,7 @@ */ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', - 'egCoreMod', 'egUiMod', 'egGridMod', 'egListMod', 'egUserMod']) + 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod']) .config(function($routeProvider, $locationProvider, $compileProvider) { $locationProvider.html5Mode(true); @@ -100,8 +100,8 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', * Patron service */ .factory('patronSvc', - ['$q','$timeout','egList','egNet','egAuth','egUser','egEnv','egOrg','egList', -function($q , $timeout , egList, egNet, egAuth, egUser, egEnv, egOrg, egList) { + ['$q','$timeout','egNet','egAuth','egUser','egEnv','egOrg', +function($q , $timeout , egNet, egAuth, egUser, egEnv, egOrg) { var service = { // currently selected patron object @@ -134,11 +134,8 @@ function($q , $timeout , egList, egNet, egAuth, egUser, egEnv, egOrg, egLi service.checkouts = []; service.items_out = [] service.items_out_ids = []; - /* - service.holds.reset(); - service.bills.reset(); - service.messages.reset(); - */ + service.holds = []; + service.hold_ids = []; service.checkout_overrides = {}; } service.resetPatronLists(); // initialize @@ -239,10 +236,10 @@ function($scope, $q, $filter, egNet, egAuth, egUser, patronSvc, egEnv, e */ .controller('PatronSearchCtrl', ['$scope','$q','$routeParams','$timeout','$window','$location','egEnv', - '$filter','egIDL','egNet','egAuth','egEvent','egList','egUser', + '$filter','egIDL','egNet','egAuth','egEvent','egUser', 'patronSvc','egGridDataProvider','egPrintStore', function($scope, $q, $routeParams, $timeout, $window, $location, egEnv, - $filter, egIDL, egNet, egAuth, egEvent, egList, egUser, + $filter, egIDL, egNet, egAuth, egEvent, egUser, patronSvc , egGridDataProvider , egPrintStore) { $scope.initTab('search'); @@ -461,71 +458,8 @@ function($scope, $q, egNet, egAuth, egEvent, patronSvc) { // from the parent scope. Nothing to do here. }]) - -/** - * Manages holds - */ -.controller('PatronHoldsCtrl', - ['$scope','$q','$routeParams','egNet','egAuth','egUser','patronSvc','egOrg', -function($scope, $q, $routeParams, egNet, egAuth, egUser, patronSvc, egOrg) { - $scope.initTab('holds', $routeParams.id); - - $scope.holds = patronSvc.holds; - - $scope.onRowClick = function($event, hold) { - $scope.lastSelected = hold; - if ($event.ctrlKey || $event.metaKey) { - $scope.holds.toggleOneSelection(hold.id); - } else { - $scope.holds.selectOne(hold.id); - } - } - - function fetchPatronHolds() { - $scope.loading = true; - - egNet.request( - 'open-ils.circ', - 'open-ils.circ.holds.id_list.retrieve.authoritative', - egAuth.token(), $scope.patron_id - - ).then(function(hold_ids) { - - if (!hold_ids.length) { - $scope.loading = false; - return; - } - - angular.forEach(hold_ids, function(id) { - - egNet.request( - 'open-ils.circ', - 'open-ils.circ.hold.details.retrieve.authoritative', - egAuth.token(), id - - ).then(function(hold_data) { - $scope.loading = false; - var hold = hold_data.hold; - hold_data.id = hold.id(); - - // flesh - hold.pickup_lib(egOrg.get(hold.pickup_lib())); - - angular.forEach(hold_ids, function(id, idx) { - if (id == hold.id()) // maintain order - patronSvc.holds.items[idx] = hold_data; - }); - }); - }) - }) - } - - fetchPatronHolds(); // TODO: only when necessary - -}]) - /** - * Manages bills + * Manages edit */ .controller('PatronBillsCtrl', ['$scope','$q','$routeParams','egNet','egAuth','egUser','patronSvc', @@ -533,6 +467,7 @@ function($scope, $q, $routeParams, egNet, egAuth, egUser, patronSvc) { $scope.initTab('bills', $routeParams.id); }]) + /** * Manages messages */ diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js new file mode 100644 index 0000000000..2f1f0c2a5c --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js @@ -0,0 +1,69 @@ +/** + * List of patron holds + */ + +angular.module('egPatronApp').controller('PatronHoldsCtrl', + + ['$scope','$q','$routeParams','egNet','egAuth','egUser','patronSvc','egOrg','egGridDataProvider', +function($scope, $q, $routeParams, egNet, egAuth, egUser, patronSvc, egOrg , egGridDataProvider) { + $scope.initTab('holds', $routeParams.id); + + var provider = egGridDataProvider.instance({}); + provider.itemFieldValue = provider.nestedItemFieldValue; + $scope.gridDataProvider = provider; + + function fetchHolds(offset, count) { + + var ids = patronSvc.hold_ids.slice(offset, offset + count); + + return egNet.request( + 'open-ils.circ', + 'open-ils.circ.hold.details.batch.retrieve.authoritative', + egAuth.token(), ids + + ).then(null, null, function(hold_data) { + $scope.loading = false; + var hold = hold_data.hold; + hold_data.id = hold.id(); + hold.pickup_lib(egOrg.get(hold.pickup_lib())); // flesh + patronSvc.holds.push(hold_data); + return hold_data; + }); + } + + provider.get = function(offset, count) { + + // see if we have the requested range cached + if (patronSvc.holds[offset]) { + return patronSvc.arrayNotifier( + patronSvc.holds.slice(offset, offset + count) + ); + } + + // see if we have the holds IDs for this range already loaded + if (patronSvc.hold_ids[offset]) { + return fetchHolds(offset, count); + } + + var deferred = $q.defer(); + patronSvc.hold_ids = []; + + egNet.request( + 'open-ils.circ', + 'open-ils.circ.holds.id_list.retrieve.authoritative', + egAuth.token(), $scope.patron_id + + ).then(function(hold_ids) { + console.log('fetched hold ids ' + hold_ids); + + if (!hold_ids.length) { deferred.resolve(); return; } + + patronSvc.hold_ids = hold_ids; + fetchHolds(offset, count).then(null, null, deferred.notify); + }); + + return deferred.promise; + } +}]) + +