From: Bill Erickson Date: Thu, 17 Jul 2014 11:55:43 +0000 (-0400) Subject: catalog; view holds cont. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=adc57161cdbc94bb6648899f26fcedc0c14178c5;p=working%2FEvergreen.git catalog; view holds cont. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 index 9a207d8e1c..9e799d4f69 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 @@ -5,8 +5,13 @@ %] [% BLOCK APP_JS %] + + +[% INCLUDE 'staff/circ/share/circ_strings.tt2' %] + +[% INCLUDE 'staff/circ/share/hold_strings.tt2' %] [% END %] diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 index a21e45c07c..398335eaf9 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 @@ -7,7 +7,8 @@ -
+
@@ -32,5 +33,8 @@
+
+ [% INCLUDE 'staff/cat/catalog/t_holds.tt2' %] +
diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 new file mode 100644 index 0000000000..a420265fa0 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 @@ -0,0 +1,108 @@ + +
+
+
+
+ [% l('Pickup Library') %] + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + {{item.hold.current_copy().barcode()}} + + + + + + + + + + + + {{item.mvr.title()}} + + + + + + + + + + + + + + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+ + +
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_holds_for_bib.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_holds_for_bib.tt2 new file mode 100644 index 0000000000..8d3061cb31 --- /dev/null +++ b/Open-ILS/src/templates/staff/share/print_templates/t_holds_for_bib.tt2 @@ -0,0 +1,29 @@ +
+
[% l('Holds for record: [_1]', '{{holds[0].title}}') %]
+
+ + + + + + + + + + + + + + + + + + + + +
[% l('Request Date') %][% l('Patron Barcode') %][% l('Patron Last') %][% l('Patron Alias') %][% l('Current Copy') %]
{{hold.hold.request_time | date:'short'}}{{hold.patron_barcode}}{{hold.patron_last}}{{hold.patron_alias}}{{hold.copy.barcode}}
+
+
{{current_location.shortname}} {{today | date:'short'}}
+
[% l('Printed by [_1]', '{{staff.first_given_name}}') %]
+
+ diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index e9bd6e0331..b50d4f9629 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -1,8 +1,13 @@ /** * TPAC Frame App + * + * currently, this app doesn't use routes for each sub-ui, because + * reloading the catalog each time is sloooow. better so far to + * swap out divs w/ ng-if / ng-show / ng-hide as needed. + * */ -angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod']) +angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod']) .config(function($routeProvider, $locationProvider, $compileProvider) { $locationProvider.html5Mode(true); @@ -17,6 +22,7 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod']) resolve : resolver }); + // create some catalog page-specific mappings $routeProvider.when('/cat/catalog/record/:record_id', { templateUrl: './cat/catalog/t_catalog', controller: 'CatalogCtrl', @@ -30,8 +36,10 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod']) /** * */ .controller('CatalogCtrl', - ['$scope','$routeParams','$location','egCore', -function($scope , $routeParams , $location , egCore) { + ['$scope','$routeParams','$location','$q','egCore','egHolds', + 'egGridDataProvider','egHoldGridActions', +function($scope , $routeParams , $location , $q , egCore , egHolds, + egGridDataProvider , egHoldGridActions) { // TODO: is start path configurable in the xul client? var url = $location.absUrl().replace(/\/staff.*/, '/opac/advanced'); @@ -46,15 +54,10 @@ function($scope , $routeParams , $location , egCore) { // default to catalog view of the record page $scope.record_tab = 'catalog'; - $scope.set_record_tab = function(tab) { - $scope.record_tab = tab; - } - $scope.handle_page = function(url) { var match = url.match(/\/+opac\/+record\/+(\d+)/); if (match) { $scope.record_id = match[1]; - console.debug('loading record ' + $scope.record_id); // force the record_id to show up in the page. // not sure why a $digest isn't occuring here. @@ -64,6 +67,101 @@ function($scope , $routeParams , $location , egCore) { } } + // xulG handlers $scope.handlers = {}; + + // Holds bits ------------------------------- + var provider = egGridDataProvider.instance({}); + $scope.hold_grid_data_provider = provider; + $scope.grid_actions = egHoldGridActions; + $scope.hold_grid_controls = {}; + + var hold_ids = []; // current list of holds + function fetchHolds(offset, count) { + var ids = hold_ids.slice(offset, offset + count); + return egHolds.fetch_holds(ids).then(null, null, + function(hold_data) { + //patronSvc.holds.push(hold_data); + console.log('returning hold ' + hold_data.mvr.title()); + return hold_data; + } + ); + } + + provider.get = function(offset, count) { + if ($scope.record_tab != 'holds') return $q.when(); + var deferred = $q.defer(); + hold_ids = []; // no caching ATM + + // fetch the IDs + egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.holds.retrieve_all_from_title', + egCore.auth.token(), $scope.record_id, + {pickup_lib : $scope.pickup_ou.id()} + ).then( + function(hold_data) { + angular.forEach(hold_data, function(list, type) { + hold_ids = hold_ids.concat(list); + }); + fetchHolds(offset, count).then( + deferred.resolve, null, deferred.notify); + } + ); + + return deferred.promise; + } + + $scope.detail_view = function(action, user_data, items) { + if (h = items[0]) { + $scope.detail_hold_id = h.hold.id(); + } + } + + $scope.list_view = function(items) { + $scope.detail_hold_id = null; + } + + // refresh the list of record holds when the pickup lib is changed. + $scope.pickup_ou = egCore.org.get(egCore.auth.user().ws_ou()); + $scope.pickup_ou_changed = function(org) { + $scope.pickup_ou = org; + provider.refresh(); + } + + $scope.set_record_tab = function(tab) { + $scope.record_tab = tab; + + if (tab == 'holds') { + $scope.detail_hold_record_id = $scope.record_id; + + // refresh the holds grid + provider.refresh(); + } + } + + $scope.print_holds = function() { + var holds = []; + angular.forEach($scope.hold_grid_controls.allItems(), function(item) { + holds.push({ + hold : egCore.idl.toHash(item.hold), + patron_last : item.patron_last, + patron_alias : item.patron_alias, + patron_barcode : item.patron_barcode, + copy : egCore.idl.toHash(item.copy), + volume : egCore.idl.toHash(item.volume), + title : item.mvr.title(), + author : item.mvr.author() + }); + }); + + egCore.print.print({ + context : 'receipt', + template : 'holds_for_bib', + scope : {holds : holds} + }); + } + + }]) diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 7017ae83ee..c960ffb6af 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -198,6 +198,10 @@ function($modal, $interpolate) { // org unit will not be added to the selector. hiddenTest : '=', + // Caller can either $watch(selected, ..) or register an + // onchange handler. + onchange : '=', + // optional primary drop-down button label label : '@' }, @@ -240,6 +244,7 @@ function($modal, $interpolate) { $scope.orgChanged = function(org) { $scope.selected = egOrg.get(org.id); + if ($scope.onchange) $scope.onchange($scope.selected); } if (!$scope.selected)