From 549d6a0847f4a7a68db5d41270290c24f16c9aa1 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 10 Mar 2017 13:05:50 -0500 Subject: [PATCH] webstaff: Make Items Bookable and Book Item Now for Holdings View Signed-off-by: Jason Etheridge Signed-off-by: Mike Rylander --- .../staff/cat/catalog/t_holdings.tt2 | 5 + .../js/ui/default/staff/cat/catalog/app.js | 134 ++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 index 4a5181eef1..c7247c7cfb 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 @@ -35,6 +35,11 @@ + + 0) { + $uibModal.open({ + template: '', + animation: true, + size: 'md', + controller: + ['$scope','$location','egCore','$uibModalInstance', + function($scope , $location , egCore , $uibModalInstance) { + + $scope.funcs = { + ses : egCore.auth.token(), + resultant_brsrc : combined_results.map(function(o) { return o[0]; }) + } + + var booking_path = '/eg/conify/global/booking/resource'; + + $scope.booking_admin_url = + $location.absUrl().replace(/\/eg\/staff.*/, booking_path); + }] + }); + } + }); + } + + $scope.book_copies_now = function() { + var copies_by_record = {}; + var record_list = []; + angular.forEach( + $scope.holdingsGridControls.selectedItems(), + function (item) { + var record_id = item['call_number.record.id']; + if (typeof copies_by_record[ record_id ] == 'undefined') { + copies_by_record[ record_id ] = []; + record_list.push( record_id ); + } + copies_by_record[ record_id ].push(item.id); + } + ); + + var promises = []; + var combined_brt = []; + var combined_brsrc = []; + angular.forEach(record_list, function(record_id) { + promises.push( + egCore.net.request( + 'open-ils.booking', + 'open-ils.booking.resources.create_from_copies', + egCore.auth.token(), + copies_by_record[record_id] + ).then(function(results) { + if (results && results['brt']) { + combined_brt = combined_brt.concat(results['brt']); + } + if (results && results['brsrc']) { + combined_brsrc = combined_brsrc.concat(results['brsrc']); + } + }) + ); + }); + + $q.all(promises).then(function() { + if (combined_brt.length > 0 || combined_brsrc.length > 0) { + $uibModal.open({ + template: '', + animation: true, + size: 'md', + controller: + ['$scope','$location','egCore','$uibModalInstance', + function($scope , $location , egCore , $uibModalInstance) { + + $scope.funcs = { + ses : egCore.auth.token(), + bresv_interface_opts : { + booking_results : { + brt : combined_brt + ,brsrc : combined_brsrc + } + } + } + + var booking_path = '/eg/booking/reservation'; + + $scope.booking_admin_url = + $location.absUrl().replace(/\/eg\/staff.*/, booking_path); + + }] + }); + } + }); + } + + $scope.requestItems = function() { var copy_list = gatherSelectedHoldingsIds(); if (copy_list.length == 0) return; -- 2.43.2