feat: asset naming, location extraction, and location display

- New asset naming: {MID} - {Customer} / {Address} / {Building details}
- Extracted 660 building_names from customer data (Disney resorts, hotels)
- 1,704 assets now have location data (building_name, floor, etc.)
- Location section in detail view now shows building, floor, trailer, room
- Added has_gps filter to API for map loading
- Added location_source column to track GPS origin
This commit is contained in:
2026-05-28 23:58:56 -04:00
parent ae3b114ebc
commit 1db6475f83
5 changed files with 901 additions and 6 deletions
+8 -6
View File
@@ -3608,9 +3608,10 @@
if (a.place) locParts.push(esc(a.place));
if (locParts.length) parts.push(`<div class="ai-location-line">${locParts.join(' · ')}</div>`);
const bldParts = [];
if (a.building_number) bldParts.push(`Bldg ${esc(a.building_number)}`);
if (a.building_name) bldParts.push(esc(a.building_name));
if (a.building_number && !a.building_name?.includes(a.building_number)) bldParts.push(`Bldg ${esc(a.building_number)}`);
if (a.trailer_number) bldParts.push(`Trailer ${esc(a.trailer_number)}`);
if (a.floor) bldParts.push(esc(a.floor));
if (a.floor) bldParts.push(`Floor ${esc(a.floor)}`);
if (a.room) bldParts.push(`Room ${esc(a.room)}`);
if (bldParts.length) parts.push(`<div class="ai-building">${bldParts.join(' · ')}</div>`);
if (a.address) parts.push(`<div class="ai-address">📍 ${esc(a.address)}</div>`);
@@ -3752,8 +3753,8 @@
df('Created', formatDate(a.created_at)) +
df('Updated', formatDate(a.updated_at));
// Directions
const hasDir = a.address || a.building_name || a.building_number || a.floor || a.room || a.walking_directions || a.map_link || a.parking_location;
// Location / Directions
const hasDir = a.address || a.building_name || a.building_number || a.floor || a.room || a.trailer_number || a.walking_directions || a.map_link || a.parking_location;
const dirCard = document.getElementById('detailDirections');
const dirBtn = document.getElementById('detailDirectionsBtn');
if (hasDir) {
@@ -3764,6 +3765,7 @@
df('Address', a.address),
df('Building', a.building_name),
df('Building #', a.building_number),
df('Trailer', a.trailer_number),
df('Floor', a.floor),
df('Room', a.room),
df('Walking Directions', a.walking_directions),
@@ -4333,7 +4335,7 @@
window._assetPins = [];
try {
const assets = await api('/api/assets?limit=2000');
const assets = await api('/api/assets?has_gps=true&limit=2000');
_mapAllAssets = assets;
buildMapFilterChips(assets);
// Apply current filter
@@ -4498,7 +4500,7 @@
});
// Get all assets with coordinates
const assets = await api('/api/assets?limit=2000');
const assets = await api('/api/assets?has_gps=true&limit=2000');
const heatData = [];
assets.forEach(a => {
if (a.latitude != null && a.longitude != null) {