Fixed camera scanning targets (fixes #1210)

This commit is contained in:
Bernd Bestel 2020-12-22 19:06:41 +01:00
parent 159ab253dd
commit 937bd6b702
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
4 changed files with 13 additions and 3 deletions

View File

@ -1,2 +1,2 @@
### General & other improvements/fixes
- Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu) - Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu)
- Fixed that browser camera barcode scanning did not work on the product edit page

View File

@ -87,7 +87,7 @@ function OnBarcodeScanned(barcode)
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target) $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
{ {
if (target !== "#scanned_barcod") if (target !== "#scanned_barcode")
{ {
return; return;
} }

View File

@ -88,3 +88,13 @@ Grocy.FrontendHelpers.ValidateForm('barcode-form');
$('#barcode').focus(); $('#barcode').focus();
RefreshLocaleNumberInput(); RefreshLocaleNumberInput();
Grocy.Components.UserfieldsForm.Load() Grocy.Components.UserfieldsForm.Load()
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
{
if (target !== "#barcode")
{
return;
}
$("#barcode").val(barcode);
});

View File

@ -58,7 +58,7 @@
id="barcode" id="barcode"
name="barcode" name="barcode"
value="@if($mode == 'edit'){{ $barcode->barcode }}@endif" value="@if($mode == 'edit'){{ $barcode->barcode }}@endif"
data-target="#scanned_barcode"> data-target="#barcode">
@include('components.barcodescanner') @include('components.barcodescanner')
</div> </div>
</div> </div>