Xinon mobile/add top margin
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user