diff --git a/static/index.html b/static/index.html index 53a6399..0cc0add 100644 --- a/static/index.html +++ b/static/index.html @@ -2107,6 +2107,10 @@ populateCustomerSelect(); loadBadgeChecklist(); }); + // Start hardware and data loading for auto-login + initGPS(); + startScanning(); + loadAssets(); } catch (e) { // Token expired or invalid — clear it localStorage.removeItem('canteen_session'); @@ -2162,6 +2166,10 @@ populateCustomerSelect(); loadBadgeChecklist(); }); + // Start hardware and data loading + initGPS(); + startScanning(); + loadAssets(); } catch (e) { errEl.textContent = e.message || 'Login failed'; errEl.classList.add('show'); @@ -2633,7 +2641,7 @@ if (ocrEl) ocrEl.textContent = '❌ OCR failed: ' + ocrErr.message; } - // Extract GPS from EXIF — fall back to device GPS if stripped + // Extract GPS from EXIF const gpsEl = document.getElementById('scanGpsResult'); try { const gps = await extractGpsFromPhoto(file); @@ -2641,34 +2649,13 @@ pickedPhotoGps = gps; if (gpsEl) { gpsEl.style.display = 'block'; - gpsEl.innerHTML = `📍 GPS: ${gps.lat.toFixed(6)}, ${gps.lng.toFixed(6)} (from photo)`; + gpsEl.innerHTML = `📍 GPS: ${gps.lat.toFixed(6)}, ${gps.lng.toFixed(6)}`; } } else { - // EXIF GPS stripped by browser — try device GPS if (gpsEl) { - gpsEl.innerHTML = '📍 No GPS in photo — trying device location...'; gpsEl.style.display = 'block'; + gpsEl.innerHTML = '📍 No GPS data in photo'; } - navigator.geolocation.getCurrentPosition( - pos => { - const lat = pos.coords.latitude; - const lng = pos.coords.longitude; - const acc = pos.coords.accuracy; - pickedPhotoGps = { lat, lng, accuracy: acc }; - AppState.gpsLat = lat; - AppState.gpsLng = lng; - AppState.gpsAcc = acc; - if (gpsEl) { - gpsEl.innerHTML = `📍 GPS: ${lat.toFixed(6)}, ${lng.toFixed(6)} (from device)`; - } - }, - err => { - if (gpsEl) { - gpsEl.innerHTML = `📍 No GPS — ${err.message}. Enter manually after creating.`; - } - }, - { enableHighAccuracy: true, timeout: 10000 } - ); } } catch (gpsErr) { if (gpsEl) { @@ -2963,7 +2950,11 @@ video.style.display = 'block'; scanningActive = true; - setScanStatus('Point camera at a barcode', 'success'); + // Show the 📸 capture button for text-only stickers (Connect ID, etc.) + const capOverlay = document.getElementById('scanCaptureOverlay'); + if (capOverlay) capOverlay.style.display = 'flex'; + + setScanStatus('Point camera at a barcode, or tap 📸 for text stickers', 'success'); // decodeFromVideoDevice handles camera + scanning in one call codeReader.decodeFromVideoDevice(deviceId, video, (result, err) => { @@ -2995,6 +2986,9 @@ ph.style.display = ''; ph.innerHTML = '