Update map-customer.tpl

fix Map
This commit is contained in:
Focuslinkstech 2024-03-19 09:08:30 +01:00
parent af3995b421
commit 21058d5c4e

View File

@ -4,28 +4,15 @@
<div id="map" style="width: '100%'; height: 600px; margin: 20px auto"></div> <div id="map" style="width: '100%'; height: 600px; margin: 20px auto"></div>
{literal} {literal}
<script> <script>
function getLocation() { window.onload = function() {
if (navigator.geolocation) { var map = L.map('map').setView([51.505, -0.09], 13);
navigator.geolocation.getCurrentPosition(showPosition);
} else {
setupMap(51.505, -0.09);
}
}
function showPosition(position) {
setupMap(position.coords.latitude, position.coords.longitude);
}
function setupMap(lat, lon) {
var map = L.map('map').setView([lat, lon], 13);
var group = L.featureGroup().addTo(map); var group = L.featureGroup().addTo(map);
var customers = {/literal}{$customers|json_encode}{literal}; var customers = {/literal}{$customers|json_encode}{literal};
L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', { L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', {
attribution: attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd', subdomains: 'abcd',
maxZoom: 20 maxZoom: 20
}).addTo(map); }).addTo(map);
@ -53,10 +40,6 @@
map.fitBounds(group.getBounds()); map.fitBounds(group.getBounds());
} }
window.onload = function() { </script>
getLocation();
}
</script>
{/literal} {/literal}
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}