CIM37 - Country view

This commit is contained in:
“VeLiTi”
2024-04-02 21:44:07 +02:00
parent 3c0c157904
commit 391aa91341
8 changed files with 786 additions and 6 deletions

View File

@@ -52,6 +52,11 @@ $warrantyforecast = ioServer($api_url,'');
//Decode Payload
if (!empty($warrantyforecast)){$warrantyforecast = decode_payload($warrantyforecast);}else{$warrantyforecast = null;}
//GET GEOLOCATIONS
$api_url = '/v1/application/totals=/geolocation';
$geolocation = ioServer($api_url,'');
//Decode Payload
if (!empty($geolocation)){$geolocation = decode_payload($geolocation);}else{$geolocation = null;}
template_header('Dashboard', 'dashboard');
$view = '
@@ -126,6 +131,43 @@ $view .= '
</div>
';
//SHOW LOCATION BASED ON GEOLOCATION
if (!empty($geolocation)){
$add_pos = '';
foreach ($geolocation as $gloc){
//$glocation = json_decode($gl,true) ?? '';
if (!empty($gloc->geolocation) || $gloc->geolocation != '' || $gloc->geolocation != null ){
$glocation = json_decode($gloc->geolocation) ?? '';
if ($glocation[0] != null){
$add_pos .= 'L.marker({lon: '.$glocation[1].', lat: '.$glocation[0].'}).bindPopup(\''.$gloc->serialnumber.'\').addTo(map);';
}
}
}
$view .= '<div class="content-block">
<div id="map" style="height:300px;">
</div>
<script>
// initialize Leaflet
var map = L.map(\'map\').setView({lon: 5.1938101, lat: 51.5778742}, 2);
// add the OpenStreetMap tiles
L.tileLayer(\'https://tile.openstreetmap.org/{z}/{x}/{y}.png\', {
maxZoom: 19,
attribution: \'&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>\'
}).addTo(map);
// show the scale bar on the lower left corner
L.control.scale({imperial: true, metric: true}).addTo(map);
// show a marker on the map
'.$add_pos.'
</script>
</div>
';
}
$view .= '<div class="content-block">