From: Bill Erickson Date: Tue, 8 Jul 2014 21:14:04 +0000 (-0400) Subject: holds shelf X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=528d1454039905c15dcc07f27772db58b039c9bd;p=working%2FEvergreen.git holds shelf Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/circ/holds/index.tt2 b/Open-ILS/src/templates/staff/circ/holds/index.tt2 new file mode 100644 index 0000000000..01d07b114e --- /dev/null +++ b/Open-ILS/src/templates/staff/circ/holds/index.tt2 @@ -0,0 +1,21 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Holds Shelf"); + ctx.page_app = "egHoldsApp"; +%] + +[% BLOCK APP_JS %] + + + + +[% INCLUDE 'staff/circ/share/circ_strings.tt2' %] + +[% INCLUDE 'staff/circ/share/hold_strings.tt2' %] + + +[% END %] + +
+ +[% END %] diff --git a/Open-ILS/src/templates/staff/circ/holds/t_shelf.tt2 b/Open-ILS/src/templates/staff/circ/holds/t_shelf.tt2 new file mode 100644 index 0000000000..a465a6c2d5 --- /dev/null +++ b/Open-ILS/src/templates/staff/circ/holds/t_shelf.tt2 @@ -0,0 +1,36 @@ +
+
+
+ [% l('Pickup Library') %] + +
+
+
+
+ +
+
+
+
+ +
+[% INCLUDE 'staff/circ/holds/t_shelf_list.tt2' %] +
+ + +
+
+
+ +
+
+
+ + +
diff --git a/Open-ILS/src/templates/staff/circ/holds/t_shelf_list.tt2 b/Open-ILS/src/templates/staff/circ/holds/t_shelf_list.tt2 new file mode 100644 index 0000000000..0494b85e42 --- /dev/null +++ b/Open-ILS/src/templates/staff/circ/holds/t_shelf_list.tt2 @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.hold.current_copy().barcode()}} + + + + + + + + + + + + {{item.mvr.title()}} + + + + + + + + + + + + + + diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index f9082f02b2..b51509eeaa 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -104,6 +104,12 @@ [% l('Record In-House Use') %] +
  • + + + [% l('View Holds Shelf') %] + +
  • diff --git a/Open-ILS/web/js/ui/default/staff/circ/holds/app.js b/Open-ILS/web/js/ui/default/staff/circ/holds/app.js new file mode 100644 index 0000000000..b558358fbe --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/circ/holds/app.js @@ -0,0 +1,120 @@ +angular.module('egHoldsApp', + ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod', 'egGridMod']) + +.config(function($routeProvider, $locationProvider, $compileProvider) { + $locationProvider.html5Mode(true); + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); // grid export + + var resolver = {delay : + ['egStartup', function(egStartup) {return egStartup.go()}]} + + $routeProvider.when('/circ/holds/shelf', { + templateUrl: './circ/holds/t_shelf', + controller: 'HoldsShelfCtrl', + resolve : resolver + }); + + $routeProvider.when('/circ/holds/shelf/:hold_id', { + templateUrl: './circ/holds/t_shelf', + controller: 'HoldsShelfCtrl', + resolve : resolver + }); + + $routeProvider.otherwise({redirectTo : '/circ/holds/shelf'}); +}) + +.controller('HoldsShelfCtrl', + ['$scope','$q','$routeParams','$window','$location','egCore','egHolds','egCirc','egGridDataProvider', +function($scope , $q , $routeParams , $window , $location , egCore , egHolds , egCirc , egGridDataProvider) { + $scope.detail_hold_id = $routeParams.hold_id; + + var hold_ids = []; + var holds = []; + + function fetch_holds(offset, count) { + var ids = hold_ids.slice(offset, offset + count); + return egHolds.fetch_holds(ids).then(null, null, + function(hold_data) { + holds.push(hold_data); + return hold_data; // to the grid + } + ); + } + + var provider = egGridDataProvider.instance({}); + $scope.gridDataProvider = provider; + + provider.get = function(offset, count) { + + // see if we have the requested range cached + if (holds[offset]) { + return provider.arrayNotifier(patronSvc.holds, offset, count); + } + + // see if we have the holds IDs for this range already loaded + if (hold_ids[offset]) { + return fetch_holds(offset, count); + } + + var deferred = $q.defer(); + hold_ids = []; + holds = []; + + var method = 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve.authoritative.atomic'; + /* + if ($scope.holds_display == 'alt') + method = 'open-ils.circ.holds.canceled.id_list.retrieve.authoritative'; + */ + + egCore.net.request( + 'open-ils.circ', method, + egCore.auth.token(), $scope.pickup_ou.id() + + ).then(function(ids) { + if (!ids.length) { + deferred.resolve(); + return; + } + + hold_ids = ids; + fetch_holds(offset, count) + .then(deferred.resolve, null, deferred.notify); + }); + + return deferred.promise; + } + + function refresh_page() { + holds = []; + hold_ids = []; + provider.refresh(); + } + + + // re-draw the grid when user changes the org selector + $scope.pickup_ou = egCore.org.get(egCore.auth.user().ws_ou()); + $scope.$watch('pickup_ou', function(newVal, oldVal) { + if (newVal && newVal != oldVal) + refresh_page(); + }); + + $scope.detail_view = function(action, user_data, items) { + if (h = items[0]) { + $location.path('/circ/holds/shelf/' + h.hold.id()); + } + } + + $scope.list_view = function(items) { + $location.path('/circ/holds/shelf'); + } + + // when the detail hold is fetched (and updated), update the bib + // record summary display record id. + $scope.set_hold = function(hold_data) { + $scope.detail_hold_record_id = hold_data.mvr.doc_id(); + } + + refresh_page(); + +}]); + 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 index a77fbd246b..39ec83658f 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js @@ -40,24 +40,12 @@ function($scope, $q, $routeParams, egCore, egUser, patronSvc, $scope.gridDataProvider = provider; function fetchHolds(offset, count) { - var ids = patronSvc.hold_ids.slice(offset, offset + count); - - return egCore.net.request( - 'open-ils.circ', - 'open-ils.circ.hold.details.batch.retrieve.authoritative', - egCore.auth.token(), ids - - ).then(null, null, function(hold_data) { - $scope.loading = false; - - var hold = hold_data.hold; - hold_data.id = hold.id(); - egHolds.local_flesh(hold_data); - - patronSvc.holds.push(hold_data); - return hold_data; - }); + return egHolds.fetch_holds(ids).then( + function() { $scope.loading = false; }, + null, + function(hold_data) { patronSvc.holds.push(hold_data) } + ); } provider.get = function(offset, count) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js index 347c687e63..82d795a5f7 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js @@ -11,6 +11,22 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog , egAlertDialog) var service = {}; + service.fetch_holds = function(hold_ids) { + + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.hold.details.batch.retrieve.authoritative', + egCore.auth.token(), hold_ids + + ).then(null, null, function(hold_data) { + var hold = hold_data.hold; + hold_data.id = hold.id(); + service.local_flesh(hold_data); + return hold_data; + }); + } + + service.cancel_holds = function(hold_ids) { return $modal.open({ 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 02ca8d847a..7017ae83ee 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -270,7 +270,7 @@ It also allows us to abstract away some browser finickiness. // user's expectations. Note this allows us to retain // the timezone. function strip_time(date) { - if (!date) return null; + if (!date) date = new Date(); date.setHours(0); date.setMinutes(0); date.setSeconds(0);