add local mapbox script, update objects

This commit is contained in:
Tykayn 2025-06-04 00:16:56 +02:00 committed by tykayn
parent c6e05463b1
commit b1f6433b7d
13 changed files with 309 additions and 182 deletions

View file

@ -9,17 +9,17 @@
</style>
<div class="example-wrapper">
<h1>Labourage fait sur la zone "{{ zone }}" ✅</h1>
<h1>Labourage fait sur la zone "{{ stats.zone }} {{stats.name}}" ✅</h1>
<a href="{{ path('app_admin_labourer', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Labourer les mises à jour</a>
<a href="{{ path('app_admin_stats', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Voir les résultats</a>
<p>
lieux trouvés en plus: {{ results|length }}
lieux trouvés en plus: {{ new_places_counter }}
</p>
{# {{ dump(results) }} #}
<hr>
<p>
commerces existants déjà en base: {{ commerces|length }}
</p>
@ -30,49 +30,7 @@ commerces existants déjà en base: {{ commerces|length }}
<tbody>
{% for commerce in commerces %}
<tr>
<td>
{# {{ dump(commerce) }} #}
<a href="{{ path('app_admin_commerce',
{
'id': commerce.id
}
) }}">
{% if commerce.name is not null and commerce.name != '' %}
{{ commerce.name }},
{% else %}
(un lieu sans nom)
{% endif %}
</a>
</td>
<td>
{{ commerce.address }}
</td>
<td>
{{ commerce.email }}
</td>
<td>
{{ commerce.website }}
</td>
<td>
{# {{ commerce.opening_hours }} #}
</td>
<td>
{{ commerce.note }}
</td>
<td>
<a href="https://www.openstreetmap.org/{{ commerce.getOsmKind() }}/{{ commerce.getOsmId() }}" target="_blank">
<i class="bi bi-eye"></i>
voir sur osm</a>
<a href="{{ path('app_admin_delete', {'id': commerce.id}) }}">
<i class="bi bi-trash"></i>
</a>
</td>
</tr>
{% include 'admin/stats/row.html.twig' %}
{% endfor %}
</tbody>
</table>

View file

@ -1,6 +1,7 @@
{% extends 'base.html.twig' %}
{% block title %}{{ 'display.stats'|trans }}{% endblock %}
{% block title %}{{ 'display.stats'|trans }}- {{ stats.zone }}
{{ stats.name }} {% endblock %}
{% block stylesheets %}
{{ parent() }}
@ -10,12 +11,15 @@
{% block body %}
<div class="container">
<div class="mt-4 p-4">
<h1 class="title">{{ 'display.stats'|trans }}</h1>
<p>
{{ stats.zone }}
{{ stats.name }}
</p>
<a href="{{ path('app_admin_labourer', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Labourer les mises à jour</a>
<div class="row">
<div class="col-md-6 col-12">
<h1 class="title">{{ 'display.stats'|trans }} - {{ stats.zone }}
{{ stats.name }} - {{ stats.completionPercent }}% complété</h1>
</div>
<div class="col-md-6 col-12">
<a href="{{ path('app_admin_labourer', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Labourer les mises à jour</a>
</div>
</div>
<div class="row">
<div class="col-md-3 col-12">
{{ stats.getCompletionPercent() }} % complété sur les critères donnés.
@ -41,16 +45,28 @@
</div>
</div>
<div id="map" style="height: 400px;"></div>
{# <div id="query" style="height: 400px;"> #}
{# <pre>
{{query_places|raw}}
</pre> #}
<div id="maploader">
<div class="spinner-border" role="status">
<i class="bi bi-load bi-spin"></i>
<span class="visually-hidden">Chargement de la carte...</span>
</div>
</div>
<div id="map" style="height: 400px;"></div>
</div>
<div class="card mt-4">
<h1 class="card-title">Tableau des {{ stats.getPlacesCount() }} lieux</h1>
<a href="{{ path('app_admin_export_csv', {'zip_code': stats.zone}) }}" class="btn btn-primary">Exporter en CSV</a>
<div class="row">
<div class="col-md-6 col-12">
<h1 class="card-title p-4">Tableau des {{ stats.places |length }} lieux</h1>
</div>
<div class="col-md-6 col-12">
<a class="btn btn-primary pull-right" href="{{ path('app_admin_export_csv', {'zip_code': stats.zone}) }}" class="btn btn-primary">
<i class="bi bi-filetype-csv"></i>
Exporter en CSV
</a>
</div>
</div>
<table class="table table-bordered table-striped table-hover table-responsive">
{% include 'admin/stats/table-head.html.twig' %}
<tbody>
@ -62,7 +78,7 @@
</div>
<h2>requête overpass</h2>
<pre>
<pre class="p-4 bg-light">
{{query_places|raw}}
</pre>
</div>
@ -137,6 +153,9 @@ out skel qt;`;
}
console.log('map chargé',data.elements);
document.getElementById('maploader').classList.add('d-none');
data.elements.forEach(element => {
// Cherche les coordonnées à la racine ou dans center
const lat = element.lat || (element.center && element.center.lat);

View file

@ -41,13 +41,19 @@
{% endif %}
{{ commerce.mainTag }}
</td>
<td class="{{ commerce.hasAddress() ? 'filled' : '' }}">{{ commerce.address }}</td>
<td class="{{ commerce.hasWebsite() ? 'filled' : '' }}">{{ commerce.website }}</td>
<td class="{{ commerce.hasWheelchair() ? 'filled' : '' }}">{{ commerce.wheelchair }}</td>
<td class="{{ commerce.hasNote() ? 'filled' : '' }}">{{ commerce.note }}</td>
<td class="{{ commerce.noteContent ? 'filled' : '' }}">{{ commerce.noteContent }}</td>
<td class="{{ commerce.noteContent ? 'filled' : '' }}">{{ commerce.noteContent }}</td>
<td>
<a href="https://www.openstreetmap.org/{{ commerce.osmKind }}/{{ commerce.osmId }}" target="_blank">
<i class="bi bi-globe"></i>
{{ commerce.osmId }}
</a>
</td>
<td>
{{ commerce.osmKind }}
</td>
</tr>

View file

@ -24,5 +24,11 @@
<th>
<i class="bi bi-pencil-square"></i>
Texte de la note</th>
<th>
Osm id</th>
<th>
Osm kind</th>
</tr>
</thead>

View file

@ -254,7 +254,7 @@ out skel qt;`;
<td>
<a href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}">{{ stat.zone }} {{ stat.name }}</a>
</td>
<td>{{ stat.placesCount }}</td>
<td>{{ stat.places |length }}</td>
<td style="background : rgba(0 , 255, 0, {{stat.completionPercent / 100 }} )">{{ stat.completionPercent }}</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>

View file

@ -111,15 +111,18 @@
<div class="col-12 mt-4">
<div class="actions-modification">
<a class="btn btn-info" href="{{ path('app_public_index') }}">{{ 'display.contact_humans'|trans }}</a>
<a class="btn btn-info" href="{{ path('app_public_index') }}">
<i class="bi bi-people"></i>
{{ 'display.contact_humans'|trans }}
</a>
<button id="showAllFields" class="btn btn-secondary mx-4">
<i class="bi bi-eye"></i>
Voir aussi les champs déjà remplis
</button>
</button>
<button id="closedCommerce" class="btn btn-danger mx-4">
<i class="bi bi-x-circle"></i>
<button id="closedCommerce" class="btn btn-danger mx-4 mt-4">
<i class="bi bi-x-circle"></i>
Je souhaite signaler que ce commerce est fermé
</button>
</div>
@ -128,8 +131,6 @@
</div>
<div class="row justify-content-center mt-4">
<div class="col-12 col-lg-10 col-xl-8">
<div class="card">
<div class="card-body">
<div class="d-flex flex-column flex-md-row align-items-md-center justify-content-between">
@ -144,9 +145,6 @@
{{ 'display.view_on_osm'|trans }}
</a>
</div>
<a href="{{ path('app_admin_stats', {'zip_code': zone ?? '-1'}) }}" class="btn btn-outline-secondary">
<i class="bi bi-bar-chart"></i>
{{ 'display.view_stats'|trans }}
@ -170,12 +168,11 @@
</div>
</div>
</div>
</div>
{% block javascripts %}
{{ parent() }}
<script src='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js'></script>
<script src={{asset('js/mapbox/mapbox-gl.js')}}></script>
<script>
function check_validity(e) {
let errors = [];

View file

@ -4,7 +4,6 @@
{% block stylesheets %}
{{ parent() }}
{# <link href='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css' rel='stylesheet' /> #}
{% endblock %}
{% block body %}
@ -32,18 +31,8 @@
<br>
<a href="{{ path('app_public_index') }}">Retour à la page d'accueil</a>
</div>
{# <h2>Tags</h2> #}
{# {{dump(commerce)}} #}
{# {% if commerce.tags_converted."contact:email" is defined %}
<a class="btn btn-primary" href="mailto:{{ commerce.tags_converted."contact:email" }}">C'est mon commerce, le modifier</a>
{% else %}
<a class="btn btn-primary" href="{{ path('app_public_index') }}">C'est mon commerce, pour le modifier je souhaite ajouter mon email de contact</a>
{% endif %} #}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{# <script src='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js'></script> #}
{% endblock %}