diff --git a/static/index.html b/static/index.html index ce6b8c1..ddaea4a 100644 --- a/static/index.html +++ b/static/index.html @@ -1213,8 +1213,9 @@ TAB: ADD ASSET (Barcode / OCR / Manual) ═══════════════════════════════════════════════════════════════════════ -->
- - + + +
@@ -1238,7 +1239,8 @@
Point camera at a barcode or sticker
- + +
@@ -2369,6 +2371,25 @@ ); } + // Refresh GPS fix on demand (called when user taps Take Photo / Pick from Gallery) + function refreshGPS() { + if (!navigator.geolocation) return; + navigator.geolocation.getCurrentPosition( + pos => { + AppState.gpsLat = pos.coords.latitude; + AppState.gpsLng = pos.coords.longitude; + AppState.gpsAcc = pos.coords.accuracy; + const badge = document.getElementById('gpsBadge'); + if (badge) { + badge.className = 'gps-badge ok'; + badge.textContent = `📍 ${AppState.gpsLat.toFixed(4)}, ${AppState.gpsLng.toFixed(4)}`; + } + }, + () => {}, // silent fail — keep existing fix if user denies + { enableHighAccuracy: true, timeout: 10000, maximumAge: 0 } + ); + } + // ========================================================================= // TOAST // ========================================================================= @@ -2594,16 +2615,20 @@ let pickedPhotoFile = null; let pickedPhotoGps = null; // { lat, lng, accuracy } from EXIF - // Wire the hidden file input + // Wire the hidden file inputs (camera + gallery — two paths for EXIF GPS workaround) (function() { - const pp = document.getElementById('photoPicker'); - if (pp) { - pp.addEventListener('change', function(e) { - if (e.target.files && e.target.files[0]) { - handlePickedPhoto(e.target.files[0]); - } - }); + function wireInput(id) { + const el = document.getElementById(id); + if (el) { + el.addEventListener('change', function(e) { + if (e.target.files && e.target.files[0]) { + handlePickedPhoto(e.target.files[0]); + } + }); + } } + wireInput('cameraInput'); + wireInput('galleryInput'); })(); function handlePickedPhoto(file) {