osm-commerces/templates/admin/stats.html.twig

75 lines
3.3 KiB
Twig
Raw Normal View History

{% extends 'base.html.twig' %}
{% block title %}{{ 'display.stats'|trans }}{% endblock %}
{% block body %}
<div class="container">
2025-05-29 16:50:25 +02:00
<div class="mt-4 p-4">
<h1 class="title">{{ 'display.stats'|trans }}</h1>
<p>
{{ stats.zone }}
</p>
{{ stats.getCompletionPercent() }} % complété sur les critères donnés.
<br>
2025-05-29 16:50:25 +02:00
<i class="bi bi-building"></i> {{ stats.getPlacesCount() }} commerces dans la zone.
<br>
2025-05-29 16:50:25 +02:00
<i class="bi bi-clock"></i> {{ stats.getAvecHoraires() }} commerces avec horaires.
<br>
2025-05-29 16:50:25 +02:00
<i class="bi bi-map"></i> {{ stats.getAvecAdresse() }} commerces avec adresse.
<br>
2025-05-29 16:50:25 +02:00
<i class="bi bi-globe"></i> {{ stats.getAvecSite() }} commerces avec site web renseigné.
<br>
2025-05-29 16:50:25 +02:00
<i class="bi bi-wheelchair"></i> {{ stats.getAvecAccessibilite() }} commerces avec accessibilité renseignée.
<br>
2025-05-29 16:50:25 +02:00
<i class="bi bi-chat-dots"></i> {{ stats.getAvecNote() }} commerces avec note renseignée.
<br>
</div>
<div class="card mt-4">
<h1 class="card-title">Tableau des commerces</h1>
<table class="table table-bordered">
<thead>
<tr>
<th>Nom ({{ stats.getPlacesCount() }})</th>
<th>Adresse ({{ stats.getAvecAdresse() }} / {{ stats.getPlacesCount() }})</th>
<th>Site web ({{ stats.getAvecSite() }} / {{ stats.getPlacesCount() }})</th>
<th>Accessibilité ({{ stats.getAvecAccessibilite() }} / {{ stats.getPlacesCount() }})</th>
<th>Note ({{ stats.getAvecNote() }} / {{ stats.getPlacesCount() }})</th>
</tr>
</thead>
<tbody>
{% for commerce in stats.places %}
<tr>
2025-05-28 16:24:34 +02:00
<td style="background-color: {{ commerce.hasAddress() ? 'yellowgreen' : 'transparent' }};">
<a href="{{ path('app_admin_commerce', {'id': commerce.id}) }}">{{ commerce.name }}</a>
</td>
<td style="background-color: {{ commerce.hasAddress() ? 'yellowgreen' : 'transparent' }};">{{ commerce.address }}</td>
<td style="background-color: {{ commerce.hasWebsite() ? 'yellowgreen' : 'transparent' }};">{{ commerce.website }}</td>
<td style="background-color: {{ commerce.hasWheelchair() ? 'yellowgreen' : 'transparent' }};">{{ commerce.wheelchair }}</td>
<td style="background-color: {{ commerce.hasNote() ? 'yellowgreen' : 'transparent' }};">{{ commerce.note }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
2025-05-28 16:24:34 +02:00
<script>
document.addEventListener('DOMContentLoaded', function() {
const headers = document.querySelectorAll('th');
headers.forEach(header => {
const text = header.textContent;
const match = text.match(/\((\d+)\s*\/\s*(\d+)\)/);
if (match) {
const [_, completed, total] = match;
const ratio = completed / total;
const alpha = ratio.toFixed(2);
header.style.backgroundColor = `rgba(154, 205, 50, ${alpha})`;
}
});
});
</script>
<style>
</style>
{% endblock %}