| 
									
										
										
										
											2018-04-11 19:49:35 +02:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-01 20:19:18 +02:00
										 |  |  | @section('title', $__t('Purchase')) | 
					
						
							| 
									
										
										
										
											2018-04-12 21:13:38 +02:00
										 |  |  | @section('activeNav', 'purchase') | 
					
						
							|  |  |  | @section('viewJsName', 'purchase') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-26 15:35:01 +01:00
										 |  |  | @push('pageScripts') | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | <script src="{{ $U('/js/grocy_uisound.js?v=', true) }}{{ $version }}"></script> | 
					
						
							| 
									
										
										
										
											2020-01-26 15:35:01 +01:00
										 |  |  | @endpush | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-11 19:49:35 +02:00
										 |  |  | @section('content') | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | <div class="row"> | 
					
						
							| 
									
										
										
										
											2018-07-12 19:12:31 +02:00
										 |  |  | 	<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> | 
					
						
							| 
									
										
										
										
											2020-04-19 08:51:02 -04:00
										 |  |  | 		<div class="title-related-links"> | 
					
						
							|  |  |  | 			<h2 class="title">@yield('title')</h2> | 
					
						
							|  |  |  | 			<div class="related-links"> | 
					
						
							|  |  |  | 				@if(!$embedded) | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 				<button id="scan-mode-button" | 
					
						
							|  |  |  | 					class="btn @if(boolval($userSettings['scan_mode_purchase_enabled'])) btn-success @else btn-danger @endif" | 
					
						
							|  |  |  | 					type="checkbox">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button> | 
					
						
							|  |  |  | 				<input id="scan-mode" | 
					
						
							|  |  |  | 					type="checkbox" | 
					
						
							|  |  |  | 					class="d-none user-setting-control" | 
					
						
							|  |  |  | 					data-setting-key="scan_mode_purchase_enabled" | 
					
						
							|  |  |  | 					@if(boolval($userSettings['scan_mode_purchase_enabled'])) | 
					
						
							|  |  |  | 					checked | 
					
						
							|  |  |  | 					@endif> | 
					
						
							| 
									
										
										
										
											2020-04-19 08:51:02 -04:00
										 |  |  | 				@else | 
					
						
							|  |  |  | 				<script> | 
					
						
							|  |  |  | 					Grocy.UserSettings.scan_mode_purchase_enabled = false; | 
					
						
							|  |  |  | 				</script> | 
					
						
							|  |  |  | 				@endif | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 		<hr> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<form id="purchase-form" | 
					
						
							|  |  |  | 			novalidate> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 14:43:57 +02:00
										 |  |  | 			@include('components.productpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'products' => $products, | 
					
						
							|  |  |  | 			'barcodes' => $barcodes, | 
					
						
							|  |  |  | 			'nextInputSelector' => '#amount' | 
					
						
							| 
									
										
										
										
											2018-07-14 14:43:57 +02:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-22 10:38:24 -05:00
										 |  |  | 			@include('components.numberpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'amount', | 
					
						
							|  |  |  | 			'label' => 'Amount', | 
					
						
							|  |  |  | 			'hintId' => 'amount_qu_unit', | 
					
						
							| 
									
										
										
										
											2020-10-20 13:08:54 -05:00
										 |  |  | 			'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', | 
					
						
							|  |  |  | 			'decimals' => $userSettings['stock_decimal_places_amounts'], | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), | 
					
						
							|  |  |  | 			'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" | 
					
						
							|  |  |  | 				class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>' | 
					
						
							| 
									
										
										
										
											2020-04-22 10:38:24 -05:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2020-03-25 19:34:56 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-17 11:03:47 +02:00
										 |  |  | 			@if(boolval($userSettings['show_purchased_date_on_purchase'])) | 
					
						
							| 
									
										
										
										
											2020-10-17 03:54:10 -05:00
										 |  |  | 			@include('components.datetimepicker2', array( | 
					
						
							|  |  |  | 			'id' => 'purchased_date', | 
					
						
							|  |  |  | 			'label' => 'Purchased date', | 
					
						
							|  |  |  | 			'format' => 'YYYY-MM-DD', | 
					
						
							|  |  |  | 			'initWithNow' => true, | 
					
						
							|  |  |  | 			'limitEndToNow' => false, | 
					
						
							|  |  |  | 			'limitStartToNow' => false, | 
					
						
							| 
									
										
										
										
											2020-10-17 11:03:47 +02:00
										 |  |  | 			'invalidFeedback' => $__t('A purchased date is required'), | 
					
						
							| 
									
										
										
										
											2020-10-17 03:54:10 -05:00
										 |  |  | 			'nextInputSelector' => '#best_before_date', | 
					
						
							|  |  |  | 			'additionalCssClasses' => 'date-only-datetimepicker2', | 
					
						
							|  |  |  | 			'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD | 
					
						
							|  |  |  | 			)) | 
					
						
							|  |  |  | 			@endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-14 11:15:11 +02:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) | 
					
						
							| 
									
										
										
										
											2018-07-12 19:12:31 +02:00
										 |  |  | 			@include('components.datetimepicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'best_before_date', | 
					
						
							|  |  |  | 			'label' => 'Best before', | 
					
						
							|  |  |  | 			'format' => 'YYYY-MM-DD', | 
					
						
							|  |  |  | 			'initWithNow' => false, | 
					
						
							|  |  |  | 			'limitEndToNow' => false, | 
					
						
							|  |  |  | 			'limitStartToNow' => false, | 
					
						
							|  |  |  | 			'invalidFeedback' => $__t('A best before date is required'), | 
					
						
							|  |  |  | 			'nextInputSelector' => '#price', | 
					
						
							|  |  |  | 			'additionalCssClasses' => 'date-only-datetimepicker', | 
					
						
							|  |  |  | 			'shortcutValue' => '2999-12-31', | 
					
						
							|  |  |  | 			'shortcutLabel' => 'Never expires', | 
					
						
							|  |  |  | 			'earlierThanInfoLimit' => date('Y-m-d'), | 
					
						
							|  |  |  | 			'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'), | 
					
						
							|  |  |  | 			'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2020-09-14 11:15:11 +02:00
										 |  |  | 			@endif | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-19 17:46:52 +02:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) | 
					
						
							| 
									
										
										
										
											2018-09-08 12:04:31 +02:00
										 |  |  | 			@include('components.numberpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'price', | 
					
						
							|  |  |  | 			'label' => 'Price', | 
					
						
							| 
									
										
										
										
											2020-10-20 13:08:54 -05:00
										 |  |  | 			'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices'] - 1) . '1', | 
					
						
							|  |  |  | 			'decimals' => $userSettings['stock_decimal_places_prices'], | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'value' => '', | 
					
						
							|  |  |  | 			'hintId' => 'price-hint', | 
					
						
							|  |  |  | 			'invalidFeedback' => $__t('The price cannot be lower than %s', '0'), | 
					
						
							|  |  |  | 			'isRequired' => false, | 
					
						
							|  |  |  | 			'additionalGroupCssClasses' => 'mb-1' | 
					
						
							| 
									
										
										
										
											2018-09-08 12:04:31 +02:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2020-10-20 13:08:54 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-27 13:50:16 +02:00
										 |  |  | 			<div class="form-check form-check-inline mb-3"> | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 				<input class="form-check-input" | 
					
						
							|  |  |  | 					type="radio" | 
					
						
							|  |  |  | 					name="price-type" | 
					
						
							|  |  |  | 					id="price-type-unit-price" | 
					
						
							|  |  |  | 					value="unit-price" | 
					
						
							|  |  |  | 					checked> | 
					
						
							|  |  |  | 				<label class="form-check-label" | 
					
						
							|  |  |  | 					for="price-type-unit-price">{{ $__t('Price') }}</label> | 
					
						
							| 
									
										
										
										
											2019-09-27 13:50:16 +02:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 			<div class="form-check form-check-inline mb-3"> | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 				<input class="form-check-input" | 
					
						
							|  |  |  | 					type="radio" | 
					
						
							|  |  |  | 					name="price-type" | 
					
						
							|  |  |  | 					id="price-type-total-price" | 
					
						
							|  |  |  | 					value="total-price"> | 
					
						
							|  |  |  | 				<label class="form-check-label" | 
					
						
							|  |  |  | 					for="price-type-total-price">{{ $__t('Total price') }}</label> | 
					
						
							| 
									
										
										
										
											2019-09-27 13:50:16 +02:00
										 |  |  | 			</div> | 
					
						
							| 
									
										
										
										
											2020-03-25 19:34:56 +01:00
										 |  |  | 			@include('components.shoppinglocationpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'label' => 'Store', | 
					
						
							|  |  |  | 			'shoppinglocations' => $shoppinglocations | 
					
						
							| 
									
										
										
										
											2020-03-25 19:34:56 +01:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2019-09-19 17:46:52 +02:00
										 |  |  | 			@else | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<input type="hidden" | 
					
						
							|  |  |  | 				name="price" | 
					
						
							|  |  |  | 				id="price" | 
					
						
							|  |  |  | 				value="0"> | 
					
						
							| 
									
										
										
										
											2019-09-19 17:46:52 +02:00
										 |  |  | 			@endif | 
					
						
							| 
									
										
										
										
											2018-07-26 20:27:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-17 14:47:33 -05:00
										 |  |  | 			@include('components.numberpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'qu_factor_purchase_to_stock', | 
					
						
							|  |  |  | 			'label' => 'Factor purchase to stock quantity unit', | 
					
						
							| 
									
										
										
										
											2020-10-20 13:08:54 -05:00
										 |  |  | 			'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', | 
					
						
							|  |  |  | 			'decimals' => $userSettings['stock_decimal_places_amounts'], | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'additionalGroupCssClasses' => 'd-none', | 
					
						
							|  |  |  | 			'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), | 
					
						
							|  |  |  | 			'additionalCssClasses' => 'input-group-qu', | 
					
						
							|  |  |  | 			'additionalHtmlElements' => '<p id="qu-conversion-info" | 
					
						
							|  |  |  | 				class="form-text text-muted small d-none"></p>' | 
					
						
							| 
									
										
										
										
											2020-08-17 14:47:33 -05:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-19 17:46:52 +02:00
										 |  |  | 			@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) | 
					
						
							| 
									
										
										
										
											2019-03-04 17:43:12 +01:00
										 |  |  | 			@include('components.locationpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'locations' => $locations, | 
					
						
							|  |  |  | 			'isRequired' => false | 
					
						
							| 
									
										
										
										
											2019-03-04 17:43:12 +01:00
										 |  |  | 			)) | 
					
						
							| 
									
										
										
										
											2019-09-19 17:46:52 +02:00
										 |  |  | 			@endif | 
					
						
							| 
									
										
										
										
											2019-03-01 20:25:01 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<button id="save-purchase-button" | 
					
						
							|  |  |  | 				class="btn btn-success d-block">{{ $__t('OK') }}</button> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-17 12:57:35 +01:00
										 |  |  | 	<div class="col-xs-12 col-md-6 col-xl-4 hide-when-embedded"> | 
					
						
							| 
									
										
										
										
											2018-07-10 20:37:13 +02:00
										 |  |  | 		@include('components.productcard') | 
					
						
							|  |  |  | 	</div> | 
					
						
							| 
									
										
										
										
											2017-04-19 21:09:28 +02:00
										 |  |  | </div> | 
					
						
							| 
									
										
										
										
											2018-04-11 19:49:35 +02:00
										 |  |  | @stop |