From 864ce1aecf268069b5e14c5f5e28a8458f1e00d7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 27 Oct 2016 17:40:26 -0400 Subject: [PATCH] Angular selfcheck WIP : holds Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/selfcheck/index.tt2 | 2 +- .../src/templates/staff/circ/selfcheck/t_holds.tt2 | 22 +++++++++ .../src/templates/staff/circ/selfcheck/t_items.tt2 | 2 +- .../web/js/ui/default/staff/circ/selfcheck/app.js | 53 +++++++++++++++++++--- 4 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 Open-ILS/src/templates/staff/circ/selfcheck/t_holds.tt2 diff --git a/Open-ILS/src/templates/staff/circ/selfcheck/index.tt2 b/Open-ILS/src/templates/staff/circ/selfcheck/index.tt2 index c6c22619ed..e6b1bce089 100644 --- a/Open-ILS/src/templates/staff/circ/selfcheck/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/selfcheck/index.tt2 @@ -63,7 +63,7 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
[% l('Holds') %] -
[% l('You have [_1] item(s) ready for pickup', '{{counts("hold_ready")}}') %]
+
[% l('You have [_1] item(s) ready for pickup', '{{counts("ready_hold")}}') %]
[% l('You have [_1] total holds', '{{counts("total_hold")}}') %]
diff --git a/Open-ILS/src/templates/staff/circ/selfcheck/t_holds.tt2 b/Open-ILS/src/templates/staff/circ/selfcheck/t_holds.tt2 new file mode 100644 index 0000000000..38b98526c9 --- /dev/null +++ b/Open-ILS/src/templates/staff/circ/selfcheck/t_holds.tt2 @@ -0,0 +1,22 @@ + +
+
+
[% l('Title') %]
+
[% l('Author') %]
+
[% l('Status') %]
+
+ +
+
+ +
+
{{hold.mvr.title()}}
+
{{hold.mvr.author()}}
+
+ [% l('Ready for Pickup') %] + [% l('#[_1] in line with [_2] copies', + '{{hold.queue_position}}', '{{hold.potential_copies}}') %] +
+
+ diff --git a/Open-ILS/src/templates/staff/circ/selfcheck/t_items.tt2 b/Open-ILS/src/templates/staff/circ/selfcheck/t_items.tt2 index 55511c63ee..f96e9632cd 100644 --- a/Open-ILS/src/templates/staff/circ/selfcheck/t_items.tt2 +++ b/Open-ILS/src/templates/staff/circ/selfcheck/t_items.tt2 @@ -7,7 +7,7 @@
[% l('Due Date') %]
-
+
diff --git a/Open-ILS/web/js/ui/default/staff/circ/selfcheck/app.js b/Open-ILS/web/js/ui/default/staff/circ/selfcheck/app.js index beb3a216df..347039b40b 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/selfcheck/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/selfcheck/app.js @@ -72,6 +72,12 @@ angular.module('egSelfCheckApp', resolve : resolver }); + $routeProvider.when('/circ/selfcheck/holds', { + templateUrl: './circ/selfcheck/t_holds', + controller: 'HoldsCtrl', + resolve : resolver + }); + $routeProvider.otherwise({redirectTo : '/circ/selfcheck/login'}); }) @@ -97,11 +103,13 @@ function($q , $timeout , $window , $location , $timeout , egCore , egConfirmDial session_circ_count : 0, total_circ_count : 0, - hold_ready_count : 0, + ready_hold_count : 0, total_hold_count : 0, - }; + service.get_counts = function() { + } + // called with each path load service.new_path_init = function() { if (!service.patron) @@ -228,18 +236,38 @@ function($q , $timeout , $window , $location , $timeout , egCore , egConfirmDial /* * Returns a notify-stream of open circ blobs. - * Resets total circ count to match the server. */ service.get_items_out = function() { - service.total_circ_count = 0; return egCore.net.request( 'open-ils.circ', 'open-ils.circ.actor.user.checked_out', egCore.auth.token(), service.patron.id() - ).then(null, null, function(circ_blob) { - service.total_circ_count++; - return circ_blob; + ); + } + + /* + * Returns a notify-stream of open hold blobs + */ + service.get_holds = function() { + // Don't rely on promise chaining when the final outcome is + // a stream of notify()'s, since resolve() data from earlier + // promises will leak into the notify() stream. + var deferred = $q.defer(); + + egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.holds.id_list.retrieve', + egCore.auth.token(), service.patron.id() + + ).then(function(ids) { + egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.hold.details.batch.retrieve', + egCore.auth.token(), ids + ).then(deferred.resolve, deferred.reject, deferred.notify) }); + + return deferred.promise; } return service; @@ -340,4 +368,15 @@ function($scope, $q, $location , egCore, scSvc) { }]) +.controller('HoldsCtrl', + ['$scope','$q','$location','egCore','scSvc', +function($scope, $q, $location , egCore, scSvc) { + scSvc.new_path_init(); + $scope.scanbox.focus = true; + $scope.holds = []; + + scSvc.get_holds().then(null, null, + function(hold_blob) { $scope.holds.push(hold_blob) }); + +}]) -- 2.11.0