From e7100d944520f8037dba6274e891783fbadaff63 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 14 Jun 2019 16:42:52 -0400 Subject: [PATCH] LP#1832897: add miscellaneous carousels functionality to staff interface * Add a 'Create Carousel from Bucket' action in the record bucket interface * Add an 'Add to Carousel' action to the record details page Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- .../staff/cat/bucket/record/t_create_carousel.tt2 | 24 ++++++++++ .../staff/cat/bucket/record/t_grid_menu.tt2 | 3 ++ .../staff/cat/catalog/t_add_to_carousel.tt2 | 28 ++++++++++++ .../src/templates/staff/cat/catalog/t_catalog.tt2 | 5 +++ .../js/ui/default/staff/cat/bucket/record/app.js | 28 ++++++++++++ .../web/js/ui/default/staff/cat/catalog/app.js | 52 ++++++++++++++++++++++ 6 files changed, 140 insertions(+) create mode 100644 Open-ILS/src/templates/staff/cat/bucket/record/t_create_carousel.tt2 create mode 100644 Open-ILS/src/templates/staff/cat/catalog/t_add_to_carousel.tt2 diff --git a/Open-ILS/src/templates/staff/cat/bucket/record/t_create_carousel.tt2 b/Open-ILS/src/templates/staff/cat/bucket/record/t_create_carousel.tt2 new file mode 100644 index 0000000000..72bb761150 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/bucket/record/t_create_carousel.tt2 @@ -0,0 +1,24 @@ + + + +
+
+ + + +
+
diff --git a/Open-ILS/src/templates/staff/cat/bucket/record/t_grid_menu.tt2 b/Open-ILS/src/templates/staff/cat/bucket/record/t_grid_menu.tt2 index 47704fb76e..c9af4f5eb2 100644 --- a/Open-ILS/src/templates/staff/cat/bucket/record/t_grid_menu.tt2 +++ b/Open-ILS/src/templates/staff/cat/bucket/record/t_grid_menu.tt2 @@ -12,6 +12,9 @@ + + + + + + + + diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 index c9b733d733..3f62abb92c 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 @@ -86,6 +86,11 @@ [% l('Add To Bucket') %] +
  • + + [% l('Add To Carousel') %] + +
  • [% l('View/Place Orders') %] diff --git a/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js b/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js index 14ebe42e76..29d64cc9c3 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js @@ -401,6 +401,34 @@ function($scope, $location, $q, $timeout, $uibModal, }); } + // allows user to create a carousel from the selected bucket + $scope.openCreateCarouselDialog = function() { + if (!bucketSvc.currentBucket || !bucketSvc.currentBucket.id()) { + return; + } + $uibModal.open({ + templateUrl: './cat/bucket/record/t_create_carousel', + backdrop: 'static', + controller : + ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) { + $scope.focusMe = true; + $scope.ok = function(args) { + if (args && args.name) { + return egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.carousel.create.from_bucket', + egCore.auth.token(), args.name, bucketSvc.currentBucket.id() + ).then(function(carouselId) { $uibModalInstance.close(carouselId) }); + } + } + $scope.cancel = function() { $uibModalInstance.dismiss() } + }] + }).result.then(function(carouselId) { + // bouncing outside of AngularJS + $window.location.href = '/eg2/en-US/staff/admin/server/container/carousel'; + }); + } + // opens the record export dialog $scope.openExportBucketDialog = function() { $uibModal.open({ diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index c853cb8686..c207b9797a 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -423,6 +423,58 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e }); } + $scope.carousels_available = false; + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.carousel.retrieve_manual_by_staff', + egCore.auth.token() + ).then(function(carousels) { $scope.carousels_available = true; }); + + $scope.add_to_carousel = function(recs) { + if (!angular.isArray(recs)) { + recs = [ $scope.record_id ]; + } + return $uibModal.open({ + templateUrl: './cat/catalog/t_add_to_carousel', + backdrop: 'static', + animation: true, + size: 'md', + controller: + ['$scope','$uibModalInstance', + function($scope , $uibModalInstance) { + $scope.bucket_id = 0; + $scope.allCarousels = []; + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.carousel.retrieve_manual_by_staff', + egCore.auth.token() + ).then(function(carousels) { $scope.allCarousels = carousels; }); + + $scope.add_to_carousel = function() { + // or more precisely, the carousel's bucket + var promises = []; + angular.forEach(recs, function(recId) { + var item = new egCore.idl.cbrebi(); + item.bucket($scope.bucket_id); + item.target_biblio_record_entry(recId); + promises.push(egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.container.item.create', + egCore.auth.token(), 'biblio', item + )); + }); + $q.all(promises).then(function(resp) { + $uibModalInstance.close(); + }); + } + + $scope.cancel = function() { + $uibModalInstance.dismiss(); + } + }] + }); + } + $scope.current_overlay_target = egCore.hatch.getLocalItem('eg.cat.marked_overlay_record'); $scope.current_transfer_target = egCore.hatch.getLocalItem('eg.cat.transfer_target_record'); $scope.current_conjoined_target = egCore.hatch.getLocalItem('eg.cat.marked_conjoined_record'); -- 2.11.0