From 85f6c2b8715a29d6c92c29132d2b05469de66e64 Mon Sep 17 00:00:00 2001 From: Cesar Velez Date: Fri, 11 Aug 2017 16:00:29 +0100 Subject: [PATCH] LP#1685929-Adds more XUL parity to Webstaff checkIn Checkin Grid context actions like Add Items to Bucket, Show Holds on Bib, Show Last Few Circulations, Edit Item Attributes, Mark Item Missing Pieces, Print Spine Label, were missing from CheckIn in webstaff. Signed-off by: Cesar Velez Signed-off-by: Galen Charlton Conflicts: Open-ILS/web/js/ui/default/staff/cat/item/app.js --- .../templates/staff/circ/checkin/index.tt2 | 11 ++++ .../staff/circ/checkin/t_checkin_table.tt2 | 27 ++++++++- .../web/js/ui/default/staff/cat/item/app.js | 59 ++++++++++++++++++- .../js/ui/default/staff/circ/checkin/app.js | 54 ++++++++++++++++- 4 files changed, 144 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/checkin/index.tt2 b/Open-ILS/src/templates/staff/circ/checkin/index.tt2 index dd2c0cf4d2..4bc925d637 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/index.tt2 @@ -9,7 +9,18 @@ + + [% INCLUDE 'staff/circ/share/circ_strings.tt2' %] + [% END %] 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 0066cb3217..5978e7bc16 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 @@ -8,7 +8,9 @@ grid-controls="gridControls" persist-key="{{grid_persist_key}}" dateformat="{{$root.egDateAndTimeFormat}}"> - + + + @@ -17,15 +19,36 @@ handler="showBackdateDialog" label="[% l('Backdate Post-Checkin') %]"> - + + + + + + + + + + + + + diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/app.js b/Open-ILS/web/js/ui/default/staff/cat/item/app.js index 65737ad104..be24fd8e31 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/app.js @@ -48,8 +48,8 @@ angular.module('egItemStatus', }) .factory('itemSvc', - ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog', -function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog ) { + ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog','egAlertDialog', +function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog, egAlertDialog ) { var service = { copies : [], // copy barcode search results @@ -104,10 +104,12 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog return egCore.pcrud.retrieve( 'acp', id, service.flesh) .then(function(copy) {return copy}); } + service.getCirc = function(id) { return egCore.pcrud.search('aacs', { target_copy : id }, service.circFlesh).then(function(circ) {return circ}); } + service.getSummary = function(id) { return circ_summary = egCore.net.request( 'open-ils.circ', @@ -876,6 +878,59 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog } } + service.mark_missing_pieces = function(copy) { + var b = copy.barcode(); + var t = egCore.idl.toHash(copy.call_number()).record.title; + egConfirmDialog.open( + egCore.strings.CONFIRM_MARK_MISSING_TITLE, + egCore.strings.CONFIRM_MARK_MISSING_BODY, + { barcode : b, title : t } + ).result.then(function() { + + // kick off mark missing + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.mark_item_missing_pieces', + egCore.auth.token(), copy.id() + ) + + }).then(function(resp) { + var evt = egCore.evt.parse(resp); // should always produce event + + if (evt.textcode == 'ACTION_CIRCULATION_NOT_FOUND') { + return egAlertDialog.open( + egCore.strings.CIRC_NOT_FOUND, {barcode : copy.barcode()}); + } + + var payload = evt.payload; + + // TODO: open copy editor inline? new tab? + + // print the missing pieces slip + var promise = $q.when(); + if (payload.slip) { + // wait for completion, since it may spawn a confirm dialog + promise = egCore.print.print({ + context : 'default', + content_type : 'text/html', + content : payload.slip.template_output().data() + }); + } + + if (payload.letter) { + $scope.letter = payload.letter.template_output().data(); + } + + // apply patron penalty + if (payload.circ) { + promise.then(function() { + egCirc.create_penalty(payload.circ.usr()) + }); + } + + }); + } + return service; }]) 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 099b1bea73..8f2fb5070f 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 @@ -1,5 +1,5 @@ angular.module('egCheckinApp', ['ngRoute', 'ui.bootstrap', - 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod']) + 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod', 'egItemStatus']) .config(function($routeProvider, $locationProvider, $compileProvider) { $locationProvider.html5Mode(true); @@ -34,8 +34,8 @@ angular.module('egCheckinApp', ['ngRoute', 'ui.bootstrap', * Manages checkin */ .controller('CheckinCtrl', - ['$scope','$q','$window','$location','egCore','checkinSvc','egGridDataProvider','egCirc', -function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataProvider , egCirc) { + ['$scope','$q','$window','$location', '$timeout','egCore','checkinSvc','egGridDataProvider','egCirc', 'itemSvc', +function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , egGridDataProvider , egCirc, itemSvc) { $scope.focusMe = true; $scope.checkins = checkinSvc.checkins; @@ -326,5 +326,53 @@ function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataPro }); } + $scope.add_copies_to_bucket = function(items){ + var itemsIds = []; + angular.forEach(items, function(cp){ + itemsIds.push(cp.acp.id()); + }); + + itemSvc.add_copies_to_bucket(itemsIds); + } + + $scope.showBibHolds = function(items){ + var recordIds = []; + angular.forEach(items, function(i){ + recordIds.push(i.acn.record()); + }); + angular.forEach(recordIds, function (r) { + var url = egCore.env.basePath + 'cat/catalog/record/' + r + '/holds'; + $timeout(function() { $window.open(url, '_blank') }); + }); + } + + $scope.showLastCircs = function(items){ + var itemIds = []; + angular.forEach(items, function(cp){ + itemIds.push(cp.acp.id()); + }); + angular.forEach(itemIds, function (id) { + var url = egCore.env.basePath + 'cat/item/' + id + '/circs'; + $timeout(function() { $window.open(url, '_blank') }); + }); + } + + $scope.selectedHoldingsVolCopyEdit = function (items) { + var itemObjs = []; + angular.forEach(items, function(i){ + var h = egCore.idl.toHash(i); + h['call_number.record.id'] = h.record.doc_id; + itemObjs.push(h); + }); + itemSvc.spawnHoldingsEdit(itemObjs,false,false); + } + + $scope.show_mark_missing_pieces = function(items){ + angular.forEach(items, function(i){ + i.acp.call_number(i.acn); + i.acp.call_number().record(i.record); + itemSvc.mark_missing_pieces(i.acp); + }); + } }]) -- 2.43.2