2023-05-21 10:56:38 +02:00
@ php require_frontend_packages ([ 'bootstrap-combobox' ]); @ endphp
2021-07-05 22:49:51 +02:00
@ once
2018-07-14 14:43:57 +02:00
@ push ( 'componentScripts' )
2020-08-31 20:32:50 +02:00
< script src = " { { $U ('/viewjs/components/productpicker.js', true) }}?v= { { $version }} " ></ script >
2018-07-14 14:43:57 +02:00
@ endpush
2025-01-12 13:58:47 +01:00
@ push ( 'componentScripts' )
< script >
Grocy . ExternalBarcodeLookupPluginName = " { { $ExternalBarcodeLookupPluginName }} " ;
</ script >
@ endpush
2021-07-05 22:49:51 +02:00
@ endonce
2018-07-14 14:43:57 +02:00
@ php if ( empty ( $disallowAddProductWorkflows )) { $disallowAddProductWorkflows = false ; } @ endphp
2019-09-14 17:34:36 +02:00
@ php if ( empty ( $disallowAllProductWorkflows )) { $disallowAllProductWorkflows = false ; } @ endphp
2018-07-14 18:23:41 +02:00
@ php if ( empty ( $prefillByName )) { $prefillByName = '' ; } @ endphp
2018-11-26 19:37:17 +01:00
@ php if ( empty ( $prefillById )) { $prefillById = '' ; } @ endphp
2018-08-04 07:45:24 +02:00
@ php if ( ! isset ( $isRequired )) { $isRequired = true ; } @ endphp
2019-09-14 17:34:36 +02:00
@ php if ( ! isset ( $label )) { $label = 'Product' ; } @ endphp
@ php if ( ! isset ( $disabled )) { $disabled = false ; } @ endphp
@ php if ( empty ( $hint )) { $hint = '' ; } @ endphp
2019-09-21 13:08:42 +02:00
@ php if ( empty ( $nextInputSelector )) { $nextInputSelector = '' ; } @ endphp
2020-12-29 21:06:31 +01:00
@ php if ( empty ( $validationMessage )) { $validationMessage = 'You have to select a product' ; } @ endphp
2022-04-03 19:28:59 +02:00
@ php if ( empty ( $additionalGroupCssClasses )) { $additionalGroupCssClasses = '' ; } @ endphp
2018-07-14 14:43:57 +02:00
2022-04-03 19:28:59 +02:00
< div class = " form-group { { $additionalGroupCssClasses }} "
2020-08-31 20:32:50 +02:00
data - next - input - selector = " { { $nextInputSelector }} "
data - disallow - add - product - workflows = " { { BoolToString( $disallowAddProductWorkflows ) }} "
data - disallow - all - product - workflows = " { { BoolToString( $disallowAllProductWorkflows ) }} "
data - prefill - by - name = " { { $prefillByName }} "
data - prefill - by - id = " { { $prefillById }} " >
2020-11-09 21:30:22 +01:00
< label class = " w-100 "
for = " product_id " >
{{ $__t ( $label ) }}
@ if ( ! $disallowAllProductWorkflows )
2022-04-04 20:10:29 +02:00
< i class = " fa-solid fa-question-circle text-muted "
2020-11-09 21:30:22 +01:00
data - toggle = " tooltip "
2021-06-27 19:34:28 +02:00
data - trigger = " hover click "
2020-11-09 21:30:22 +01:00
title = " { { $__t ('Type a new product name or barcode and hit TAB or ENTER to start a workflow') }} " ></ i >
@ endif
2020-11-10 21:59:19 +01:00
@ if ( ! empty ( $hint ))
2022-04-04 20:10:29 +02:00
< i class = " fa-solid fa-question-circle text-muted "
2020-11-10 21:59:19 +01:00
data - toggle = " tooltip "
2021-06-27 19:34:28 +02:00
data - trigger = " hover click "
2020-11-10 21:59:19 +01:00
title = " { { $hint }} " ></ i >
@ endif
2020-08-31 20:32:50 +02:00
< span id = " barcode-lookup-disabled-hint "
2020-11-09 21:30:22 +01:00
class = " small text-muted d-none float-right " > {{ $__t ( 'Barcode lookup is disabled' ) }} </ span >
< i id = " barcode-lookup-hint "
2022-04-04 20:10:29 +02:00
class = " fa-solid fa-barcode float-right mt-1 " ></ i >
2020-04-21 02:18:09 -04:00
</ label >
2020-08-31 20:32:50 +02:00
< select class = " form-control product-combobox barcodescanner-input "
id = " product_id "
name = " product_id "
@ if ( $isRequired )
required
@ endif
@ if ( $disabled )
disabled
@ endif
data - target = " @productpicker " >
2018-07-14 14:43:57 +02:00
< option value = " " ></ option >
@ foreach ( $products as $product )
2020-09-14 11:20:29 +02:00
@ php $bc = null ;
if ( isset ( $barcodes )) {
$bc = FindObjectInArrayByPropertyValue ( $barcodes , 'product_id' , $product -> id );
}
@ endphp
2020-09-14 11:15:11 +02:00
< option data - additional - searchdata = " @if(isset( $bc )) { { $bc->barcodes }}@endif, "
2020-08-31 20:32:50 +02:00
value = " { { $product->id }} " > {{ $product -> name }} </ option >
2018-07-14 14:43:57 +02:00
@ endforeach
</ select >
2020-12-29 21:06:31 +01:00
< div class = " invalid-feedback " > {{ $__t ( $validationMessage ) }} </ div >
2020-08-31 20:32:50 +02:00
< div id = " custom-productpicker-error "
class = " form-text text-danger d-none " ></ div >
2020-11-14 11:05:36 +01:00
< div id = " flow-info-InplaceAddBarcodeToExistingProduct "
class = " form-text text-info small d-none " >< strong >< span id = " InplaceAddBarcodeToExistingProduct " ></ span ></ strong > {{ $__t ( 'will be added to the list of barcodes for the selected product on submit' ) }} </ div >
2018-07-14 14:43:57 +02:00
</ div >
2019-09-19 12:48:02 +02:00
@ include ( 'components.barcodescanner' )