From 7801e88d2350e440c0399bcdee7cc6766ea4d1d2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 25 Jun 2014 12:06:19 -0400 Subject: [PATCH] checkin; mark damaged, abort transit Signed-off-by: Bill Erickson --- .../staff/circ/checkin/t_checkin_table.tt2 | 8 +++ .../templates/staff/circ/share/circ_strings.tt2 | 2 + .../web/js/ui/default/staff/circ/checkin/app.js | 24 +++++++++ .../web/js/ui/default/staff/circ/services/circ.js | 57 ++++++++++++++++++++++ 4 files changed, 91 insertions(+) diff --git a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 index 79392c1c0e..6b5343f1e5 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 @@ -17,6 +17,14 @@ handler="showBackdateDialog" label="[% l('Backdate Post-Checkin') %]"> + + + + diff --git a/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 b/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 index d317a48300..cdc67315e7 100644 --- a/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 @@ -23,6 +23,8 @@ s.PRECAT_CHECKIN_MSG = s.LOCATION_ALERT_MSG = '[% l("Item [_1] needs to be routed to [_2]", "{{copy.barcode()}}","{{copy.location().name()}}") %]'; +s.MARK_DAMAGED_CONFIRM = '[% l("Mark {{num_items}} items as DAMAGED?") %]'; +s.ABORT_TRANSIT_CONFIRM = '[% l("Abort {{num_transits}} transits?") %]'; }]); diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index f40415c7d8..00be1dffd9 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -246,5 +246,29 @@ function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataPro } } + $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? + }); + } + } + + $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? + }); + } + }]) diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index 1eaa702754..b9947e6f9c 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -695,6 +695,63 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) { }).result; } + service.mark_damaged = function(copy_ids) { + return egConfirmDialog.open( + egCore.strings.MARK_DAMAGED_CONFIRM, '', + { num_items : copy_ids.length, + ok : function() {}, + cancel : function() {} + } + + ).result.then(function() { + var promises = []; + angular.forEach(copy_ids, function(copy_id) { + promises.push( + egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.mark_item_damaged', + egCore.auth.token(), copy_id + ).then(function(resp) { + if (evt = egCore.evt.parse(resp)) { + console.error('mark damaged failed: ' + evt); + } + }) + ); + }); + + return $q.all(promises); + }); + } + + service.abort_transits = function(transit_ids) { + return egConfirmDialog.open( + egCore.strings.ABORT_TRANSIT_CONFIRM, '', + { num_transits : transit_ids.length, + ok : function() {}, + cancel : function() {} + } + + ).result.then(function() { + var promises = []; + angular.forEach(transit_ids, function(transit_id) { + promises.push( + egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.transit.abort', + egCore.auth.token(), {transitid : transit_id} + ).then(function(resp) { + if (evt = egCore.evt.parse(resp)) { + console.error('abort transit failed: ' + evt); + } + }) + ); + }); + + return $q.all(promises); + }); + } + + // alert when copy location alert_message is set. // This does not affect processing, it only produces a click-through -- 2.11.0