Remove inventory, delete transactions
This commit is contained in:
@@ -18,10 +18,10 @@
|
||||
|
||||
vm.add = add;
|
||||
vm.saving = false;
|
||||
vm.inventory = {};
|
||||
vm.inventory = { };
|
||||
vm.inventoryTypes = inventoryTypeSvc.inventoryTypes;
|
||||
vm.errorMessages = [];
|
||||
|
||||
vm.errorMessage = null;
|
||||
vm.quantity = quantity;
|
||||
|
||||
function zeroNaN(v) {
|
||||
@@ -37,6 +37,11 @@
|
||||
return vm.inventory.quantity > 0 ? vm.inventory.quantity : "";
|
||||
}
|
||||
|
||||
$scope.$watch('vm.commodity', function (newValue) {
|
||||
if (newValue)
|
||||
vm.inventory.inventoryTypeId = newValue.id;
|
||||
});
|
||||
|
||||
function add() {
|
||||
vm.saving = true;
|
||||
inventorySvc.add(vm.inventory)
|
||||
@@ -45,17 +50,11 @@
|
||||
$scope.$close();
|
||||
})
|
||||
.error(function(data) {
|
||||
vm.errorMessage =
|
||||
'There was a problem adding the inventory: ' + data.errorMessage;
|
||||
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
|
||||
})
|
||||
.finally(function() {
|
||||
vm.saving = false;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.$watch('vm.commodity', function (newValue, oldValue) {
|
||||
if (newValue)
|
||||
vm.inventory.inventoryTypeId = newValue.id;
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user