From 00e937ce5f8e0ca37d26f5ba8ef26d7dc4bf7228 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 30 Jun 2014 11:37:11 -0400 Subject: [PATCH] renew item Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/renew/t_renew.tt2 | 7 ++- Open-ILS/src/templates/staff/share/t_autogrid.tt2 | 6 +-- Open-ILS/web/js/ui/default/staff/circ/renew/app.js | 58 ++++++++++++++++++++-- Open-ILS/web/js/ui/default/staff/services/grid.js | 4 +- 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 index 2d0dbe21d0..b0c5c786ec 100644 --- a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 +++ b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 @@ -53,18 +53,21 @@ label="[% l('Retrieve Last Patron Who Circulated Item') %]"> + handler="showLastFewCircs" + label="[% l('Show Last Few Circluations') %]"> + + + diff --git a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 index 65ed45824f..cd5b3ad1c5 100644 --- a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 +++ b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 @@ -69,10 +69,10 @@ [% l('Actions') %] diff --git a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js index 54d7a6372e..88194b71c6 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js @@ -29,10 +29,8 @@ angular.module('egRenewApp', .controller('RenewCtrl', - - ['$scope','egCore','egGridDataProvider','egCirc', - -function($scope , egCore , egGridDataProvider , egCirc) { + ['$scope','$window','$location','egCore','egGridDataProvider','egCirc', +function($scope , $window , $location , egCore , egGridDataProvider , egCirc) { $scope.focusBarcode = true; $scope.renewals = []; @@ -138,6 +136,58 @@ function($scope , egCore , egGridDataProvider , egCirc) { }); } + $scope.fetchLastCircPatron = function(items) { + var renewal = items[0]; + if (!renewal || !renewal.acp) return; + + egCirc.last_copy_circ(renewal.acp.id()) + .then(function(circ) { + + if (circ) { + // jump to the patron UI (separate app) + $window.location.href = $location + .path('/circ/patron/' + circ.usr() + '/checkout') + .absUrl(); + return; + } + + $scope.alert = {item_never_circed : renewal.acp.barcode()}; + }); + } + + $scope.showMarkDamaged = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) copy_ids.push(item.acp.id()); + }); + + if (copy_ids.length) { + egCirc.mark_damaged(copy_ids).then(function() { + // update grid items? + }); + } + } + + // TODO: add URL-based grid actions support for ctrl-click + $scope.showLastFewCircs = function(items) { + if (items.length && (copy = items[0].acp)) { + $window.location.href = $location + .path('/cat/item/' + copy.id() + '/circ_list') + .absUrl(); + } + } + + $scope.abortTransit = function(items) { + var transit_ids = []; + angular.forEach(items, function(item) { + if (item.transit) transit_ids.push(item.transit.id()); + }); + + egCirc.abort_transits(transit_ids).then(function() { + // update grid items? + }); + } + $scope.print_receipt = function() { var print_data = {circulations : []} diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 3660eec306..a11c397f45 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -849,11 +849,13 @@ angular.module('egGridMod', transclude : true, scope : { label : '@', // Action label - handler : '=' // Action function handler + handler : '=', // Action function handler + divider : '=' }, link : function(scope, element, attrs, egGridCtrl) { egGridCtrl.addAction({ label : scope.label, + divider : scope.divider, handler : scope.handler }); scope.$destroy(); -- 2.11.0