| 
									
										
										
										
											2018-04-11 19:49:35 +02:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-12 21:13:38 +02:00
										 |  |  | @if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 	@section('title', $__t('Edit chore')) | 
					
						
							| 
									
										
										
										
											2018-04-12 21:13:38 +02:00
										 |  |  | @else | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 	@section('title', $__t('Create chore')) | 
					
						
							| 
									
										
										
										
											2018-04-12 21:13:38 +02:00
										 |  |  | @endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | @section('viewJsName', 'choreform') | 
					
						
							| 
									
										
										
										
											2018-04-12 21:13:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-11 19:49:35 +02:00
										 |  |  | @section('content') | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col-lg-6 col-xs-12"> | 
					
						
							|  |  |  | 		<h1>@yield('title')</h1> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<script>Grocy.EditMode = '{{ $mode }}';</script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		@if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 			<script>Grocy.EditObjectId = {{ $chore->id }};</script> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 		@endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 		<form id="chore-form" novalidate> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<label for="name">{{ $__t('Name') }}</label> | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 				<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $chore->name }}@endif"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<div class="invalid-feedback">{{ $__t('A name is required') }}</div> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<label for="description">{{ $__t('Description') }}</label> | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 				<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $chore->description }}@endif</textarea> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-09-17 13:13:26 +02:00
										 |  |  | 				<label for="period_type">{{ $__t('Period type') }} <span id="chore-period-type-info" class="small text-muted"></span></label> | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 				<select required class="form-control input-group-chore-period-type" id="period_type" name="period_type"> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 					@foreach($periodTypes as $periodType) | 
					
						
							| 
									
										
										
										
											2019-05-02 20:20:18 +02:00
										 |  |  | 						<option @if($mode == 'edit' && $periodType == $chore->period_type) selected="selected" @endif value="{{ $periodType }}">{{ $__t($periodType) }}</option> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<div class="invalid-feedback">{{ $__t('A period type is required') }}</div> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 			@php if($mode == 'edit') { $value = $chore->period_days; } else { $value = 0; } @endphp | 
					
						
							| 
									
										
										
										
											2018-09-08 12:04:31 +02:00
										 |  |  | 			@include('components.numberpicker', array( | 
					
						
							|  |  |  | 				'id' => 'period_days', | 
					
						
							|  |  |  | 				'label' => 'Period days', | 
					
						
							|  |  |  | 				'value' => $value, | 
					
						
							|  |  |  | 				'min' => '0', | 
					
						
							| 
									
										
										
										
											2018-09-22 13:26:58 +02:00
										 |  |  | 				'additionalCssClasses' => 'input-group-chore-period-type', | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				'invalidFeedback' => $__t('This cannot be negative'), | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				'additionalGroupCssClasses' => 'period-type-input period-type-dynamic-regular period-type-monthly' | 
					
						
							| 
									
										
										
										
											2018-09-08 12:04:31 +02:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 			<div class="form-group period-type-input period-type-weekly"> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="monday" value="monday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="monday">{{ $__t('Monday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="tuesday" value="tuesday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="tuesday">{{ $__t('Tuesday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="wednesday" value="wednesday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="wednesday">{{ $__t('Wednesday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="thursday" value="thursday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="thursday">{{ $__t('Thursday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="friday" value="friday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="friday">{{ $__t('Friday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="saturday" value="saturday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="saturday">{{ $__t('Saturday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 				<div class="form-check form-check-inline"> | 
					
						
							|  |  |  | 					<input class="form-check-input input-group-chore-period-type" type="checkbox" id="sunday" value="sunday"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 					<label class="form-check-label" for="sunday">{{ $__t('Sunday') }}</label> | 
					
						
							| 
									
										
										
										
											2019-04-22 14:01:31 +02:00
										 |  |  | 				</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<input type="hidden" id="period_config" name="period_config" value="@if($mode == 'edit'){{ $chore->period_config }}@endif"> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-17 13:13:26 +02:00
										 |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<label for="assignment_type">{{ $__t('Assignment type') }} <span id="chore-assignment-type-info" class="small text-muted"></span></label> | 
					
						
							|  |  |  | 				<select required class="form-control input-group-chore-assignment-type" id="assignment_type" name="assignment_type"> | 
					
						
							|  |  |  | 					@foreach($assignmentTypes as $assignmentType) | 
					
						
							|  |  |  | 						<option @if($mode == 'edit' && $assignmentType == $chore->assignment_type) selected="selected" @endif value="{{ $assignmentType }}">{{ $__t($assignmentType) }}</option> | 
					
						
							|  |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 				<div class="invalid-feedback">{{ $__t('An assignment type is required') }}</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<label for="assignment_config">{{ $__t('Assign to') }}</label> | 
					
						
							|  |  |  | 				<select required multiple class="form-control input-group-chore-assignment-type selectpicker" id="assignment_config" name="assignment_config" data-actions-Box="true" data-live-search="true"> | 
					
						
							|  |  |  | 					@foreach($users as $user) | 
					
						
							|  |  |  | 						<option @if($mode == 'edit' && in_array($user->id, explode(',', $chore->assignment_config))) selected="selected" @endif value="{{ $user->id }}">{{ $user->display_name }}</option> | 
					
						
							|  |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 				<div class="invalid-feedback">{{ $__t('This assignment type requires that at least one is assigned') }}</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-04 16:13:05 +02:00
										 |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<div class="form-check"> | 
					
						
							|  |  |  | 					<input type="hidden" name="track_date_only" value="0"> | 
					
						
							|  |  |  | 					<input @if($mode == 'edit' && $chore->track_date_only == 1) checked @endif class="form-check-input" type="checkbox" id="track_date_only" name="track_date_only" value="1"> | 
					
						
							|  |  |  | 					<label class="form-check-label" for="track_date_only">{{ $__t('Track date only') }} | 
					
						
							|  |  |  | 						<span class="text-muted small">{{ $__t('When enabled only the day of an execution is tracked, not the time') }}</span> | 
					
						
							|  |  |  | 					</label> | 
					
						
							|  |  |  | 				</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-10 12:44:09 +02:00
										 |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<div class="form-check"> | 
					
						
							|  |  |  | 					<input type="hidden" name="rollover" value="0"> | 
					
						
							|  |  |  | 					<input @if($mode == 'edit' && $chore->rollover == 1) checked @endif class="form-check-input" type="checkbox" id="rollover" name="rollover" value="1"> | 
					
						
							|  |  |  | 					<label class="form-check-label" for="rollover">{{ $__t('Due date rollover') }} | 
					
						
							|  |  |  | 						<span class="text-muted small">{{ $__t('When enabled the chore can never be overdue, the due date will shift forward each day when due') }}</span> | 
					
						
							|  |  |  | 					</label> | 
					
						
							|  |  |  | 				</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-18 10:02:52 +02:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_STOCK) | 
					
						
							|  |  |  | 			<div class="form-group mt-4 mb-1"> | 
					
						
							|  |  |  | 				<div class="form-check"> | 
					
						
							|  |  |  | 					<input type="hidden" name="consume_product_on_execution" value="0"> | 
					
						
							|  |  |  | 					<input @if($mode == 'edit' && $chore->consume_product_on_execution == 1) checked @endif class="form-check-input" type="checkbox" id="consume_product_on_execution" name="consume_product_on_execution" value="1"> | 
					
						
							|  |  |  | 					<label class="form-check-label" for="consume_product_on_execution">{{ $__t('Consume product on chore execution') }}</label> | 
					
						
							|  |  |  | 				</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			@php $prefillById = ''; if($mode=='edit' && !empty($chore->product_id)) { $prefillById = $chore->product_id; } @endphp | 
					
						
							|  |  |  | 			@include('components.productpicker', array( | 
					
						
							|  |  |  | 				'products' => $products, | 
					
						
							|  |  |  | 				'nextInputSelector' => '#product_amount', | 
					
						
							|  |  |  | 				'isRequired' => false, | 
					
						
							|  |  |  | 				'disallowAllProductWorkflows' => true, | 
					
						
							|  |  |  | 				'prefillById' => $prefillById | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			@php if($mode == 'edit') { $value = $chore->product_amount; } else { $value = ''; } @endphp | 
					
						
							|  |  |  | 			@include('components.numberpicker', array( | 
					
						
							|  |  |  | 				'id' => 'product_amount', | 
					
						
							|  |  |  | 				'label' => 'Amount', | 
					
						
							|  |  |  | 				'hintId' => 'amount_qu_unit', | 
					
						
							|  |  |  | 				'min' => 0.0001, | 
					
						
							|  |  |  | 				'step' => 0.0001, | 
					
						
							|  |  |  | 				'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), | 
					
						
							|  |  |  | 				'isRequired' => false, | 
					
						
							|  |  |  | 				'value' => $value | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 			@endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 22:16:35 +02:00
										 |  |  | 			@include('components.userfieldsform', array( | 
					
						
							|  |  |  | 				'userfields' => $userfields, | 
					
						
							|  |  |  | 				'entity' => 'chores' | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 			<button id="save-chore-button" class="btn btn-success">{{ $__t('Save') }}</button> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							| 
									
										
										
										
											2017-07-25 20:03:31 +02:00
										 |  |  | </div> | 
					
						
							| 
									
										
										
										
											2018-04-11 19:49:35 +02:00
										 |  |  | @stop |