Add manual barcode input for testing without camera/HTTPS
- Added text input field for manual barcode entry - Works with Enter key or Search button - Allows testing functionality without camera access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6bb3927ca3
commit
001f1b304c
3 changed files with 46 additions and 1 deletions
|
|
@ -127,6 +127,14 @@ print '</div>';
|
||||||
print '</div>'; // scanner-box
|
print '</div>'; // scanner-box
|
||||||
print '</div>'; // div-table-responsive
|
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>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// Last Scan Info
|
// Last Scan Info
|
||||||
print '<div class="scanner-last-scan marginbottomonly margintoponly">';
|
print '<div class="scanner-last-scan marginbottomonly margintoponly">';
|
||||||
print '<span class="opacitymedium">'.$langs->trans("LastScan").':</span> ';
|
print '<span class="opacitymedium">'.$langs->trans("LastScan").':</span> ';
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,9 @@
|
||||||
videoContainer: document.getElementById('scanner-video-container'),
|
videoContainer: document.getElementById('scanner-video-container'),
|
||||||
video: document.getElementById('scanner-video'),
|
video: document.getElementById('scanner-video'),
|
||||||
lastScanCode: document.getElementById('last-scan-code'),
|
lastScanCode: document.getElementById('last-scan-code'),
|
||||||
resultArea: document.getElementById('result-area')
|
resultArea: document.getElementById('result-area'),
|
||||||
|
manualInput: document.getElementById('manual-barcode-input'),
|
||||||
|
manualSearchBtn: document.getElementById('manual-search-btn')
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!elements.startBtn || !elements.videoContainer) {
|
if (!elements.startBtn || !elements.videoContainer) {
|
||||||
|
|
@ -101,6 +103,39 @@
|
||||||
function bindEvents() {
|
function bindEvents() {
|
||||||
elements.startBtn.addEventListener('click', startScanner);
|
elements.startBtn.addEventListener('click', startScanner);
|
||||||
elements.stopBtn.addEventListener('click', stopScanner);
|
elements.stopBtn.addEventListener('click', stopScanner);
|
||||||
|
|
||||||
|
// Manual barcode input
|
||||||
|
if (elements.manualSearchBtn && elements.manualInput) {
|
||||||
|
elements.manualSearchBtn.addEventListener('click', handleManualSearch);
|
||||||
|
elements.manualInput.addEventListener('keypress', function(e) {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
handleManualSearch();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle manual barcode input
|
||||||
|
function handleManualSearch() {
|
||||||
|
const barcode = elements.manualInput.value.trim();
|
||||||
|
if (!barcode) {
|
||||||
|
showToast('Bitte Barcode eingeben', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update last scan display
|
||||||
|
elements.lastScanCode.textContent = barcode;
|
||||||
|
|
||||||
|
// Vibration feedback
|
||||||
|
if (CONFIG.enableVibration && navigator.vibrate) {
|
||||||
|
navigator.vibrate(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search product
|
||||||
|
searchProduct(barcode);
|
||||||
|
|
||||||
|
// Clear input
|
||||||
|
elements.manualInput.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load all suppliers for manual selection
|
// Load all suppliers for manual selection
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ StartScan = Scannen starten
|
||||||
StopScan = Scannen stoppen
|
StopScan = Scannen stoppen
|
||||||
LastScan = Letzter Scan
|
LastScan = Letzter Scan
|
||||||
CameraAccessError = Kamera-Zugriff fehlgeschlagen. Bitte Berechtigung erteilen.
|
CameraAccessError = Kamera-Zugriff fehlgeschlagen. Bitte Berechtigung erteilen.
|
||||||
|
BarcodeManualInput = Barcode manuell eingeben...
|
||||||
|
Search = Suchen
|
||||||
|
|
||||||
# Modes
|
# Modes
|
||||||
Order = Bestellen
|
Order = Bestellen
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue