map: change line appearance based on dispatch status

This commit is contained in:
desmukh 2023-02-08 16:51:46 +05:00
parent 5506d3cfa2
commit f241689eb7

View File

@ -53,7 +53,8 @@
endMarker.bindPopup({{ .endPoint.name }});
// Add line to display dispatch route
var route = L.polyline([start, end], {color: '#000'})
var myDashArray = {{ .status }} === "routeRequested" ? "20, 10" : {{ .status }} === "completed" ? "1, 5" : "0, 0"; // Dashed line based on status
var route = L.polyline([start, end], {color: '#000', dashArray: myDashArray });
// Generate string to display list of products in popup
var productsString = "";
@ -76,13 +77,13 @@
var map = L.map('map', {
center: [0, 0],
zoom: 2,
layers: [osm, makers]
layers: [osm, dispatches]
});
var overlayMaps = {
"Dispatches": dispatches,
"Makers": makers,
"Retailers": retailers,
"Dispatches": dispatches
"Retailers": retailers
};
var layerControl = L.control.layers(overlayMaps, null, {collapsed: false, position: "topleft"}).addTo(map);