From 522687cccc6c5b7507d8d83728a680c768f1a234 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sat, 8 Jan 2022 16:14:28 -0500 Subject: [PATCH] LP1883171 & LP1940663: Update Staff client changes based on feedback Modify the Item Staus view to check the new return values of the update copy inventory function. Fix toast handling in the list view to properly report success and failure. Add toast handling to the single copy Item Status view to report success and failure. NOTE: More work could be done on the toasts to report number of successful updates, etc. I tried using the compileContent and trusted HTML, but this lead to new errors that I couldn't decipher. This work was sponsored by NOBLE. Signed-off-by: Jason Stephenson --- Open-ILS/src/templates/staff/cat/item/index.tt2 | 4 ++++ Open-ILS/web/js/ui/default/staff/cat/item/app.js | 14 +++++++++----- Open-ILS/web/js/ui/default/staff/circ/services/item.js | 10 ++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/item/index.tt2 b/Open-ILS/src/templates/staff/cat/item/index.tt2 index f200f6e308..8980a65bca 100644 --- a/Open-ILS/src/templates/staff/cat/item/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/index.tt2 @@ -36,6 +36,10 @@ "[% l('Updated most recent inventory data for selected items.') %]"; s.FAIL_UPDATE_INVENTORY = "[% l('Failed to update recent inventory data for selected items.')%]"; + s.SUCCESS_UPDATE_INVENTORY_SINGLE = + "[% l('Updated most recent inventory data for this item.') %]"; + s.FAIL_UPDATE_INVENTORY_SINGLE = + "[% l('Failed to update recent inventory data for this item.')%]"; s.ITEM_SUCCESSFULLY_MODIFIED = "[% l('Item successfully modified') %]"; s.ITEMS_SUCCESSFULLY_MODIFIED = 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 8e21e25994..1338a251a9 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 @@ -52,8 +52,8 @@ angular.module('egItemStatus', * Parent scope for list and detail views */ .controller('SearchCtrl', - ['$scope','$q','$window','$location','$timeout','egCore','egNet','egGridDataProvider','egItem', 'egCirc', -function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , egCirc) { + ['$scope','$q','$window','$location','$timeout','egCore','egNet','egGridDataProvider','egItem', 'egCirc', 'ngToast', +function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , egCirc, ngToast) { $scope.args = {}; // search args // sub-scopes (search / detail-view) apply their version @@ -156,7 +156,12 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD $scope.update_inventory = function() { itemSvc.updateInventory([$scope.args.copyId], null) .then(function(res) { - $timeout(function() { location.href = location.href; }, 1000); + if (res[0]) { + ngToast.create(egCore.strings.SUCCESS_UPDATE_INVENTORY_SINGLE); + } else { + ngToast.warning(egCore.strings.FAIL_UPDATE_INVENTORY_SINGLE); + } + $timeout(function() { location.href = location.href; }, 1500); }); } @@ -561,8 +566,7 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD $scope.update_inventory = function() { var copy_list = gatherSelectedHoldingsIds(); itemSvc.updateInventory(copy_list, $scope.gridControls.allItems()).then(function(res) { - if (res) { - $scope.gridControls.allItems(res); + if (res[0]) { ngToast.create(egCore.strings.SUCCESS_UPDATE_INVENTORY); } else { ngToast.warning(egCore.strings.FAIL_UPDATE_INVENTORY); 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 872c1b51f0..8070346f27 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 @@ -212,14 +212,16 @@ function(egCore , egOrg , egCirc , $uibModal , $q , $timeout , $window , ngToast {alci: ['inventory_workstation']} }).then(function(alci) { //update existing grid rows - item["latest_inventory.inventory_date"] = alci.inventory_date(); - item["latest_inventory.inventory_workstation.name"] = - alci.inventory_workstation().name(); + if (alci) { + item["latest_inventory.inventory_date"] = alci.inventory_date(); + item["latest_inventory.inventory_workstation.name"] = + alci.inventory_workstation().name(); + } }); } }); }); - return all_items || res; + return res; } }); } -- 2.11.0