From: Galen Charlton Date: Thu, 20 Oct 2016 17:08:58 +0000 (-0400) Subject: changes to transit list interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=517c68ee3d6eef59f2f3621e0b925f87bc263d01;p=evergreen%2Fmasslnc.git changes to transit list interface * convert barcode column to hyperlink to item status page (and remove the 'Item Status' action; note that default double-click action remains going to the item status page) * convert title column to hyperlink to record details page * add 'Add Items to Bucket' button * add 'Edit Item Attributes' button Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/src/templates/staff/circ/transits/t_list.tt2 b/Open-ILS/src/templates/staff/circ/transits/t_list.tt2 index d6726bbbc6..5c240db2c4 100644 --- a/Open-ILS/src/templates/staff/circ/transits/t_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/transits/t_list.tt2 @@ -34,17 +34,25 @@ persist-key="circ.transits.list" > - + + - + + {{item.target_copy().barcode()}} + - + + + {{item.target_copy().call_number().record().simple_record().title()}} + + diff --git a/Open-ILS/web/js/ui/default/staff/circ/transits/list.js b/Open-ILS/web/js/ui/default/staff/circ/transits/list.js index fd19018692..6a876b47ec 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/transits/list.js +++ b/Open-ILS/web/js/ui/default/staff/circ/transits/list.js @@ -18,8 +18,8 @@ angular.module('egTransitListApp', }) .controller('TransitListCtrl', - ['$scope','$q','$routeParams','$window','egCore','egTransits','egGridDataProvider', -function($scope , $q , $routeParams , $window , egCore , egTransits , egGridDataProvider) { + ['$scope','$q','$routeParams','$window','egCore','egTransits','egGridDataProvider','$uibModal','$timeout', +function($scope , $q , $routeParams , $window , egCore , egTransits , egGridDataProvider , $uibModal , $timeout) { var transits = []; var provider = egGridDataProvider.instance({}); @@ -90,6 +90,128 @@ function($scope , $q , $routeParams , $window , egCore , egTransits , egGridData abort_transit(transits); } + $scope.add_copies_to_bucket = function(transits) { + var copy_list = []; + angular.forEach($scope.grid_controls.selectedItems(), function(transit) { + copy_list.push(transit.target_copy().id()); + }); + if (copy_list.length == 0) return; + + // FIXME what follows ought to be refactored into a factory + return $uibModal.open({ + templateUrl: './cat/catalog/t_add_to_bucket', + animation: true, + size: 'md', + controller: + ['$scope','$uibModalInstance', + function($scope , $uibModalInstance) { + + $scope.bucket_id = 0; + $scope.newBucketName = ''; + $scope.allBuckets = []; + + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.container.retrieve_by_class.authoritative', + egCore.auth.token(), egCore.auth.user().id(), + 'copy', 'staff_client' + ).then(function(buckets) { $scope.allBuckets = buckets; }); + + $scope.add_to_bucket = function() { + var promises = []; + angular.forEach(copy_list, function (cp) { + var item = new egCore.idl.ccbi() + item.bucket($scope.bucket_id); + item.target_copy(cp); + promises.push( + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.container.item.create', + egCore.auth.token(), 'copy', item + ) + ); + + return $q.all(promises).then(function() { + $uibModalInstance.close(); + }); + }); + } + + $scope.add_to_new_bucket = function() { + var bucket = new egCore.idl.ccb(); + bucket.owner(egCore.auth.user().id()); + bucket.name($scope.newBucketName); + bucket.description(''); + bucket.btype('staff_client'); + + return egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.container.create', + egCore.auth.token(), 'copy', bucket + ).then(function(bucket) { + $scope.bucket_id = bucket; + $scope.add_to_bucket(); + }); + } + + $scope.cancel = function() { + $uibModalInstance.dismiss(); + } + }] + }); + } + + + function gatherSelectedRecordIds () { + var rid_list = []; + angular.forEach( + $scope.grid_controls.selectedItems(), + function (item) { + if (rid_list.indexOf(item.target_copy().call_number().record().simple_record().id()) == -1) + rid_list.push(item.target_copy().call_number().record().simple_record().id()); + } + ); + return rid_list; + } + function gatherSelectedHoldingsIds (rid) { + var cp_id_list = []; + angular.forEach( + $scope.grid_controls.selectedItems(), + function (item) { + if (rid && item.target_copy().call_number().record().simple_record().id() != rid) return; + cp_id_list.push(item.target_copy().id()); + } + ); + return cp_id_list; + } + + var spawnHoldingsEdit = function (hide_vols, hide_copies){ + angular.forEach(gatherSelectedRecordIds(), function (r) { + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + null, 'edit-these-copies', { + record_id: r, + copies: gatherSelectedHoldingsIds(r), + raw: {}, + hide_vols : hide_vols, + hide_copies : hide_copies + } + ).then(function(key) { + if (key) { + var url = egCore.env.basePath + 'cat/volcopy/' + key; + $timeout(function() { $window.open(url, '_blank') }); + } else { + alert('Could not create anonymous cache key!'); + } + }); + }); + } + + $scope.edit_copies = function() { + spawnHoldingsEdit(true, false); + } + $scope.grid_controls = { activateItem : load_item }