diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index bdf97d9b..3812bc44 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -301,6 +301,21 @@ $('#name').focus(); $('.input-group-qu').trigger('change'); Grocy.FrontendHelpers.ValidateForm('product-form'); +$(document).on('click', '.stockentry-grocycode-product-label-print', function(e) +{ + e.preventDefault(); + document.activeElement.blur(); + + var productId = $(e.currentTarget).attr('data-product-id'); + Grocy.Api.Get('stock/products/' + productId + '/printlabel', function(labelData) + { + if (Grocy.Webhooks.labelprinter !== undefined) + { + Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData); + } + }); +}); + $(document).on('click', '.qu-conversion-delete-button', function(e) { var objectId = $(e.currentTarget).attr('data-qu-conversion-id'); diff --git a/views/productform.blade.php b/views/productform.blade.php index 7670b324..d09a778a 100644 --- a/views/productform.blade.php +++ b/views/productform.blade.php @@ -25,11 +25,7 @@ @if($mode == 'edit') @if(!empty($product->picture_file_name)) @@ -445,8 +441,18 @@
- {{ $__t('Grocycode is a unique referer to this product in your grocy instance. Print it onto a label and scan it like any other barcode!') }}
- {{ $__t('Download') }}
+ {{ $__t('Grocycode is a unique referer to this product in your grocy instance. Print it onto a label and scan it like any other barcode!') }}
+
+ {{ $__t('Download') }} + @if(GROCY_FEATURE_FLAG_LABELPRINTER) + + {{ $__t('Print Product Label') }} + + @endif
@@ -693,4 +699,4 @@ -@stop \ No newline at end of file +@stop