| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | @extends('layout.default') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | @section('title', $__t('Edit QU conversion')) | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | @else | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | @section('title', $__t('Create QU conversion')) | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | @endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('viewJsName', 'quantityunitconversionform') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @section('content') | 
					
						
							| 
									
										
										
										
											2020-04-19 08:51:02 -04:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col"> | 
					
						
							| 
									
										
										
										
											2020-11-08 19:00:12 +01:00
										 |  |  | 		<div class="title-related-links"> | 
					
						
							|  |  |  | 			<h2 class="title">@yield('title')</h2> | 
					
						
							|  |  |  | 			<h2> | 
					
						
							|  |  |  | 				@if($product != null) | 
					
						
							|  |  |  | 				<span class="text-muted small">{{ $__t('Override for product') }} <strong>{{ $product->name }}</strong></span> | 
					
						
							|  |  |  | 				@else | 
					
						
							|  |  |  | 				<span class="text-muted small">{{ $__t('Default for QU') }} <strong>{{ $defaultQuUnit->name }}</strong></span> | 
					
						
							|  |  |  | 				@endif | 
					
						
							|  |  |  | 			</h2> | 
					
						
							|  |  |  | 		</div> | 
					
						
							| 
									
										
										
										
											2020-04-19 08:51:02 -04:00
										 |  |  | 	</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-09-15 16:40:54 +02:00
										 |  |  | <div class="row"> | 
					
						
							|  |  |  | 	<div class="col-lg-6 col-xs-12"> | 
					
						
							| 
									
										
										
										
											2020-08-29 16:41:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<script> | 
					
						
							|  |  |  | 			Grocy.EditMode = '{{ $mode }}'; | 
					
						
							|  |  |  | 		</script> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		@if($mode == 'edit') | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<script> | 
					
						
							|  |  |  | 			Grocy.EditObjectId = {{ $quConversion->id }}; | 
					
						
							|  |  |  | 		</script> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 		@endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 		<form id="quconversion-form" | 
					
						
							|  |  |  | 			novalidate> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			@if($product != null) | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<input type="hidden" | 
					
						
							|  |  |  | 				name="product_id" | 
					
						
							|  |  |  | 				value="{{ $product->id }}"> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 			@endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<label for="from_qu_id">{{ $__t('Quantity unit from') }}</label> | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 				<select required | 
					
						
							| 
									
										
										
										
											2020-11-16 19:10:29 +01:00
										 |  |  | 					class="custom-control custom-select input-group-qu" | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					id="from_qu_id" | 
					
						
							|  |  |  | 					name="from_qu_id"> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 					<option></option> | 
					
						
							|  |  |  | 					@foreach($quantityunits as $quantityunit) | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					<option @if(($product | 
					
						
							|  |  |  | 						!=null | 
					
						
							|  |  |  | 						&& | 
					
						
							|  |  |  | 						$quantityunit->id == $product->qu_id_stock) || ($defaultQuUnit != null && $quantityunit->id == $defaultQuUnit->id))) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 				<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<div class="form-group"> | 
					
						
							|  |  |  | 				<label for="to_qu_id">{{ $__t('Quantity unit to') }}</label> | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 				<select required | 
					
						
							| 
									
										
										
										
											2020-11-16 19:10:29 +01:00
										 |  |  | 					class="custom-control custom-select input-group-qu" | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					id="to_qu_id" | 
					
						
							|  |  |  | 					name="to_qu_id"> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 					<option></option> | 
					
						
							|  |  |  | 					@foreach($quantityunits as $quantityunit) | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 					<option @if($mode=='edit' | 
					
						
							|  |  |  | 						&& | 
					
						
							|  |  |  | 						$quantityunit->id == $quConversion->to_qu_id) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 					@endforeach | 
					
						
							|  |  |  | 				</select> | 
					
						
							|  |  |  | 				<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			@php if($mode == 'edit') { $value = $quConversion->factor; } else { $value = 1; } @endphp | 
					
						
							|  |  |  | 			@include('components.numberpicker', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'id' => 'factor', | 
					
						
							|  |  |  | 			'label' => 'Factor', | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 			'value' => $value, | 
					
						
							|  |  |  | 			'additionalHtmlElements' => '<p id="qu-conversion-info" | 
					
						
							|  |  |  | 				class="form-text text-info d-none"></p>', | 
					
						
							| 
									
										
										
										
											2020-11-15 14:15:09 +01:00
										 |  |  | 			'additionalCssClasses' => 'input-group-qu locale-number-input locale-number-quantity-amount' | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-08 19:00:12 +01:00
										 |  |  | 			<div class="form-group @if($mode == 'edit') d-none @endif"> | 
					
						
							|  |  |  | 				<div class="custom-control custom-checkbox"> | 
					
						
							| 
									
										
										
										
											2020-11-10 18:11:33 +01:00
										 |  |  | 					<input checked | 
					
						
							| 
									
										
										
										
											2020-11-08 22:13:36 +01:00
										 |  |  | 						class="form-check-input custom-control-input" | 
					
						
							|  |  |  | 						type="checkbox" | 
					
						
							|  |  |  | 						id="create_inverse" | 
					
						
							|  |  |  | 						name="create_inverse:skip" | 
					
						
							|  |  |  | 						value="1"> | 
					
						
							| 
									
										
										
										
											2020-11-08 19:00:12 +01:00
										 |  |  | 					<label class="form-check-label custom-control-label" | 
					
						
							|  |  |  | 						for="create_inverse">{{ $__t('Create inverse QU conversion') }}</label> | 
					
						
							|  |  |  | 				</div> | 
					
						
							| 
									
										
										
										
											2020-11-10 18:11:33 +01:00
										 |  |  | 				<span id="qu-conversion-inverse-info" | 
					
						
							|  |  |  | 					class="form-text text-info d-none"></span> | 
					
						
							| 
									
										
										
										
											2020-04-24 10:41:50 -05:00
										 |  |  | 			</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 			@include('components.userfieldsform', array( | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			'userfields' => $userfields, | 
					
						
							|  |  |  | 			'entity' => 'quantity_unit_conversions' | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 			)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 20:32:50 +02:00
										 |  |  | 			<button id="save-quconversion-button" | 
					
						
							|  |  |  | 				class="btn btn-success">{{ $__t('Save') }}</button> | 
					
						
							| 
									
										
										
										
											2019-09-15 16:40:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | @stop |