Initiate InventoyTypes from a xlxs
Arrival mostly working
This commit is contained in:
@@ -14,18 +14,25 @@
|
||||
controller.$inject = ['$scope', 'inventorySvc', 'inventoryTypeSvc'];
|
||||
function controller($scope, inventorySvc, inventoryTypeSvc) {
|
||||
var vm = this;
|
||||
vm.add = add;
|
||||
|
||||
vm.add = add;
|
||||
vm.saving = false;
|
||||
vm.inventory = {};
|
||||
vm.inventoryTypes = inventoryTypeSvc.inventoryTypes;
|
||||
vm.errorMessage = null;
|
||||
vm.quantity = quantity;
|
||||
|
||||
function zeroNaN(v) {
|
||||
return isNaN(v) ? 0 : v;
|
||||
}
|
||||
|
||||
function quantity() {
|
||||
vm.inventory.quantity =
|
||||
$scope.palletCount * $scope.casesPerPallet + $scope.caseCount;
|
||||
return vm.inventory.quantity;
|
||||
zeroNaN($scope.palletCount)
|
||||
* zeroNaN($scope.casesPerPallet)
|
||||
+ zeroNaN($scope.caseCount);
|
||||
|
||||
return vm.inventory.quantity > 0 ? vm.inventory.quantity : "";
|
||||
}
|
||||
|
||||
function add() {
|
||||
@@ -36,14 +43,15 @@
|
||||
$scope.$close();
|
||||
})
|
||||
.error(function(data) {
|
||||
vm.errorMessage = 'There was a problem adding the inventory: ' + data;
|
||||
vm.errorMessage =
|
||||
'There was a problem adding the inventory: ' + data.errorMessage;
|
||||
})
|
||||
.finally(function() {
|
||||
vm.saving = false;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.$watch('commodity', function (newValue, oldValue) {
|
||||
$scope.$watch('vm.commodity', function (newValue, oldValue) {
|
||||
if (newValue)
|
||||
vm.inventory.inventoryTypeId = newValue.id;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user