"[% 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 =
* 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
$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);
});
}
$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);
{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;
}
});
}