<form id='projectForm' name='projectForm' ng-submit="save()" class="form-horizontal form-edit" confirm-on-exit>

	@include('bookings::templates.bookings_projects_header')
	
	@include('bookings::templates.location')

	<h4 class="subheader">Project Description</h4>
	<div class="form-group">
		<label for="assigned_to" class="col-sm-3 control-label label-required">Project leader:</label>
		<div class="col-sm-9">
			<select name="assigned_to" ng-model="data.assigned_to" class="form-control" required>
				<option value="">Select Project Leader</option>
				@foreach(App\Models\User::getActiveList()->pluck('name', 'id') as $id => $name)
					<option value="{{ $id }}">{{ $name }}</option>
				@endforeach
			</select>
		</div>
	</div>
	<div class="form-group">
		<label for="name" class="col-sm-3 control-label label-required">Name:</label>
		<div class="col-sm-9">
			<input type="text" name="name" ng-model="data.name" class="form-control" required>
		</div>
	</div>
	<div class="form-group">
		<label for="description" class="col-sm-3 control-label label-required">Description:</label>
		<div class="col-sm-9">
			<textarea name="description" ng-model="data.description" class="form-control" summernote summernote-height="200"></textarea>
		</div>
	</div>

	<div class="alert alert-warning" ng-if="! formIsValid()">
		<p class="lead"><i class="fa fa-warning"></i> The following are required before saving the job:</p>
		<ul>
			<li ng-if="!clientManager.isSelected()">You need to select a customer from the left hand side.</li>
			<li ng-if="!data.assigned_to">Project leader is required.</li>
			<li ng-if="!data.name || data.name.trim() === ''">Name is required.</li>
			<li ng-if="!data.description || data.description.trim() === ''">Description is required.</li>
		</ul>
	</div>

	<div class="form-actions">
		<input type="hidden" name="client_id" ng-model="data.client_id" required>

		<button class="btn btn-primary" data-loading-text="Saving..." ng-disabled="!formIsValid()">
			Create project
		</button>
	</div>

</form>