Xinon mobile/add top margin

This commit is contained in:
Luca Haid
2026-01-18 08:07:29 +00:00
parent 3777057f3a
commit 46304cf32b
3 changed files with 41 additions and 9 deletions
@@ -479,9 +479,27 @@ export default {
}, { deep: true });
// ==================== SCANNER FUNCTIONS ====================
const startScanner = async () => {
let scannerRestarting = false;
const startScanner = async (delay = 0) => {
if (scannerRestarting) return;
scannerError.value = '';
// Add delay for turbo mode restarts to let camera fully release
if (delay > 0) {
scannerRestarting = true;
await new Promise(resolve => setTimeout(resolve, delay));
scannerRestarting = false;
}
try {
// Ensure previous instance is cleared
if (scanner.value) {
try { await scanner.value.stop(); } catch (e) {}
scanner.value = null;
}
await nextTick();
scanner.value = new Html5Qrcode('qr-reader-movement');
await scanner.value.start(
{ facingMode: 'environment' },
@@ -578,10 +596,10 @@ export default {
const typeLabel = selectedType.value === 'IN' ? '+' : selectedType.value === 'OUT' ? '-' : '±';
emit('toast', `${typeLabel}1 ${article.title}`, 'success');
// Reset and restart scanner
// Reset and restart scanner with delay for camera to release
scannedArticle.value = null;
currentStock.value = 0;
await startScanner();
await startScanner(300);
} else {
emit('toast', result.message || 'Fehler', 'error');
// Fall back to normal mode
@@ -609,10 +627,10 @@ export default {
emit('toast', `+ ${article.title}`, 'success');
}
// Reset and restart scanner
// Reset and restart scanner with small delay
scannedArticle.value = null;
currentStock.value = 0;
startScanner();
startScanner(200);
};
const updateCartQuantity = (index, qty) => {