Finalized frontend external barcode lookup implementation (references #158)

This commit is contained in:
Bernd Bestel
2025-01-12 13:58:47 +01:00
parent c9ffe4885d
commit c73be7d18e
17 changed files with 160 additions and 59 deletions

View File

@@ -250,9 +250,13 @@ $('#product_id_text_input').on('blur', function(e)
Grocy.Components.ProductPicker.PopupOpen = false;
window.location.href = U('/product/new?flow=InplaceNewProductWithBarcode&barcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceAddBarcodeToExistingProduct&barcode=" + input + "&" + embedded) + "&" + embedded);
}
},
barcodepluginlookup: {
label: '<strong>E</strong> ' + __t('External barcode lookup (via plugin)'),
}
};
if (Grocy.ExternalBarcodeLookupPluginName)
{
buttons.barcodepluginlookup = {
label: '<strong>E</strong> ' + __t('External barcode lookup') + ' <span class="badge badge-pill badge-light">' + Grocy.ExternalBarcodeLookupPluginName + '</span>',
className: 'btn-dark add-new-product-plugin-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
callback: function()
{
@@ -279,8 +283,8 @@ $('#product_id_text_input').on('blur', function(e)
}
);
}
}
};
};
}
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_DISABLE_BROWSER_BARCODE_CAMERA_SCANNING)
{
@@ -332,7 +336,8 @@ $('#product_id_text_input').on('blur', function(e)
size: 'large',
backdrop: true,
closeButton: false,
buttons: buttons
buttons: buttons,
className: "wider"
}).on('keypress', function(e)
{
if (e.key === 'B' || e.key === 'b')