Skip to content

Commit 3a8c339

Browse files
committed
fix: caricamento articoli da lettore barcode
1 parent 4334ab2 commit 3a8c339

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

modules/movimenti/add.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,25 @@ function disabilitaSede(id){
178178
}
179179
});
180180
181+
// Gestione invio (Enter) direttamente nel campo barcode:
182+
// evita il submit del form e avvia la ricerca barcode, così l\'articolo viene caricato prima della validazione.
183+
$("#barcode").on("keydown", function (event) {
184+
let key = window.event ? event.keyCode : event.which;
185+
186+
if (key === 13) {
187+
event.preventDefault();
188+
189+
$("#articolo-missing").addClass("hidden");
190+
191+
let value = $(this).val() || "";
192+
let search = value.replace(/[^a-z0-9\s\-\.\/\\|]+/gmi, "");
193+
194+
if (search !== "") {
195+
ricercaBarcode(search);
196+
}
197+
}
198+
});
199+
181200
// Reload pagina appena chiudo il modal
182201
$("#modals > div").on("hidden.bs.modal", function () {
183202
location.reload();

0 commit comments

Comments
 (0)