<ol class="breadcrumb">
	<li><a href="#/">Dashboard</a></li>
	<li><a href="#/to-dos">To Dos</a></li>
	<li class="active">{{vm.action}} To Do</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.todo)" novalidate>
				<input type="hidden" ng-if="vm.action == 'Edit'" name="id" id="id" ng-model="vm.todo.id">
				<div class="panel panel-midnightblue">
					<div class="panel-heading">
						<h2>{{vm.action}} To Do</h2>
					</div>
					<div class="panel-body">
						<p>Fields with <span style="color: #cc0000;">*</span> are required.</p>
						<div class="form-group">
							<label for="title" class="col-sm-2 control-label">Title <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<input type="text" class="form-control" name="title" id="title" ng-model="vm.todo.title" ng-required="true" ng-minlength="3">
								<p class="help-block" ng-show="form.title.$touched && form.title.$error.required">Value is required.</p>
								<p class="help-block" ng-show="form.title.$touched && form.title.$error.minlength">Value is too short.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="employee_id" class="col-sm-2 control-label">Employee <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<select class="form-control" name="employee_id" id="employee_id"
									ng-model="vm.todo.employee_id" ng-required="true"
										ng-options="item.id as item.name for item in vm._employees">
									<option value="">-- Select --</option>
								</select>
								<p class="help-block" ng-show="form.todo_employee_id.$touched && form.todo_employee_id.$error.required">Value is required.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="due_date" class="col-sm-2 control-label">Due Date</label>
							<div class="col-sm-8">
								<input type="text" name="due_date" id="due_date" ng-focus="vm._openCalendar($event, 'due_date')" class="form-control datepicker" is-open="vm.calendar_opened['due_date']" datepicker-popup="MM/dd/yyyy" close-text="Close" ng-model="vm.todo.due_date" />
							</div>
						</div>
						<div class="form-group">
							<label for="description" class="col-sm-2 control-label">Description <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<textarea class="form-control" name="description" id="description" ng-model="vm.todo.description" rows="5" ng-required="true"></textarea>
							</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="#/to-dos" class="btn-default btn">Cancel</a>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
