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
@@ -14,12 +14,15 @@
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
Enter details for the inventory arrival below.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
Enter details for the inventory arrival below.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
There were problems adding the inventory.
<ul>
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
</ul>
</div>
<script type="text/ng-template" id="commodityTypeahead.html">
<a>
@@ -14,11 +14,14 @@
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
Enter details for the inventory arrival below.
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
Enter details for the inventory distribution below.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
There were problems distributing the inventory.
<ul>
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
</ul>
</div>
@distribution.FormGroupFor(m => m.Destination)
@@ -42,7 +45,7 @@
{{inventory.name}}<br/>
{{inventory.unitsPerCase}} / {{inventory.containerType}}<br/>
</td>
<td>{{inventory.expirationDate | date:'shortDate'}}</td>
<td ng-class="{ danger: inventory.isExpired }">{{inventory.expirationDate | date:'shortDate'}}</td>
<td>{{inventory.quantity}}</td>
<td>
<div class="form-group col-sm-9" form-group-validation="DistributeQuantity{{inventory.name}}">
@@ -56,8 +59,6 @@
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
@@ -1,62 +1,71 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.InventoryAddForm
@model InventoryTraker.Web.Models.InventoryAddForm
<form novalidate
name="vm.form"
ng-submit="vm.form.$valid && vm.save()">
<fieldset ng-disabled="vm.saving">
name="vm.form"
ng-submit="vm.form.$valid && vm.save()">
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Details</h3>
</div>
<div class="modal-header">
<h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Details</h3>
</div>
<div class="modal-body">
<div class="modal-body">
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
<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>
<inventory-info inventory="inventory"></inventory-info>
<div class="modal-footer">
<button ng-click="vm.removeInventory()" class="btn btn-sm pull-left"><i class="fa fa-minus-circle"></i> Remove Inventory</button>
<button class="btn btn-success">Save</button>
<button type="button" class="btn" ng-click="$parent.$dismiss()">Cancel</button>
</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'">
<hr />
<h4 class="modal-title pull-left"><i class="fa fa-fw fa-list"></i> Transactions</h4>
<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 ng-hide="vm.loadingTransactions">
<tr ng-repeat-start="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>
<td>
<a href="" ng-show="$first"
ng-click="vm.confirmDeleteTransaction = !vm.confirmDeleteTransaction">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
</tbody>
</table>
<div >
</div>
<tr ng-repeat-end ng-show="$first && vm.confirmDeleteTransaction">
<td colspan="7">
<span ng-show="vm.transactions.length == 1" class="text-danger">
Warning: Deleting the only transaction will delete the entire inventory
</span>
<button
ng-click="vm.deleteTransaction(transaction.id)"
class="btn btn-danger btn-sm pull-right">
<i class="fa fa-trash"></i> Confirm Delete
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-success">Save</button>
<button type="button" class="btn" ng-click="$parent.$dismiss()">Cancel</button>
</div>
</fieldset>
</fieldset>
</form>
@@ -0,0 +1,19 @@
<dl class="dl-horizontal">
<dt>Name</dt>
<dd>{{inventory.name}}</dd>
<dt>Units per Case</dt>
<dd>{{inventory.unitsPerCase}} / {{inventory.containerType}}</dd>
<dt>Added Date</dt>
<dd>{{inventory.addedDate | date:'shortDate'}}</dd>
<dt>Expiration Date</dt>
<dd>
<span ng-class="{ 'bg-danger': inventory.isExpired }">
{{inventory.expirationDate | date:'shortDate'}}
<span ng-show="inventory.isExpired" class="label label-danger">Expired</span>
</span>
</dd>
<dt>Quantity (in Cases)</dt>
<dd>{{inventory.quantity}}</dd>
<dt ng-show="inventory.memo">Memo</dt>
<dd ng-show="inventory.memo">{{inventory.memo}}</dd>
</dl>
@@ -19,8 +19,10 @@
</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>
<a href="" ng-click="vm.edit(inventory)" title="Details"><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>
@@ -0,0 +1,62 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.InventoryRemoveForm
@{
var removeForm = Html.Angular().ModelFor("vm.removeForm");
}
<form novalidate
name="form"
ng-submit="form.$valid && vm.save()">
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Removal</h3>
</div>
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
Enter details for the inventory removal below.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
There were problems removing the inventory.
<ul>
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
</ul>
</div>
<div class="panel panel-default">
<div class="panel-body">
<inventory-info inventory="inventory"></inventory-info>
</div>
</div>
<div class="form-group" form-group-validation="TransactionType">
<label class="radio-inline">
<input type="radio" name="TransactionType"
ng-model="vm.removeForm.transactionType"
value="Expired"
required />
Expired
</label>
<label class="radio-inline">
<input type="radio" name="TransactionType"
ng-model="vm.removeForm.transactionType"
value="Loss"
required />
Loss
</label>
</div>
@removeForm.FormGroupFor(m => m.Quantity)
@removeForm.FormGroupFor(m => m.RemovedDate)
@removeForm.FormGroupFor(m => m.Memo)
</div>
<div class="modal-footer">
<button class="btn btn-success">Remove</button>
<button type="button" class="btn" ng-click="$parent.$dismiss()">Cancel</button>
</div>
</fieldset>
</form>