From 371dda46f0e7fad65c2af8f0179a0b5576d97301 Mon Sep 17 00:00:00 2001 From: morgane Date: Thu, 18 Jun 2026 15:50:41 +0000 Subject: [PATCH] Actualiser assets/js/app.js --- assets/js/app.js | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index 7ef1e95..95f6576 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -9064,9 +9064,9 @@ function onPfUnitChange() { if (confRow) confRow.style.display = unit === 'conf' ? 'block' : 'none'; } -function _updateBarcodeHint() { - const hint = document.getElementById('pf-barcode-hint'); - const val = (document.getElementById('pf-barcode')?.value || '').trim(); +function _updateBarcodeHint(inputId = 'pf-barcode', hintId = 'pf-barcode-hint') { + const hint = document.getElementById(hintId); + const val = (document.getElementById(inputId)?.value || '').trim(); if (hint) hint.style.display = val ? 'none' : 'block'; } @@ -9074,7 +9074,7 @@ function _updateBarcodeHint() { * Open a temporary camera modal to scan a barcode and fill the pf-barcode field. * Uses BarcodeDetector if available, otherwise shows manual-input fallback. */ -async function scanBarcodeForForm() { +async function scanBarcodeForForm(targetId = 'pf-barcode', hintId = 'pf-barcode-hint') { const overlayEl = document.getElementById('modal-overlay'); const contentEl = document.getElementById('modal-content'); @@ -9107,15 +9107,15 @@ async function scanBarcodeForForm() { const raw=(this.value||'').replace(/\\D/g,''); this.value=raw; if((raw.length===13||raw.length===8)&&validateEANChecksum(raw)){ stopStream(); - document.getElementById('pf-barcode').value=raw; - _updateBarcodeHint(); + document.getElementById('${targetId}').value=raw; + _updateBarcodeHint('${targetId}', '${hintId}'); document.getElementById('modal-overlay').style.display='none'; if(navigator.vibrate)navigator.vibrate(80); } "> `; @@ -9153,8 +9153,8 @@ async function scanBarcodeForForm() { stopStream(); overlayEl.style.display = 'none'; overlayEl.onclick = null; - document.getElementById('pf-barcode').value = code; - _updateBarcodeHint(); + document.getElementById(targetId).value = code; + _updateBarcodeHint(targetId, hintId); if (navigator.vibrate) navigator.vibrate(80); showToast(t('scan.barcode_acquired', { code }), 'success'); return; @@ -9335,6 +9335,14 @@ function showProductAction() { +
+ +
+ + +
+ +