| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 	@section('title', $__t('Edit task')) | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | @else | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 	@section('title', $__t('Create task')) | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | @endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('viewJsName', 'taskform') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('content') | 
					
						
							|  |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col-lg-6 col-xs-12"> | 
					
						
							|  |  |  | 		<h1>@yield('title')</h1> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<script>Grocy.EditMode = '{{ $mode }}';</script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		@if($mode == 'edit') | 
					
						
							|  |  |  | 			<script>Grocy.EditObjectId = {{ $task->id }};</script> | 
					
						
							|  |  |  | 		@endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<form id="task-form" novalidate> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<label for="name">{{ $__t('Name') }}</label> | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 				<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $task->name }}@endif"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<div class="invalid-feedback">{{ $__t('A name is required') }}</div> | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<label for="description">{{ $__t('Description') }}</label> | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 				<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $task->description }}@endif</textarea> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-23 09:22:54 +02:00
										 |  |  | 			@php | 
					
						
							|  |  |  | 			$initialDueDate = null; | 
					
						
							|  |  |  | 			if ($mode == 'edit') | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				$initialDueDate = date('Y-m-d', strtotime($task->due_date)); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			@endphp | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 			@include('components.datetimepicker', array( | 
					
						
							| 
									
										
										
										
											2018-09-23 09:22:54 +02:00
										 |  |  | 				'id' => 'due_date', | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 				'label' => 'Due', | 
					
						
							|  |  |  | 				'format' => 'YYYY-MM-DD', | 
					
						
							|  |  |  | 				'initWithNow' => false, | 
					
						
							| 
									
										
										
										
											2018-09-23 09:22:54 +02:00
										 |  |  | 				'initialValue' => $initialDueDate, | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 				'limitEndToNow' => false, | 
					
						
							|  |  |  | 				'limitStartToNow' => false, | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				'invalidFeedback' => $__t('A due date is required'), | 
					
						
							| 
									
										
										
										
											2018-09-23 19:26:13 +02:00
										 |  |  | 				'nextInputSelector' => 'category_id', | 
					
						
							| 
									
										
										
										
											2019-04-23 09:06:18 +02:00
										 |  |  | 				'additionalGroupCssClasses' => 'date-only-datetimepicker', | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 				'isRequired' => false | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<label for="category_id">{{ $__t('Category') }}</label> | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 				<select class="form-control" id="category_id" name="category_id"> | 
					
						
							|  |  |  | 					<option></option> | 
					
						
							|  |  |  | 					@foreach($taskCategories as $taskCategory) | 
					
						
							|  |  |  | 						<option @if($mode == 'edit' && $taskCategory->id == $task->category_id) selected="selected" @endif value="{{ $taskCategory->id }}">{{ $taskCategory->name }}</option> | 
					
						
							|  |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-23 19:26:13 +02:00
										 |  |  | 			@php | 
					
						
							|  |  |  | 			$initUserId = GROCY_USER_ID; | 
					
						
							|  |  |  | 			if ($mode == 'edit') | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				$initUserId = $task->assigned_to_user_id; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			@endphp | 
					
						
							|  |  |  | 			@include('components.userpicker', array( | 
					
						
							|  |  |  | 				'label' => 'Assigned to', | 
					
						
							|  |  |  | 				'users' => $users, | 
					
						
							|  |  |  | 				'prefillByUserId' => $initUserId | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-23 09:06:18 +02:00
										 |  |  | 			@include('components.userfieldsform', array( | 
					
						
							|  |  |  | 				'userfields' => $userfields, | 
					
						
							|  |  |  | 				'entity' => 'tasks' | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 			<button id="save-task-button" class="btn btn-success">{{ $__t('Save') }}</button> | 
					
						
							| 
									
										
										
										
											2018-09-22 22:01:32 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | @stop |