mirror of
https://github.com/itsdave-de/fusionpbx_connect.git
synced 2025-05-06 15:45:15 +02:00
merge
This commit is contained in:
parent
35b27be53d
commit
296452214e
@ -34,13 +34,22 @@ function create_dialog_and_init_map(frm) {
|
||||
};
|
||||
|
||||
dialog.show();
|
||||
setTimeout(() => init_map(frm), 500); // Add a delay to ensure the map loads correctly
|
||||
|
||||
// Ensure the map container expands to fit its parent after the dialog is shown
|
||||
setTimeout(() => {
|
||||
const mapElement = document.getElementById('map');
|
||||
if (mapElement) {
|
||||
mapElement.style.width = "100%";
|
||||
mapElement.style.height = "100%";
|
||||
init_map(frm); // Initialize the map
|
||||
}
|
||||
}, 500); // Add a delay to ensure the map loads correctly
|
||||
}
|
||||
|
||||
var currentMap = null;
|
||||
|
||||
function init_map(frm) {
|
||||
console.table(window.L);
|
||||
//console.table(window.L);
|
||||
console.log("Initializing map with MyLeaflet...");
|
||||
if (currentMap !== null) {
|
||||
currentMap.remove(); // Remove the previous map if it exists
|
||||
@ -87,7 +96,7 @@ function init_map(frm) {
|
||||
},
|
||||
callback: function (r) {
|
||||
if (r.message) {
|
||||
console.table(r.message);
|
||||
//console.table(r.message);
|
||||
const data = r.message;
|
||||
const routeCoordinates = data.map(entry => [entry.latitude, entry.longitude]);
|
||||
const polyline = window.L.polyline(routeCoordinates, { color: 'red' }).addTo(map);
|
||||
|
Loading…
x
Reference in New Issue
Block a user