osm-commerces/templates/public/stats_evolutions.html.twig

141 lines
7.8 KiB
Twig
Raw Normal View History

2025-07-12 12:03:40 +02:00
{% extends 'base.html.twig' %}
{% block title %}Évolutions des objets - {{ stats.name }}{% endblock %}
{% block body %}
<div class="container my-5">
<h1>Évolutions des objets à {{ stats.name }} ({{ stats.zone }})</h1>
<a href="{{ path('app_admin_stats', {'insee_code': stats.zone}) }}" class="btn btn-secondary mb-3"><i class="bi bi-arrow-left"></i> Retour aux stats</a>
<div class="card">
<div class="card-header">
<strong>Variation des décomptes d'objets par type</strong>
</div>
<div class="card-body">
<table class="table table-bordered table-striped table-hover table-responsive table-sort">
<thead>
<tr>
<th>Type</th>
<th>Décompte actuel</th>
{% for p in periods %}
<th>Évolution sur {{ p }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for type, evo in evolutions %}
<tr>
<td>{{ type }}</td>
<td>{{ evo.now }}</td>
{% for p in periods %}
<td>{% if evo[p] is not null %}{{ evo[p] > 0 ? '+' ~ evo[p] : evo[p] }}{% else %}<span class="text-muted">-</span>{% endif %}</td>
{% endfor %}
</tr>
{% else %}
<tr><td colspan="5" class="text-muted">Aucune donnée d'évolution trouvée.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="row mt-5">
<div class="col-md-4">
<h3>Lieux modifiés cette semaine</h3>
{% if places_7j|length > 0 %}
<ul class="list-group mb-4">
{% for place in places_7j %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>
<strong>
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': (place.name|default('sans-nom'))|url_encode, 'uuid': place.uuidForUrl}) }}">
{{ place.name ?: '(sans nom)' }}
</a>
</strong><br>
<small>
{% if place.street %}
<a href="{{ path('app_public_street', {'cityId': stats.zone, 'streetName': place.street|url_encode }) }}">{{ place.street }}</a>
{% else %}
<span class="text-muted">(inconnue)</span>
{% endif %}
{{ place.housenumber }}
</small>
</span>
<span>
<span class="badge bg-primary">{{ place.getModifiedDate() ? place.getModifiedDate()|date('Y-m-d H:i') : '' }}</span>
<a href="https://www.openstreetmap.org/{{ place.osmKind }}/{{ place.osmId }}" target="_blank" class="btn btn-outline-secondary btn-sm ms-2" title="Voir sur OSM"><i class="bi bi-globe"></i></a>
</span>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-muted">Aucun lieu modifié dans les 7 derniers jours.</p>
{% endif %}
</div>
<div class="col-md-4">
<h3>Ce mois-ci</h3>
{% if places_30j|length > 0 %}
<ul class="list-group mb-4">
{% for place in places_30j %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>
<strong>
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': (place.name|default('sans-nom'))|url_encode, 'uuid': place.uuidForUrl}) }}">
{{ place.name ?: '(sans nom)' }}
</a>
</strong><br>
<small>
{% if place.street %}
<a href="{{ path('app_public_street', {'cityId': stats.zone, 'streetName': place.street|url_encode }) }}">{{ place.street }}</a>
{% else %}
<span class="text-muted">(inconnue)</span>
{% endif %}
{{ place.housenumber }}
</small>
</span>
<span>
<span class="badge bg-primary">{{ place.getModifiedDate() ? place.getModifiedDate()|date('Y-m-d H:i') : '' }}</span>
<a href="https://www.openstreetmap.org/{{ place.osmKind }}/{{ place.osmId }}" target="_blank" class="btn btn-outline-secondary btn-sm ms-2" title="Voir sur OSM"><i class="bi bi-globe"></i></a>
</span>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-muted">Aucun lieu modifié dans les 30 derniers jours.</p>
{% endif %}
</div>
<div class="col-md-4">
<h3>6 derniers mois</h3>
{% if places_6mois|length > 0 %}
<ul class="list-group mb-4">
{% for place in places_6mois %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>
<strong>
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': (place.name|default('sans-nom'))|url_encode, 'uuid': place.uuidForUrl}) }}">
{{ place.name ?: '(sans nom)' }}
</a>
</strong><br>
<small>
{% if place.street %}
<a href="{{ path('app_public_street', {'cityId': stats.zone, 'streetName': place.street|url_encode }) }}">{{ place.street }}</a>
{% else %}
<span class="text-muted">(inconnue)</span>
{% endif %}
{{ place.housenumber }}
</small>
</span>
<span>
<span class="badge bg-primary">{{ place.getModifiedDate() ? place.getModifiedDate()|date('Y-m-d H:i') : '' }}</span>
<a href="https://www.openstreetmap.org/{{ place.osmKind }}/{{ place.osmId }}" target="_blank" class="btn btn-outline-secondary btn-sm ms-2" title="Voir sur OSM"><i class="bi bi-globe"></i></a>
</span>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-muted">Aucun lieu modifié dans les 6 derniers mois.</p>
{% endif %}
</div>
</div>
<script src="{{ asset('js/table-sortable.js') }}"></script>
<script>document.querySelectorAll('table.table-sort').forEach(t => window.TableSortable && TableSortable.initTable(t));</script>
</div>
{% endblock %}