diff --git a/InvenTree/InvenTree/static/script/inventree/barcode.js b/InvenTree/InvenTree/static/script/inventree/barcode.js index 0be3f0e9d6..f623a6e886 100644 --- a/InvenTree/InvenTree/static/script/inventree/barcode.js +++ b/InvenTree/InvenTree/static/script/inventree/barcode.js @@ -90,6 +90,15 @@ function clearBarcodeError(modal, message) { } +function enableBarcodeInput(modal, enabled=true) { + + var barcode = $(modal + ' #barcode'); + + barcode.prop('disabled', !enabled); + + modalEnable(modal, enabled); +} + function getBarcodeData(modal) { modal = modal || '#modal-form'; @@ -126,7 +135,6 @@ function barcodeDialog(title, options={}) { var barcode = getBarcodeData(modal); if (options.submit) { - modalEnable(modal, false); options.submit(barcode); } @@ -138,7 +146,6 @@ function barcodeDialog(title, options={}) { var barcode = getBarcodeData(modal); if (options.submit) { - modalEnable(modal, false); options.submit(barcode); } }); @@ -182,7 +189,9 @@ function barcodeScanDialog() { barcodeDialog( "Scan Barcode", { + headerContent: `
Scan barcode data below
`, submit: function(barcode) { + enableBarcodeInput(modal, false); inventreePut( '/api/barcode/', { @@ -194,6 +203,8 @@ function barcodeScanDialog() { console.log(response); + enableBarcodeInput(modal, true); + if (status == 'success') { if ('success' in response) {