| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | @section('title', $__t('Edit shopping list item')) | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | @else | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | @section('title', $__t('Create shopping list item')) | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | @endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('viewJsName', 'shoppinglistitemform') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('content') | 
					
						
							| 
									
										
										
										
											2020-11-09 22:15:25 +01:00
										 |  |  | <script> | 
					
						
							|  |  |  | 	Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!}; | 
					
						
							|  |  |  | 	Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!}; | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-19 08:51:02 -04:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col"> | 
					
						
							|  |  |  | 		<h2 class="title">@yield('title')</h2> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							| 
									
										
										
										
											2020-10-31 18:37:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-08 15:09:10 +01:00
										 |  |  | <hr class="my-2"> | 
					
						
							| 
									
										
										
										
											2020-10-31 18:37:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<script> | 
					
						
							|  |  |  | 			Grocy.EditMode = '{{ $mode }}'; | 
					
						
							|  |  |  | 		</script> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		@if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<script> | 
					
						
							|  |  |  | 			Grocy.EditObjectId = {{ $listItem->id }}; | 
					
						
							|  |  |  | 		</script> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 		@endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<form id="shoppinglist-form" | 
					
						
							|  |  |  | 			novalidate> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-05 13:10:56 +02:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS) | 
					
						
							| 
									
										
										
										
											2019-07-06 17:31:17 +02:00
										 |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-09-24 18:27:50 +02:00
										 |  |  | 				<label for="shopping_list_id">{{ $__t('Shopping list') }}</label> | 
					
						
							| 
									
										
										
										
											2020-11-16 19:10:29 +01:00
										 |  |  | 				<select class="custom-control custom-select" | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					id="shopping_list_id" | 
					
						
							|  |  |  | 					name="shopping_list_id"> | 
					
						
							| 
									
										
										
										
											2019-07-06 17:31:17 +02:00
										 |  |  | 					@foreach($shoppingLists as $shoppingList) | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					<option @if($mode=='edit' | 
					
						
							|  |  |  | 						&& | 
					
						
							|  |  |  | 						$shoppingList->id == $listItem->shopping_list_id) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option> | 
					
						
							| 
									
										
										
										
											2019-07-06 17:31:17 +02:00
										 |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 			</div> | 
					
						
							| 
									
										
										
										
											2019-10-05 13:10:56 +02:00
										 |  |  | 			@else | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<input type="hidden" | 
					
						
							|  |  |  | 				id="shopping_list_id" | 
					
						
							|  |  |  | 				name="shopping_list_id" | 
					
						
							|  |  |  | 				value="1"> | 
					
						
							| 
									
										
										
										
											2019-10-05 13:10:56 +02:00
										 |  |  | 			@endif | 
					
						
							| 
									
										
										
										
											2019-07-06 17:31:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-21 20:13:49 +01:00
										 |  |  | 			<div> | 
					
						
							| 
									
										
										
										
											2020-10-14 17:48:37 +02:00
										 |  |  | 				@php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp | 
					
						
							|  |  |  | 				@include('components.productpicker', array( | 
					
						
							|  |  |  | 				'products' => $products, | 
					
						
							|  |  |  | 				'nextInputSelector' => '#amount', | 
					
						
							| 
									
										
										
										
											2020-12-29 21:06:31 +01:00
										 |  |  | 				'isRequired' => true, | 
					
						
							|  |  |  | 				'prefillById' => $productId, | 
					
						
							|  |  |  | 				'validationMessage' => 'A product or a note is required' | 
					
						
							| 
									
										
										
										
											2020-10-14 17:48:37 +02:00
										 |  |  | 				)) | 
					
						
							|  |  |  | 			</div> | 
					
						
							| 
									
										
										
										
											2020-11-13 17:30:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 			@php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp | 
					
						
							| 
									
										
										
										
											2020-11-13 17:30:57 +01:00
										 |  |  | 			@php if($mode == 'edit') { $initialQuId = $listItem->qu_id; } else { $initialQuId = ''; } @endphp | 
					
						
							| 
									
										
										
										
											2020-11-09 22:15:25 +01:00
										 |  |  | 			@include('components.productamountpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'value' => $value, | 
					
						
							| 
									
										
										
										
											2020-11-13 17:30:57 +01:00
										 |  |  | 			'initialQuId' => $initialQuId, | 
					
						
							| 
									
										
										
										
											2020-12-23 19:56:37 +01:00
										 |  |  | 			'min' => $DEFAULT_MIN_AMOUNT, | 
					
						
							| 
									
										
										
										
											2020-11-13 17:30:57 +01:00
										 |  |  | 			'isRequired' => false | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 				<label for="note">{{ $__t('Note') }}</label> | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 				<textarea class="form-control" | 
					
						
							| 
									
										
										
										
											2020-12-29 21:06:31 +01:00
										 |  |  | 					required | 
					
						
							| 
									
										
										
										
											2020-12-27 09:38:31 +01:00
										 |  |  | 					rows="10" | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					id="note" | 
					
						
							|  |  |  | 					name="note">@if($mode == 'edit'){{ $listItem->note }}@endif</textarea> | 
					
						
							| 
									
										
										
										
											2020-12-29 21:06:31 +01:00
										 |  |  | 				<div class="invalid-feedback">{{ $__t('A product or a note is required') }}</div> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-17 19:11:02 +01:00
										 |  |  | 			@include('components.userfieldsform', array( | 
					
						
							|  |  |  | 			'userfields' => $userfields, | 
					
						
							|  |  |  | 			'entity' => 'shopping_list' | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<button id="save-shoppinglist-button" | 
					
						
							|  |  |  | 				class="btn btn-success">{{ $__t('Save') }}</button> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | @stop |