Remove inventory, delete transactions

This commit is contained in:
2016-09-14 07:53:41 -04:00
parent 9cdf90b1e9
commit 052f812d6f
33 changed files with 3250 additions and 142 deletions
@@ -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;
});
}
})();