From: Jason Stephenson Date: Sat, 7 Jul 2018 15:04:06 +0000 (-0400) Subject: Wire up the JS wrapper functions for discard. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6675bd3f9f1ee9c3fe2468e00632a3507e419e14;p=working%2FEvergreen.git Wire up the JS wrapper functions for discard. --- 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 43af4d568d..07c2592e83 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 @@ -1634,6 +1634,23 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e }); } + $scope.selectedHoldingsDiscard = function () { + var copy_list = gatherSelectedRawCopies(); + if (copy_list.length == 0) return; + + angular.forEach(copy_list, function(cp) { + egCirc.mark_discard({ + id: cp.id(), + barcode: cp.barcode(), + circ_lib: cp.circ_lib().id() + }).then(function() { + holdingsSvcInst.fetchAgain().then(function() { + $scope.holdingsGridDataProvider.refresh(); + }); + }); + }); + } + $scope.selectedHoldingsMissing = function () { egCirc.mark_missing(gatherSelectedHoldingsIds()).then(function() { holdingsSvcInst.fetchAgain().then(function() { 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 19e45f921a..1c822536c7 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 @@ -154,6 +154,14 @@ function($scope , $location , $timeout , egCore , egGridDataProvider , itemSvc) }]); } + $scope.selectedHoldingsDiscard = function () { + itemSvc.selectedHoldingsDiscard([{ + id : $scope.args.copyId, + barcode : $scope.args.copyBarcode, + refresh : true + }]); + } + $scope.selectedHoldingsMissing = function () { itemSvc.selectedHoldingsMissing([{ id : $scope.args.copyId, @@ -455,6 +463,10 @@ function($scope , $q , $routeParams , $location , $timeout , $window , egCore , itemSvc.selectedHoldingsDamaged(copyGrid.selectedItems()); } + $scope.selectedHoldingsDiscard = function () { + itemSvc.selectedHoldingsDiscard(copyGrid.selectedItems()); + } + $scope.selectedHoldingsMissing = function () { itemSvc.selectedHoldingsMissing(copyGrid.selectedItems()); } 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 6d71f6c6dd..bf6d978c53 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 @@ -335,6 +335,20 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg } + $scope.showMarkDiscard = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) { + egCirc.mark_discard({ + id: item.acp.id(), + barcode: item.acp.barcode() + }) + + } + }); + + } + $scope.abortTransit = function(items) { var transit_ids = []; angular.forEach(items, function(item) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js index 2c6ba639ea..7c0e0e8419 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js @@ -182,6 +182,19 @@ function($scope , $window , $location , egCore , egGridDataProvider , egCirc) { } } + $scope.showMarkDiscard = 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_discard(copy_ids).then(function() { + // update grid items? + }); + } + } + $scope.showLastFewCircs = function(items) { if (items.length && (copy = items[0].acp)) { var url = $location.path( diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js index f76d92b014..3654d19c78 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js @@ -711,6 +711,17 @@ function($window , $location , $timeout , egCore , egHolds , egCirc) { }); } + service.mark_discard = function(items) { + angular.forEach(items, function(item) { + if (item.copy) { + egCirc.mark_discard({ + id: item.copy.id(), + barcode: item.copy.barcode() + }).then(service.refresh); + } + }); + } + service.mark_missing = function(items) { var copy_ids = items .filter(function(item) { return Boolean(item.copy) }) diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/item.js b/Open-ILS/web/js/ui/default/staff/circ/services/item.js index c39f0380be..858a91c590 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/item.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/item.js @@ -644,6 +644,18 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog }); } + service.selectedHoldingsDiscard = function (items) { + angular.forEach(items, function(cp) { + if (cp) { + egCirc.mark_discard({ + id: cp.id, + barcode: cp.barcode, + refresh: cp.refresh + }); + } + }); + } + service.selectedHoldingsMissing = function (items) { egCirc.mark_missing(items.map(function(el){return el.id;})).then(function(){ angular.forEach(items, function(cp){service.add_barcode_to_list(cp.barcode)});