Fix: Load scanner.js after SCANNER_CONFIG is defined

- Moved JS loading to end of page (after config)
- Styled manual search button with blue background
- Fixed script loading order issue

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-02-17 11:30:51 +01:00
parent 001f1b304c
commit 33fa68e0e7

View file

@ -73,11 +73,10 @@ $enableInventory = getDolGlobalInt('HANDYBARCODESCANNER_ENABLE_INVENTORY', 1);
$form = new Form($db);
// CSS und JS einbinden
$arrayofjs = array('/handybarcodescanner/js/scanner.js');
// CSS einbinden (JS wird manuell am Ende geladen)
$arrayofcss = array('/handybarcodescanner/css/scanner.css');
llxHeader('', $langs->trans("HandyBarcodeScanner"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'mod-handybarcodescanner page-scanner classforhorizontalscrolloftabs');
llxHeader('', $langs->trans("HandyBarcodeScanner"), '', '', 0, 0, array(), $arrayofcss, '', 'mod-handybarcodescanner page-scanner classforhorizontalscrolloftabs');
// Titel
print load_fiche_titre($langs->trans("HandyBarcodeScanner"), '', 'handybarcodescanner@handybarcodescanner');
@ -129,9 +128,9 @@ print '</div>'; // div-table-responsive
// Manual Barcode Input (for testing without camera/HTTPS)
print '<div class="manual-input-section marginbottomonly margintoponly">';
print '<div class="input-group" style="display: flex; gap: 10px; align-items: center;">';
print '<input type="text" id="manual-barcode-input" class="flat minwidth200" placeholder="'.$langs->trans("BarcodeManualInput").'" style="flex: 1; padding: 10px; font-size: 16px;">';
print '<button type="button" id="manual-search-btn" class="button butAction">'.$langs->trans("Search").'</button>';
print '<div style="display: flex; gap: 10px; align-items: center;">';
print '<input type="text" id="manual-barcode-input" class="flat" placeholder="'.$langs->trans("BarcodeManualInput").'" style="flex: 1; padding: 12px; font-size: 16px; border: 1px solid #ccc; border-radius: 4px;">';
print '<button type="button" id="manual-search-btn" class="button" style="background: #0077b3; color: #fff; padding: 12px 20px; border: none; border-radius: 4px; font-size: 16px; cursor: pointer;">'.$langs->trans("Search").'</button>';
print '</div>';
print '</div>';
@ -185,6 +184,7 @@ var SCANNER_CONFIG = {
};
</script>
<script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script>
<script src="<?php echo dol_buildpath('/handybarcodescanner/js/scanner.js', 1); ?>"></script>
<?php
// End of page