Inventory Type editing

This commit is contained in:
2016-08-31 10:30:27 -04:00
parent 016f031664
commit c86d7fb1ed
26 changed files with 358 additions and 67 deletions
@@ -31,7 +31,7 @@
$scope.$parent.$close();
})
.error(function(data) {
vm.errorMessage = 'There was a problem saving changes to the inventory: ' + data;
vm.errorMessage = 'There was a problem saving changes to the inventory: ' + data.errorMessage;
})
.finally(function() {
vm.saving = false;
@@ -1,48 +0,0 @@
(function () {
window.app.factory('inventoryTypeSvc', inventoryTypeSvc);
inventoryTypeSvc.$inject = ['$http'];
function inventoryTypeSvc($http) {
var inventoryTypes = [];
loadInventoryTypes();
var svc = {
add: add,
update: update,
inventoryTypes: inventoryTypes,
getInventoryType: getInventoryType
};
return svc;
function loadInventoryTypes() {
$http.post('/InventoryType/All')
.success(function (data) {
inventoryTypes.addRange(data);
});
}
function add(inventoryType) {
return $http.post('/InventoryType/Add', inventoryType)
.success(function (inventoryType) {
inventoryTypes.unshift(inventoryType);
});
}
function update(existingInventory, updatedInventory) {
return $http.post('/InventoryType/Update', updatedInventory)
.success(function (inventory) {
angular.extend(existingInventory, inventory);
});
}
function getInventoryType(id) {
for (var i = 0; i < inventoryTypes.length; i++) {
if (inventoryTypes[i].Id == id) return inventoryTypes[i];
}
return null;
}
}
})();
@@ -9,7 +9,7 @@
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Inventory Arrival</h3>
<h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Arrival</h3>
</div>
<div class="modal-body">
@@ -17,8 +17,8 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="inventory in vm.inventories" inventory="inventory">
<td><strong>@inventory.BindingFor(x => x.Name)</strong> <a href="" ng-click="vm.edit()"><i class="fa fa-edit"></i></a></td>
<tr ng-repeat="inventory in vm.inventories">
<td><a href="" ng-click="vm.edit()"><i class="fa fa-edit"></i></a> @inventory.BindingFor(x => x.Name) </td>
<td>@inventory.BindingFor(x => x.UnitsPerCase) / @inventory.BindingFor(x => x.ContainerType)</td>
<td>@inventory.BindingFor(x => x.Quantity)</td>
<td>{{inventory.quantity * inventory.unitsPerCase}}</td>
@@ -9,7 +9,7 @@
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Inventory Distribution</h3>
<h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Distribution</h3>
</div>
<div class="modal-body">
@@ -6,7 +6,7 @@
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Edit Inventory</h3>
<h3 class="modal-title"><i class="fa fa-cubes"></i> Edit Inventory</h3>
</div>
<div class="modal-body">