Adds /dashboard/plant/map: a Leaflet view of every vehicle scanned from the MEGA Clock kiosk, plotted at its last known position. Schema - vehicles.last_latitude / last_longitude / last_scanned_at / last_location_accuracy_m denormalised off fuel_logs so the map page renders every vehicle in a single query. Same best-effort pattern as attention_dismissed_at; updated by /api/clock/vehicle-scan after every successful scan. PB init defaults new number cols to 0 (not null) — filter uses 'last_latitude > 0 || last_latitude < 0' to mean 'real fix'. - Indexed via idx_vehicles_last_scanned. Map UI - Custom SVG markers per unit_type: car silhouette for fuel, tractor silhouette for plant, 24x24, drop-shadowed. - Clustering via react-leaflet-cluster over Leaflet.markercluster. Cluster icons colour-ramp with size (green->sky->amber->rose) and scale 32->54px. - Three-button base-layer switcher: Street (OSM), Dark (ESRI Dark Gray Canvas — CartoDB watermarks tiles without a key), Satellite (ESRI World Imagery). Last choice persists in localStorage. - Site pins: small purple map-marker divIcon, click flies the map to zoom level 15. - Empty-state is a floating chip on the map rather than a full-page card so the map is always visible. APIs - /api/clock/vehicle-scan: stores the GPS fix on the fuel_logs row AND denormalises onto the vehicle when present; missing-coord scan leaves last_* untouched. Sidebar: new Map entry under Plant group.
60 lines
No EOL
1.3 KiB
CSS
Executable file
60 lines
No EOL
1.3 KiB
CSS
Executable file
.marker-cluster-small {
|
|
background-color: rgba(181, 226, 140, 0.6);
|
|
}
|
|
.marker-cluster-small div {
|
|
background-color: rgba(110, 204, 57, 0.6);
|
|
}
|
|
|
|
.marker-cluster-medium {
|
|
background-color: rgba(241, 211, 87, 0.6);
|
|
}
|
|
.marker-cluster-medium div {
|
|
background-color: rgba(240, 194, 12, 0.6);
|
|
}
|
|
|
|
.marker-cluster-large {
|
|
background-color: rgba(253, 156, 115, 0.6);
|
|
}
|
|
.marker-cluster-large div {
|
|
background-color: rgba(241, 128, 23, 0.6);
|
|
}
|
|
|
|
/* IE 6-8 fallback colors */
|
|
.leaflet-oldie .marker-cluster-small {
|
|
background-color: rgb(181, 226, 140);
|
|
}
|
|
.leaflet-oldie .marker-cluster-small div {
|
|
background-color: rgb(110, 204, 57);
|
|
}
|
|
|
|
.leaflet-oldie .marker-cluster-medium {
|
|
background-color: rgb(241, 211, 87);
|
|
}
|
|
.leaflet-oldie .marker-cluster-medium div {
|
|
background-color: rgb(240, 194, 12);
|
|
}
|
|
|
|
.leaflet-oldie .marker-cluster-large {
|
|
background-color: rgb(253, 156, 115);
|
|
}
|
|
.leaflet-oldie .marker-cluster-large div {
|
|
background-color: rgb(241, 128, 23);
|
|
}
|
|
|
|
.marker-cluster {
|
|
background-clip: padding-box;
|
|
border-radius: 20px;
|
|
}
|
|
.marker-cluster div {
|
|
width: 30px;
|
|
height: 30px;
|
|
margin-left: 5px;
|
|
margin-top: 5px;
|
|
|
|
text-align: center;
|
|
border-radius: 15px;
|
|
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
}
|
|
.marker-cluster span {
|
|
line-height: 30px;
|
|
} |