<div ng-cloak>
	<button class="btn btn-default" ng-click="showModal()" eat-click><i class="fa fa-truck"></i> Order Existing Part</button>
	<script type="text/ng-template" id="modals/request-existing-part-modal.html">
		<div class="modal-content">
			<div class="modal-header">
				<h3 class="modal-title">Order Existing Part</h3>
			</div>

			<form name="secondHandPartForm" class="form-horizontal" ng-submit="save()">
				<div class="modal-body">
					<div class="alert alert-danger ng-scope" ng-if="errors">
			          	<span ng-bind-html="errors"></span>
			        	<br>
			        </div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="inputPartName">Part Name:</label>
						<div class="col-sm-6">
							<input class="form-control" type="hidden" ng-model="data.part_search" ui-select2="service.select2Options"  ng-change="selectPart()" required>
						</div>
						<div class="col-sm-3">
							<label class="checkbox-inline">
								<input type="checkbox" ng-true-value="1" ng-false-value="0" ng-model="data.discontinued" style="top:-2px;">
								<span class="muted" style="position: absolute;  top: -10px;">Show Discontinued</span>
							</label>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="inputPartQuantity">Quantity:</label>
						<div class="col-sm-9">
							<input type="number" class="form-control" name="quantity" ng-model="data.quantity" id="inputPartQuantity" placeholder="enter quantity" ng-init="data.quantity = 1" required>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<span class="btn btn-default" ng-click="hideModal()">Close</span>
					<button class="btn btn-primary" ng-disabled=" !data.part_search || ! data.quantity || loading"><i ng-if="loading" class="fa fa-spinner fa-spin"></i> Add</button>
				</div>
			</form>
		</div>
	</script>
</div>