Inventory details
This commit is contained in:
@@ -14,13 +14,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
controller.$inject = ['$scope', 'inventorySvc'];
|
||||
function controller($scope, inventorySvc) {
|
||||
controller.$inject = ['$scope', 'inventorySvc', 'transactionSvc'];
|
||||
function controller($scope, inventorySvc, transactionSvc) {
|
||||
var vm = this;
|
||||
vm.save = save;
|
||||
|
||||
vm.saving = false;
|
||||
vm.inventory = angular.copy($scope.inventory);
|
||||
vm.transactions = [];
|
||||
|
||||
function loadTransactions() {
|
||||
transactionSvc
|
||||
.filterByInventoryId(vm.inventory.id)
|
||||
.success(function(data) {
|
||||
angular.merge(vm.transactions, data.transactions);
|
||||
});
|
||||
}
|
||||
|
||||
loadTransactions();
|
||||
|
||||
vm.save = save;
|
||||
vm.saving = false;
|
||||
vm.errorMessage = null;
|
||||
|
||||
function save() {
|
||||
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
window.app.directive('inventoryDetails', inventoryDetails);
|
||||
function inventoryDetails() {
|
||||
window.app.directive('inventoryList', inventoryList);
|
||||
function inventoryList() {
|
||||
return {
|
||||
scope: {"inventories" : "="},
|
||||
templateUrl: '/inventory/template/inventoryDetails.tmpl.cshtml',
|
||||
templateUrl: '/inventory/template/inventoryList.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
@@ -18,10 +18,10 @@
|
||||
vm.inventories = $scope.inventories;
|
||||
vm.edit = edit;
|
||||
|
||||
function edit() {
|
||||
function edit(inventory) {
|
||||
$uibModal.open({
|
||||
template: '<editInventory inventory="inventory" />',
|
||||
scope: angular.extend($scope.$new(true), { inventory: vm.inventory })
|
||||
template: '<edit-inventory inventory="inventory" />',
|
||||
scope: angular.extend($scope.$new(true), { inventory: inventory })
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -46,11 +46,7 @@
|
||||
}
|
||||
|
||||
function getInventory(id) {
|
||||
for (var i = 0; i < inventories.length; i++) {
|
||||
if (inventories[i].Id == id) return inventories[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
return $http.post('/Inventory/Find', { id: id });
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -1,30 +0,0 @@
|
||||
@using InventoryTraker.Web.Helpers
|
||||
@model InventoryTraker.Web.Models.InventoryViewModel
|
||||
@{
|
||||
var inventory = Html.Angular().ModelFor("inventory");
|
||||
}
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Units per Case</th>
|
||||
<th>Case Qty</th>
|
||||
<th>Unit Qty</th>
|
||||
<th>Exp Date</th>
|
||||
<th>Added Date</th>
|
||||
<th>Memo</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<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>
|
||||
<td>@inventory.BindingFor(x => x.ExpirationDate, "date:'shortDate'")</td>
|
||||
<td>@inventory.BindingFor(x => x.AddedDate, "date:'shortDate'")</td>
|
||||
<td>@inventory.BindingFor(x => x.Memo)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -23,10 +23,15 @@
|
||||
|
||||
@distribution.FormGroupFor(m => m.Destination)
|
||||
|
||||
<table class="table" ng-class="vm.getValidationClass()">
|
||||
@distribution.FormGroupFor(m => m.DistributedDate)
|
||||
|
||||
@distribution.FormGroupFor(m => m.Memo)
|
||||
|
||||
<table class="table table-condensed" ng-class="vm.getValidationClass()">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name<br/>Units per Case<br/>Expiration Date</th>
|
||||
<th>Name<br/>Units per Case</th>
|
||||
<th>Expiration Date</th>
|
||||
<th>Available Case Qty</th>
|
||||
<th>Distribute Case Qty</th>
|
||||
</tr>
|
||||
@@ -34,13 +39,13 @@
|
||||
<tbody>
|
||||
<tr ng-repeat="inventory in vm.quantities" inventory="inventory">
|
||||
<td>
|
||||
{{inventory.name}}<br />
|
||||
{{inventory.name}}<br/>
|
||||
{{inventory.unitsPerCase}} / {{inventory.containerType}}<br/>
|
||||
Exp: {{inventory.expirationDate | date:'shortDate'}}
|
||||
</td>
|
||||
<td>{{inventory.expirationDate | date:'shortDate'}}</td>
|
||||
<td>{{inventory.quantity}}</td>
|
||||
<td>
|
||||
<div class="form-group col-sm-7" form-group-validation="DistributeQuantity{{inventory.name}}">
|
||||
<div class="form-group col-sm-9" form-group-validation="DistributeQuantity{{inventory.name}}">
|
||||
<input name="DistributeQuantity{{inventory.name}}" type="number"
|
||||
class="form-control"
|
||||
ng-model="inventory.distributeQuantity"
|
||||
@@ -53,10 +58,6 @@
|
||||
</table>
|
||||
|
||||
|
||||
@distribution.FormGroupFor(m => m.DistributedDate)
|
||||
|
||||
@distribution.FormGroupFor(m => m.Memo)
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
||||
@@ -6,25 +6,56 @@
|
||||
<fieldset ng-disabled="vm.saving">
|
||||
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title"><i class="fa fa-cubes"></i> Edit Inventory</h3>
|
||||
<h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Details</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
|
||||
Make changes to the inventory below.
|
||||
</div>
|
||||
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
|
||||
{{vm.errorMessage}}
|
||||
</div>
|
||||
|
||||
@Html.Angular().FormForModel("vm.inventory")
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Name</dt>
|
||||
<dd>{{vm.inventory.name}}</dd>
|
||||
<dt>Added</dt>
|
||||
<dd>{{vm.inventory.addedDate | date:'shortDate'}}</dd>
|
||||
<dt>Expiration</dt>
|
||||
<dd>{{vm.inventory.expirationDate | date:'shortDate'}}</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Memo</th>
|
||||
<th>Transaction Date</th>
|
||||
<th>Add Qty</th>
|
||||
<th>Remove Qty</th>
|
||||
<th>Qty</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="transaction in vm.transactions | orderBy:'-transactionDate'">
|
||||
<td>{{transaction.transactionType}}</td>
|
||||
<td>{{transaction.memo}}</td>
|
||||
<td>{{transaction.transactionDate | date:'shortDate'}}</td>
|
||||
<td>{{transaction.addedQuantity}}</td>
|
||||
<td>{{transaction.removedQuantity}}</td>
|
||||
<td>{{transaction.currentQuantity}}</td>
|
||||
<td><a href="" ng-show="$first"><i class="fa fa-trash"></i></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success">Save</button>
|
||||
<button type="button" class="btn btn-warning" ng-click="$parent.$dismiss()">Cancel</button>
|
||||
<button type="button" class="btn" ng-click="$parent.$dismiss()">Cancel</button>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
@using InventoryTraker.Web.Helpers
|
||||
@model InventoryTraker.Web.Models.InventoryViewModel
|
||||
@{
|
||||
var inventory = Html.Angular().ModelFor("inventory");
|
||||
}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="control-column"></th>
|
||||
<th>Name</th>
|
||||
<th>Units per Case</th>
|
||||
<th>Case Qty</th>
|
||||
<th>Unit Qty</th>
|
||||
<th>Exp Date</th>
|
||||
<th>Added Date</th>
|
||||
<th>Memo</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="inventory in vm.inventories">
|
||||
<td><a href="" ng-click="vm.edit(inventory)"><i class="fa fa-edit"></i></a></td>
|
||||
<td>@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>
|
||||
<td ng-class="{ danger: inventory.isExpired }">
|
||||
@inventory.BindingFor(x => x.ExpirationDate, "date:'shortDate'")
|
||||
</td>
|
||||
<td>@inventory.BindingFor(x => x.AddedDate, "date:'shortDate'")</td>
|
||||
<td>@inventory.BindingFor(x => x.Memo)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user