| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 	@section('title', $__t('Edit shopping list item')) | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | @else | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 	@section('title', $__t('Create shopping list item')) | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | @endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('viewJsName', 'shoppinglistitemform') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('content') | 
					
						
							| 
									
										
										
										
											2020-04-19 08:51:02 -04:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col"> | 
					
						
							|  |  |  | 		<h2 class="title">@yield('title')</h2> | 
					
						
							|  |  |  | 		<hr> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> | 
					
						
							|  |  |  | 		<script>Grocy.EditMode = '{{ $mode }}';</script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		@if($mode == 'edit') | 
					
						
							|  |  |  | 			<script>Grocy.EditObjectId = {{ $listItem->id }};</script> | 
					
						
							|  |  |  | 		@endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<form id="shoppinglist-form" novalidate> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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> | 
					
						
							| 
									
										
										
										
											2019-07-06 17:31:17 +02:00
										 |  |  | 				<select class="form-control" id="shopping_list_id" name="shopping_list_id"> | 
					
						
							|  |  |  | 					@foreach($shoppingLists as $shoppingList) | 
					
						
							|  |  |  | 						<option @if($mode == 'edit' && $shoppingList->id == $listItem->shopping_list_id) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option> | 
					
						
							|  |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 			</div> | 
					
						
							| 
									
										
										
										
											2019-10-05 13:10:56 +02:00
										 |  |  | 			@else | 
					
						
							|  |  |  | 			<input type="hidden" id="shopping_list_id" name="shopping_list_id" value="1"> | 
					
						
							|  |  |  | 			@endif | 
					
						
							| 
									
										
										
										
											2019-07-06 17:31:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 			@php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp | 
					
						
							|  |  |  | 			@include('components.productpicker', array( | 
					
						
							|  |  |  | 				'products' => $products, | 
					
						
							|  |  |  | 				'nextInputSelector' => '#amount', | 
					
						
							|  |  |  | 				'isRequired' => false, | 
					
						
							|  |  |  | 				'prefillById' => $productId | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			@php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp | 
					
						
							|  |  |  | 			@include('components.numberpicker', array( | 
					
						
							|  |  |  | 				'id' => 'amount', | 
					
						
							|  |  |  | 				'label' => 'Amount', | 
					
						
							|  |  |  | 				'hintId' => 'amount_qu_unit', | 
					
						
							| 
									
										
										
										
											2020-08-24 20:25:50 +02:00
										 |  |  | 				'min' => 0.01, | 
					
						
							|  |  |  | 				'step' => 0.01, | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 				'value' => $value, | 
					
						
							| 
									
										
										
										
											2020-08-24 20:25:50 +02:00
										 |  |  | 				'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01') | 
					
						
							| 
									
										
										
										
											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> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 				<textarea class="form-control" rows="2" id="note" name="note">@if($mode == 'edit'){{ $listItem->note }}@endif</textarea> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | 			<button id="save-shoppinglist-button" class="btn btn-success">{{ $__t('Save') }}</button> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-20 13:37:53 +02:00
										 |  |  | 	<div class="col-xs-12 col-md-6 col-xl-4 hide-when-embedded"> | 
					
						
							| 
									
										
										
										
											2019-04-20 17:04:40 +02:00
										 |  |  | 		@include('components.productcard') | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | @stop |