@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.InventoryAddForm
@{
    var inventory = Html.Angular().ModelFor("vm.inventory");
}
<form novalidate
	  name="vm.form"
	  ng-submit="vm.form.$valid && vm.add()">
	<fieldset ng-disabled="vm.saving">

		<div class="modal-header">
		    <h3 class="modal-title"><i class="fa fa-cubes"></i> Inventory Addition</h3>
		</div>

		<div class="modal-body">

            <status-message message="vm.statusMessage" ng-hide="vm.errorMessages.length"></status-message>
		    <error-list errors="vm.errorMessages"></error-list>

		    <script type="text/ng-template" id="programTypeahead.html">
                <a>
                    <span ng-bind-html="match.label.name | uibTypeaheadHighlight:query"></span>
                </a>
            </script>

            @inventory.FormGroupFor(m => m.Id)

		    <div class="form-group" form-group-validation="ProgramName">
		        <label for="ProgramName" class="control-label">Program Name</label>
		        <input name="ProgramName" type="text"
		               ng-model="vm.inventory.programName"
                       required
		               uib-typeahead=
		               "programName for programName in vm.programNames 
                       |filter:$viewValue
                       | limitTo:8"
		               class="form-control">
                <i class="fa fa-search form-control-feedback"></i>
		    </div>

		    @inventory.FormGroupFor(m => m.ProgramSubtype)
		    @inventory.FormGroupFor(m => m.Description)
		    @inventory.FormGroupFor(m => m.ShredReadyDate)
            @inventory.FormGroupFor(m => m.AddedDate)
            @inventory.FormGroupFor(m => m.Memo)

        </div>

	<div class="modal-footer">
		<button class="btn btn-success" ng-disabled="vm.form.$invalid || vm.form.$pristine">Add</button>
		<button type="button" class="btn" ng-click="$dismiss()">Cancel</button>
	</div>

	</fieldset>
</form>