mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
lighten dashboard
This commit is contained in:
parent
9a097d2375
commit
8081889f1e
1 changed files with 5 additions and 41 deletions
|
@ -185,44 +185,8 @@ out body;
|
||||||
out skel qt;`;
|
out skel qt;`;
|
||||||
{% endverbatim %}
|
{% endverbatim %}
|
||||||
|
|
||||||
console.log(query);
|
|
||||||
console.log('https://overpass-api.de/api/interpreter');
|
|
||||||
const response = await fetch('https://overpass-api.de/api/interpreter', {
|
|
||||||
method: 'POST',
|
|
||||||
body: query
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
console.log('data',data);
|
|
||||||
|
|
||||||
// Ajouter un marqueur pour chaque point de la réponse
|
|
||||||
const bounds = new maplibregl.LngLatBounds();
|
|
||||||
|
|
||||||
data.elements.forEach(element => {
|
|
||||||
if (element.lat && element.lon) {
|
|
||||||
bounds.extend([element.lon, element.lat]);
|
|
||||||
|
|
||||||
const el = document.createElement('div');
|
|
||||||
el.className = 'marker';
|
|
||||||
el.style.width = '10px';
|
|
||||||
el.style.height = '10px';
|
|
||||||
el.style.borderRadius = '50%';
|
|
||||||
el.style.backgroundColor = '#ff0000';
|
|
||||||
|
|
||||||
new maplibregl.Marker(el)
|
|
||||||
.setLngLat([element.lon, element.lat])
|
|
||||||
.setPopup(new maplibregl.Popup({ offset: 25 })
|
|
||||||
.setHTML(`<h4>${element.tags?.name || 'Sans nom'}</h4>`))
|
|
||||||
.addTo(map);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Recentrer la carte sur les marqueurs
|
|
||||||
if (!bounds.isEmpty()) {
|
|
||||||
map.fitBounds(bounds, {
|
|
||||||
padding: 50
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -236,7 +200,7 @@ out skel qt;`;
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h2>Statistiques : {{ stats|length }} codes postaux</h2>
|
<h2>Statistiques : {{ stats|length }} codes postaux</h2>
|
||||||
|
|
||||||
<div id="mapDashboard"></div>
|
{# <div id="mapDashboard"></div> #}
|
||||||
|
|
||||||
|
|
||||||
<table class="table table-hover table-striped table-responsive">
|
<table class="table table-hover table-striped table-responsive">
|
||||||
|
@ -254,7 +218,7 @@ out skel qt;`;
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}">{{ stat.zone }} {{ stat.name }}</a>
|
<a href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}">{{ stat.zone }} {{ stat.name }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ stat.places |length }}</td>
|
<td>{{ stat.placesCount }}</td>
|
||||||
<td style="background : rgba(0 , 255, 0, {{stat.completionPercent / 100 }} )">{{ stat.completionPercent }}</td>
|
<td style="background : rgba(0 , 255, 0, {{stat.completionPercent / 100 }} )">{{ stat.completionPercent }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-primary" href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}"><i class="bi bi-eye"></i></a>
|
<a class="btn btn-sm btn-primary" href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}"><i class="bi bi-eye"></i></a>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue