<div class="modal fade js-task-edit-modal" id="task-edit-modal" tabindex="-2" role="dialog" aria-labelledby="task-edit-modal">
	<div class="modal-dialog modal-xl" role="document">
		<div class="modal-content" ng-if="edit.visible">

			<div class="modal-header">
				<h5 class="modal-title" id="more-info--label">
					<span lmsg="projects.task.modal.add_task" ng-if="edit.task.id==0">[Add task]</span>
					<span lmsg="projects.task.modal.edit_task" ng-if="edit.task.id!=0">[Edit task]</span>
				</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Cancel">
					<span aria-hidden="true">
						<ion-icon name="close-outline"></ion-icon>
					</span>
				</button>
			</div>

			<div class="modal-body">
				<div class="form-horizontal">
					<form id="task-edit-form" class="form-horizontal" name="taskForm">
						<div class="form-group row">
							<label for="" class="col-form-label col-lg-2" lmsg="projects.task.edit.task_name">[Task Name]</label>

							<div class="col-lg-10">
								<input type="text" maxlength="255" class="form-control" placeholder="Task Name" ng-model="edit.task.title" lmsg="placeholder:projects.task.edit.task_name">
								<div ng-show="edit.task.title.length > 255">
									<br>
									<div class="alert alert-warning">
										<lmsg src="projects.warning.field_longer_than_255">[Length warning]</lmsg>
									</div>
								</div>
							</div>
						</div>
						<div class="form-group row">
							<label for="taskDescription" class="col-form-label col-lg-2" lmsg="projects.task.edit.description">[Description]</label>
							<div class="col-lg-10">
								<cla-html-editor ng-model="edit.task.description" application="projects" control="edit.htmlControl"></cla-html-editor>
							</div>
						</div>

						<div class="form-group row">
							<label for="task-edit-user-picker-inner" class="col-form-label col-lg-2" name="projects:task:assigned_to" lmsg="projects.task.assigned_to">[Assigned to]</label>

							<div class="col-lg-10">
								<clang-projects-user-picker select_id="{{edit.listPrefix}}user-picker-{{edit.unique_id}}" ng-model="edit.task.assignees" ng-change="taskAssigneeChanged(edit.task)" project_id="{{edit.task.project_id}}" user_name="{{edit.task.assigned_to.name}}" allow_unset="0" control="edit.userControl"></clang-projects-user-picker>
							</div>
						</div>
						<div class="form-group row">
							<label for="{{edit.listPrefix}}due_date-{{edit.unique_id}}-inner" class="col-form-label col-lg-2" lmsg="projects.task.properties.due_date">[Due date]</label>

							<div class="col-lg-4">
								<cla-date-picker id="task-edit-due_date" ng-model="edit.task.due_date" control="edit.task.control"></cla-date-picker>
							</div>
						</div>
						<div class="form-group row">
							<label for="task-edit-priority" class="col-form-label col-lg-2" lmsg="projects.task.properties.priority">[Priority]</label>

							<div class="col-lg-4">
								<div class="form-inline">
								<select id="task-edit-priority" name="priority" ng-model="edit.task.priority" class="form-control js-task-priorities js-task-edit-priority">
									<option value="0" lmsg="projects.task.priority.none">[No priority]</option>
									<option value="1" lmsg="projects.task.priority.low">[Low priority]</option>
									<option value="2" lmsg="projects.task.priority.medium">[Medium priority]</option>
									<option value="3" lmsg="projects.task.priority.high">[High priority]</option>
								</select>
								</div>
							</div>
						</div>
						<div class="form-group row">
							<div class="col-md-12 col-sm-12" ng-if="edit.task.project_id == 0"></div>
							<div class="offset-lg-2 col-lg-10" ng-if="edit.task.project_id > 0">
								<div ng-if="edit.task.project_id > 0">
								<div class="checkbox">
									<label for="task-edit-private">
										<input type="checkbox" id="task-edit-private" ng-model="edit.task.is_private">
										<ion-icon name="lock-closed-outline"></ion-icon>
										<lmsg src="projects.task.properties.is_private">[Private Task]</lmsg>
									</label>
								</div>
								<p class="text-muted">
									<span lmsg="projects.task.properties.is_private_message">[Users can always see tasks assigned to them]</span>
								</p>
								</div>
							</div>
						</div>
						<div class="form-group row">
							<label for="task-edit-duration" class="col-lg-2 col-form-label" lmsg="projects.task.expected_duration">
								[expected duration]
							</label>
							<div class="col-lg-10">
								<div class="form-inline">
								<input type="text" name="duration" id="task-edit-duration" class="form-control mr-2" size="2" ng-model="edit.task.duration" ng-pattern="/^$|^(0|[1-9]\d*)([.]\d+)?$/" value="0">
								<span ng-class="{'hide-unit': edit.task.project_id < 1}">{{edit.task.duration_units}}</span>
								</div>
								<p class="text-danger" ng-if="taskForm.duration.$invalid">
									<lmsg src="projects.task.duration_value_warning">[Please input a valid duration value (number)]</lmsg>
								</p>
							</div>
						</div>
					</form>
				</div>
			</div>
			<div class="modal-footer">
				<button class="btn btn-primary" ng-click="edit.saveTaskEdit($event, task)" ng-disabled="taskForm.duration.$invalid" lmsg="projects.task.save_task">[Save]</button>
				<button class="btn btn-danger" rel="tooltip" ng-click="edit.deleteTask($event, task)" ng-show="edit.task.perms.can_edit"><lmsg src="projects.task.delete">[Delete]</lmsg></button>
				<button class="btn btn-link" ng-click="edit.cancelTaskEdit($event, task)" lmsg="projects.task.cancel">[Cancel]</button>
			</div>
		</div>
	</div>
</div>
