feat: 6 UX improvements for field technicians
F1: Scan existing asset → auto check-in (handleBarcode now autoCheckins) F2: Auto-generate address from GPS reverse geocode (Nominatim, all 3 modes) F3: Larger camera viewport (3:4 aspect ratio, full-width) F4: Building # already syncs to Address/Trailer field (existing) F5: Parking location GPS button already exists (fillGpsParking) F6: Navigation tool with route line on map (existing navigateToAsset) Backend: Added GET /api/geocode endpoint for reverse geocoding
This commit is contained in:
@@ -3518,28 +3518,6 @@
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
// F6: Navigate — open Google Maps with directions from user's current GPS
|
||||
async function navigateToAsset() {
|
||||
if (!AppState.currentAssetId) return;
|
||||
if (!AppState.gpsLat) {
|
||||
showToast('GPS not available — allow location access', true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const a = await api('/api/assets/' + AppState.currentAssetId);
|
||||
if (!a.latitude || !a.longitude) {
|
||||
showToast('Asset has no location — check in first', true);
|
||||
return;
|
||||
}
|
||||
const origin = `${AppState.gpsLat},${AppState.gpsLng}`;
|
||||
const dest = `${a.latitude},${a.longitude}`;
|
||||
const url = `https://www.google.com/maps/dir/?api=1&origin=${origin}&destination=${dest}&travelmode=driving`;
|
||||
window.open(url, '_blank');
|
||||
} catch (e) {
|
||||
showToast('Navigation error: ' + e.message, true);
|
||||
}
|
||||
}
|
||||
|
||||
async function navigateToAsset() {
|
||||
if (!AppState.currentAssetId) return;
|
||||
if (!AppState.gpsLat || !AppState.gpsLng) {
|
||||
|
||||
Reference in New Issue
Block a user