<script type="text/ng-template" id="newPropertyMaintenanceRecordModal.html">
	<form name="form" class="form-horizontal" ng-submit="_save(maintenance_record)" novalidate>
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="cancel()">
				<i class="ti ti-close"></i>
			</button>
			<h4 class="modal-title">New Maintenance Record</h4>
		</div>
		<div class="modal-body">
			<p>Fields with <span style="color: #cc0000;">*</span> are required.</p>
			<div class="form-group">
				<label for="date" class="col-sm-3 control-label">Date <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-8">
					<input type="text" ng-focus="_openCalendar($event, 'date')" class="form-control datepicker" is-open="calendar_opened['date']" datepicker-popup="MM/dd/yyyy" close-text="Close" name="date" id="date" ng-model="maintenance_record.date" ng-required="true">
					<p class="help-block" ng-show="form.date.$touched && form.date.$error.required">Value is required.</p>
				</div>
			</div>
			<div class="form-group">
				<label for="product" class="col-sm-3 control-label">Product <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-8">
					<ui-select ng-model="maintenance_record.product" ng-disabled="disabled" style="width: 100%" ng-required="true">
									<ui-select-match placeholder="Select a product...">{{$select.selected.name}}</ui-select-match>
									<ui-select-choices repeat="product in products | filter: $select.search | limitTo: 40">
										<span ng-bind-html="product.product_category.name + ' / ' + product.name + ' ($' + product.price + ')' | highlight: $select.search"></span>
									</ui-select-choices>
								</ui-select>
					<p class="help-block" ng-show="form.product.$touched && form.product.$error.required">Value is required.</p>
				</div>
			</div>
			<div class="form-group">
				<label for="warranty" class="col-sm-3 control-label">Warranty (In Days) <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="warranty" id="warranty" ng-model="maintenance_record.warranty" ng-required="true">
					<p class="help-block" ng-show="form.warranty.$touched && form.warranty.$error.required">Value is required.</p>
				</div>
			</div>
			<div class="form-group">
				<label for="description" class="col-sm-3 control-label">Description</label>
				<div class="col-sm-8">
					<textarea class="form-control" rows="5" ng-model="maintenance_record.description"></textarea>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<a class="btn btn-danger" ng-click="cancel()">
				<i class="ti ti-close" style="margin-right: 5px;"></i>
				Cancel
			</a>
			<button type="submit" ng-disabled="!form.$valid" class="btn-primary btn">
				<i class="ti ti-share" style="margin-right: 5px;"></i>
				Save
			</button>
		</div>
	</form>
</script>