<ol class="breadcrumb">
	<li><a href="#/">Dashboard</a></li>
	<li><a href="#/services">Services</a></li>
	<li class="active">{{vm.action}} Service</li>
</ol>

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<form name="form" class="form-horizontal" ng-submit="vm._save(vm.service)" novalidate>
				<input type="hidden" ng-if="vm.action == 'Edit'" name="id" id="id" ng-model="vm.service.id">
				<div class="panel panel-midnightblue">
					<div class="panel-heading">
						<h2>{{vm.action}} Service</h2>
					</div>
					<div class="panel-body">
						<p>Fields with <span style="color: #cc0000;">*</span> are required.</p>
						<div class="form-group">
							<label for="service_category_id" class="col-sm-2 control-label">Category <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<select class="form-control" name="service_category_id" id="service_category_id"
									ng-model="vm.service.service_category_id" ng-required="true"
										ng-options="item.id as item.name for item in vm._categories">
									<option value="">-- Select --</option>
								</select>
								<p class="help-block" ng-show="form.service_category_id.$touched && form.service_category_id.$error.required">Value is required.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="name" class="col-sm-2 control-label">Name <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<input type="text" class="form-control" name="name" id="name" ng-model="vm.service.name" ng-required="true" ng-minlength="3">
								<p class="help-block" ng-show="form.name.$touched && form.name.$error.required">Value is required.</p>
								<p class="help-block" ng-show="form.name.$touched && form.name.$error.minlength">Value is too short.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="cost" class="col-sm-2 control-label">Cost Price</label>
							<div class="col-sm-8">
								<div class="input-group">							
									<span class="input-group-addon">
										<i class="ti ti-money"></i>
									</span>
									<input type="text" class="form-control" name="cost" id="cost" ng-model="vm.service.cost" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/">
								</div>
								<p class="help-block" ng-show="form.cost.$touched && form.cost.$error.pattern">Decimal is required.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="price" class="col-sm-2 control-label">Base Price <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<div class="input-group">							
									<span class="input-group-addon">
										<i class="ti ti-money"></i>
									</span>
									<input type="text" class="form-control" name="price" id="price" ng-model="vm.service.price" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/" ng-required="true">
								</div>
								<p class="help-block" ng-show="form.price.$touched && form.price.$error.required">Value is required.</p>
								<p class="help-block" ng-show="form.price.$touched && form.price.$error.pattern">Decimal is required.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="duration_minutes" class="col-sm-2 control-label">Duration (In Minutes) <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<div class="input-group">							
									<span class="input-group-addon">
										<i class="ti ti-timer"></i>
									</span>
									<input type="number" class="form-control" name="duration_minutes" id="duration_minutes" ng-model="vm.service.duration_minutes" ng-required="true">
								</div>
								<p class="help-block" ng-show="form.duration_minutes.$touched && form.duration_minutes.$error.required">Value is required.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="description" class="col-sm-2 control-label">Description</label>
							<div class="col-sm-8">
								<textarea class="form-control" name="description" id="description" ng-model="vm.service.description" rows="5"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label for="send_to_quickbooks" class="col-sm-2 control-label">Send To Quickbooks? <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<div class="radio-inline">
									<label>
										<input type="radio" name="send_to_quickbooks" id="send_to_quickbooks" value="0" ng-model="vm.service.send_to_quickbooks" ng-required="true"> No
									</label>
								</div>
								<div class="radio-inline">
									<label>
										<input type="radio" name="send_to_quickbooks" id="send_to_quickbooks" value="1" ng-model="vm.service.send_to_quickbooks" ng-required="true"> Yes
									</label>
								</div>
								<p class="help-block" ng-show="form.send_to_quickbooks.$touched && form.send_to_quickbooks.$error.required">Value is required.</p>
							</div>
						</div>
					</div>
					<div class="panel-footer">
						<div class="row">
							<div class="col-sm-8 col-sm-offset-2">
								<button type="submit" ng-disabled="!form.$valid" class="btn-primary btn">Save</button>
								<a href="#/services" class="btn-default btn">Cancel</a>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
