Attempt to add toast to individual view
authorJason Stephenson <jason@sigio.com>
Sun, 9 Jan 2022 01:08:11 +0000 (20:08 -0500)
committerJason Stephenson <jason@sigio.com>
Sun, 9 Jan 2022 01:08:11 +0000 (20:08 -0500)
Open-ILS/web/js/ui/default/staff/cat/item/app.js

index 0a9371a..7346e2a 100644 (file)
@@ -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,6 +156,11 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD
     $scope.update_inventory = function() {
         itemSvc.updateInventory([$scope.args.copyId], null)
         .then(function(res) {
+            if (res[0]) {
+                ngToast.create(egCore.strings.SUCCESS_UPDATE_INVENTORY);
+            } else {
+                ngToast.warning(egCore.strings.FAIL_UPDATE_INVENTORY);
+            }
             $timeout(function() { location.href = location.href; }, 1000);
         });
     }