Add commodity and quantity to input forms

This commit is contained in:
2016-08-11 09:27:38 -04:00
parent 0b0cb7c73a
commit f4e3ac1cce
11 changed files with 200 additions and 29 deletions
@@ -11,14 +11,22 @@
}
}
controller.$inject = ['$scope', 'inventorySvc'];
function controller($scope, inventorySvc) {
controller.$inject = ['$scope', 'inventorySvc', 'inventoryTypeSvc'];
function controller($scope, inventorySvc, inventoryTypeSvc) {
var vm = this;
vm.add = add;
vm.saving = false;
vm.inventory = {};
vm.inventoryTypes = inventoryTypeSvc.inventoryTypes;
vm.errorMessage = null;
vm.quantity = quantity;
function quantity() {
vm.inventory.quantity =
$scope.palletCount * $scope.casesPerPallet + $scope.caseCount;
return vm.inventory.quantity;
}
function add() {
vm.saving = true;
@@ -34,5 +42,10 @@
vm.saving = false;
});
}
$scope.$watch('commodity', function (newValue, oldValue) {
if (newValue)
vm.inventory.inventoryTypeId = newValue.id;
});
}
})();