fix: show GPS coords on map popups + asset list; toast on auto-checkin

This commit is contained in:
2026-06-01 23:28:37 -04:00
parent 120f52a29a
commit e3295afe73
+10 -1
View File
@@ -3096,8 +3096,10 @@
notes: 'Auto check-in on scan',
}),
});
showToast('📍 GPS saved — check the Map tab');
} catch (e) {
console.warn('Auto check-in failed:', e);
showToast('GPS check-in failed: ' + (e.message || 'network error'), true);
}
}
@@ -6118,7 +6120,10 @@
var ci = categoryInfo(a.category);
var icon = ci.icon;
if (icon.indexOf('<img') !== -1) icon = '🍽';
var gpsInfo = (a.latitude != null && a.longitude != null) ?
a.latitude.toFixed(6) + ', ' + a.longitude.toFixed(6) : '';
var popupHtml = '<b>' + esc(a.name) + '</b><br>' + esc(a.machine_id || '') +
(gpsInfo ? '<br><span style="font-size:11px;color:var(--text3,#888);font-family:monospace;">📍 ' + gpsInfo + '</span>' : '') +
'<br><button class="btn btn-outline btn-sm" style="margin-top:6px;" ' +
'onclick="switchTab(\'tabAssets\');viewAsset(' + a.id + ');">View Details</button>';
var catColor = ci.color;
@@ -6160,10 +6165,14 @@
var ci = categoryInfo(a.category);
var icon = ci.icon;
var hasGps = (a.latitude != null && a.longitude != null);
var gpsDisplay = '';
if (hasGps) {
gpsDisplay = ' · <span style="font-family:monospace;font-size:10px;">' + a.latitude.toFixed(5) + ', ' + a.longitude.toFixed(5) + '</span>';
}
html += '<div class="map-asset-item" onclick="switchTab(\'tabAssets\');viewAsset(' + a.id + ');">' +
'<span class="mai-icon">' + icon + '</span>' +
'<span class="mai-name">' + esc(a.name) + '</span>' +
'<span class="mai-meta">' + esc(a.machine_id || '') + (hasGps ? ' · 📍' : '') + '</span>' +
'<span class="mai-meta">' + esc(a.machine_id || '') + (hasGps ? ' · 📍' : '') + gpsDisplay + '</span>' +
'<span class="mai-dist">' + esc(a.category || '') + '</span>' +
'</div>';
});