| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-19 20:03:27 +01:00
										 |  |  | @section('title', $__t('Edit stock entry')) | 
					
						
							| 
									
										
										
										
											2020-01-27 19:19:09 +01:00
										 |  |  | @section('viewJsName', 'stockentryform') | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | @section('content') | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | <script> | 
					
						
							|  |  |  | 	Grocy.EditObjectId = {{ $stockEntry->id }}; | 
					
						
							|  |  |  | 	Grocy.EditObjectProductId = {{ $stockEntry->product_id }}; | 
					
						
							|  |  |  | </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-12-19 12:48:36 -06:00
										 |  |  | <div class="row"> | 
					
						
							| 
									
										
										
										
											2021-06-24 22:46:47 +02:00
										 |  |  | 	<div class="col-12 col-md-6 col-xl-4 pb-3"> | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<form id="stockentry-form" | 
					
						
							|  |  |  | 			novalidate> | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | 			@php | 
					
						
							|  |  |  | 			$product = FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id); | 
					
						
							|  |  |  | 			@endphp | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			@php | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			$additionalGroupCssClasses = ''; | 
					
						
							|  |  |  | 			if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 			$additionalGroupCssClasses = 'd-none'; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			@endphp | 
					
						
							|  |  |  | 			@include('components.datetimepicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'best_before_date', | 
					
						
							|  |  |  | 			'initialValue' => $stockEntry->best_before_date, | 
					
						
							| 
									
										
										
										
											2020-11-15 19:53:44 +01:00
										 |  |  | 			'label' => 'Due date', | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'format' => 'YYYY-MM-DD', | 
					
						
							|  |  |  | 			'initWithNow' => false, | 
					
						
							|  |  |  | 			'limitEndToNow' => false, | 
					
						
							|  |  |  | 			'limitStartToNow' => false, | 
					
						
							| 
									
										
										
										
											2020-11-15 19:53:44 +01:00
										 |  |  | 			'invalidFeedback' => $__t('A due date is required'), | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'nextInputSelector' => '#best_before_date', | 
					
						
							|  |  |  | 			'additionalGroupCssClasses' => 'date-only-datetimepicker', | 
					
						
							|  |  |  | 			'shortcutValue' => '2999-12-31', | 
					
						
							| 
									
										
										
										
											2020-11-15 19:53:44 +01:00
										 |  |  | 			'shortcutLabel' => 'Never overdue', | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'earlierThanInfoLimit' => date('Y-m-d'), | 
					
						
							|  |  |  | 			'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'), | 
					
						
							|  |  |  | 			'additionalGroupCssClasses' => $additionalGroupCssClasses, | 
					
						
							|  |  |  | 			'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 			@php $additionalGroupCssClasses = ''; @endphp | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | 			@include('components.numberpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'amount', | 
					
						
							|  |  |  | 			'value' => $stockEntry->amount, | 
					
						
							| 
									
										
										
										
											2020-12-23 19:56:37 +01:00
										 |  |  | 			'min' => $DEFAULT_MIN_AMOUNT, | 
					
						
							| 
									
										
										
										
											2020-11-16 19:10:29 +01:00
										 |  |  | 			'decimals' => $userSettings['stock_decimal_places_amounts'], | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'label' => 'Amount', | 
					
						
							| 
									
										
										
										
											2020-11-12 21:35:10 +01:00
										 |  |  | 			'contextInfoId' => 'amount_qu_unit', | 
					
						
							| 
									
										
										
										
											2020-11-15 14:15:09 +01:00
										 |  |  | 			'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) | 
					
						
							| 
									
										
										
										
											2020-08-24 17:42:41 +02:00
										 |  |  | 			@php | 
					
						
							|  |  |  | 			if (empty($stockEntry->price)) | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			$price = ''; | 
					
						
							| 
									
										
										
										
											2020-08-24 17:42:41 +02:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			$price = $stockEntry->price; | 
					
						
							| 
									
										
										
										
											2020-08-24 17:42:41 +02:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			@endphp | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			@include('components.numberpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'price', | 
					
						
							|  |  |  | 			'value' => $price, | 
					
						
							|  |  |  | 			'label' => 'Price', | 
					
						
							| 
									
										
										
										
											2020-12-23 19:56:37 +01:00
										 |  |  | 			'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices']), | 
					
						
							| 
									
										
										
										
											2020-10-20 13:08:54 -05:00
										 |  |  | 			'decimals' => $userSettings['stock_decimal_places_prices'], | 
					
						
							| 
									
										
										
										
											2020-11-12 21:35:10 +01:00
										 |  |  | 			'hint' => $__t('Per stock quantity unit'), | 
					
						
							| 
									
										
										
										
											2020-11-15 14:15:09 +01:00
										 |  |  | 			'isRequired' => false, | 
					
						
							|  |  |  | 			'additionalCssClasses' => 'locale-number-input locale-number-currency' | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2020-03-25 19:34:56 +01:00
										 |  |  | 			@include('components.shoppinglocationpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'label' => 'Store', | 
					
						
							|  |  |  | 			'shoppinglocations' => $shoppinglocations, | 
					
						
							|  |  |  | 			'prefillById' => $stockEntry->shopping_location_id | 
					
						
							| 
									
										
										
										
											2020-03-25 19:34:56 +01:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			@else | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<input type="hidden" | 
					
						
							|  |  |  | 				name="price" | 
					
						
							|  |  |  | 				id="price" | 
					
						
							|  |  |  | 				value="0"> | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 			@endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) | 
					
						
							|  |  |  | 			@include('components.locationpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'locations' => $locations, | 
					
						
							|  |  |  | 			'prefillById' => $stockEntry->location_id | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 			@else | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<input type="hidden" | 
					
						
							|  |  |  | 				name="location_id" | 
					
						
							|  |  |  | 				id="location_id" | 
					
						
							|  |  |  | 				value="1"> | 
					
						
							| 
									
										
										
										
											2020-01-27 19:00:49 +01:00
										 |  |  | 			@endif | 
					
						
							| 
									
										
										
										
											2020-08-29 16:41:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-23 18:58:05 +01:00
										 |  |  | 			@include('components.datetimepicker2', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'purchase_date', | 
					
						
							|  |  |  | 			'initialValue' => $stockEntry->purchased_date, | 
					
						
							|  |  |  | 			'label' => 'Purchased date', | 
					
						
							|  |  |  | 			'format' => 'YYYY-MM-DD', | 
					
						
							|  |  |  | 			'initWithNow' => false, | 
					
						
							|  |  |  | 			'limitEndToNow' => false, | 
					
						
							|  |  |  | 			'limitStartToNow' => false, | 
					
						
							|  |  |  | 			'invalidFeedback' => $__t('A purchased date is required'), | 
					
						
							|  |  |  | 			'nextInputSelector' => '#save-stockentry-button', | 
					
						
							|  |  |  | 			'additionalGroupCssClasses' => 'date-only-datetimepicker' | 
					
						
							| 
									
										
										
										
											2020-01-23 18:58:05 +01:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2020-01-21 17:30:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-10 18:11:33 +01:00
										 |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<div class="custom-control custom-checkbox"> | 
					
						
							|  |  |  | 					<input @if($stockEntry->open == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="open" name="open" value="1"> | 
					
						
							|  |  |  | 					<label class="form-check-label custom-control-label" | 
					
						
							|  |  |  | 						for="open">{{ $__t('Opened') }}</label> | 
					
						
							|  |  |  | 				</div> | 
					
						
							| 
									
										
										
										
											2020-01-21 17:30:09 +01:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-30 17:32:53 +02:00
										 |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<label for="note">{{ $__t('Note') }}</label> | 
					
						
							|  |  |  | 				<div class="input-group"> | 
					
						
							|  |  |  | 					<input type="text" | 
					
						
							|  |  |  | 						class="form-control" | 
					
						
							|  |  |  | 						id="note" | 
					
						
							|  |  |  | 						name="note" | 
					
						
							|  |  |  | 						value="{{ $stockEntry->note }}"> | 
					
						
							|  |  |  | 				</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<button id="save-stockentry-button" | 
					
						
							|  |  |  | 				class="btn btn-success">{{ $__t('OK') }}</button> | 
					
						
							| 
									
										
										
										
											2019-12-19 12:48:36 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | @stop |