Add changelog and time spent on route to the popup

This commit is contained in:
Eugene Burmakin
2024-05-30 11:56:04 +02:00
parent 5e4e686492
commit e235ff66b0
3 changed files with 15 additions and 2 deletions
@@ -94,9 +94,10 @@ export default class extends Controller {
// Get the timestamps of the first and last points
var firstTimestamp = this.formatDate(polylineCoordinates[0][4]);
var lastTimestamp = this.formatDate(polylineCoordinates[polylineCoordinates.length - 1][4])
var timeOnRoute = Math.round((polylineCoordinates[polylineCoordinates.length - 1][4] - polylineCoordinates[0][4]) / 60); // Time in minutes
// Create the popup content
var popupContent = `Route started: ${firstTimestamp}<br>Route ended: ${lastTimestamp}`;
var popupContent = `Route started: ${firstTimestamp}<br>Route ended: ${lastTimestamp}<br>Time en route: ${timeOnRoute} minutes`;
addHighlightOnHover(polyline, map, popupContent);