conteneur de tableau long

This commit is contained in:
Tykayn 2025-06-29 10:22:24 +02:00 committed by tykayn
parent f50f2f87f5
commit 2ea7f7711f
3 changed files with 148 additions and 106 deletions

View file

@ -163,4 +163,11 @@ img {
table tbody {
max-height: 700px;
overflow: auto;
}
#table_container, .table-container, #table-container{
max-height: 700px;
overflow: auto;
display: block;
border: solid 3px rgb(255, 255, 255);
}

View file

@ -208,8 +208,35 @@
</a>
</div>
</div>
{# <input type="text" id="stats-table-search" class="form-control mb-2" placeholder="Filtrer les lieux..."> #}
<table id="stats-table" class="table table-bordered table-striped table-hover table-responsive table-sort">
<div id="table-container">
<div class="row mb-3">
<div class="col-md-6">
<div class="input-group">
<span class="input-group-text">
<i class="bi bi-search"></i>
</span>
<input type="text" id="stats-table-search" class="form-control" placeholder="Filtrer les lieux...">
</div>
</div>
<div class="col-md-6">
<div class="d-flex justify-content-end">
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-secondary" id="export-selected">
<i class="bi bi-download"></i> Exporter sélection
</button>
<button type="button" class="btn btn-outline-secondary" id="select-all">
<i class="bi bi-check-all"></i> Tout sélectionner
</button>
<button type="button" class="btn btn-outline-secondary" id="deselect-all">
<i class="bi bi-x-circle"></i> Désélectionner
</button>
</div>
</div>
</div>
</div>
</div>
<div id="table_container" class="table-container" >
<table id="stats-table" class="table table-bordered table-striped table-hover table-responsive table-sort">
{% include 'admin/stats/table-head.html.twig' %}
<tbody>
{% for commerce in stats.places %}
@ -217,6 +244,9 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card mt-4">
@ -224,54 +254,57 @@
<h2>Podium des contributeurs OSM de cette ville</h2>
</div>
<div class="card-body">
<table class="table table-striped table-bordered mt-4" style="max-width:800px">
<thead class="table-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Utilisateur OSM</th>
<th scope="col">Nombre de lieux</th>
<th scope="col">Score de complétion moyen</th>
<th scope="col">Score de complétion pondéré</th>
<th scope="col">Score pondéré normalisé (0-100)</th>
</tr>
</thead>
<tbody>
{% for row in podium_local %}
<div class="table-container" >
<table class="table table-striped table-bordered mt-4" style="max-width:800px">
<thead class="table-dark">
<tr>
<th scope="row">{{ loop.index }}</th>
<td>
<a href="https://www.openstreetmap.org/user/{{ row.osm_user|e('url') }}" target="_blank">
{{ row.osm_user }}
</a>
</td>
<td>{{ row.nb }}</td>
<td>
{% if row.completion_moyen is not null %}
{{ row.completion_moyen }}&nbsp;%
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if row.completion_pondere is not null %}
{{ row.completion_pondere }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if row.completion_pondere_normalisee is not null %}
{{ row.completion_pondere_normalisee }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<th scope="col">#</th>
<th scope="col">Utilisateur OSM</th>
<th scope="col">Nombre de lieux</th>
<th scope="col">Score de complétion moyen</th>
<th scope="col">Score de complétion pondéré</th>
<th scope="col">Score pondéré normalisé (0-100)</th>
</tr>
{% else %}
<tr><td colspan="6">Aucun contributeur trouvé pour cette ville.</td></tr>
{% endfor %}
</tbody>
</table>
</thead>
<tbody>
{% for row in podium_local %}
<tr>
<th scope="row">{{ loop.index }}</th>
<td>
<a href="https://www.openstreetmap.org/user/{{ row.osm_user|e('url') }}" target="_blank">
{{ row.osm_user }}
</a>
</td>
<td>{{ row.nb }}</td>
<td>
{% if row.completion_moyen is not null %}
{{ row.completion_moyen }}&nbsp;%
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if row.completion_pondere is not null %}
{{ row.completion_pondere }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if row.completion_pondere_normalisee is not null %}
{{ row.completion_pondere_normalisee }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
</tr>
{% else %}
<tr><td colspan="6">Aucun contributeur trouvé pour cette ville.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>

View file

@ -139,66 +139,68 @@
<div class="col-12">
<h2>Statistiques par ville</h2>
<input type="text" id="dashboard-table-search" class="form-control mb-2" placeholder="Filtrer les villes...">
<div class="table-responsive">
<table id="dashboard-table" class="table table-striped table-sort">
<thead>
<tr>
<th>Ville</th>
<th>Code postal</th>
<th>Complétion</th>
<th>Nombre de commerces</th>
<th>Lieux par habitants</th>
<th>Budget</th>
<th>Budget/habitant</th>
<th>Budget/lieu</th>
<th>Date moyenne de mise à jour</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for stat in stats_list %}
<div class="table-container" >
<div class="table-responsive">
<table id="dashboard-table" class="table table-striped table-sort">
<thead>
<tr>
<td><a href="{{ path('app_admin_stats', {'insee_code': stat.zone}) }}" title="Voir les statistiques de cette ville">
{{ stat.name }}
{% if not stat.name and stat.zone starts with '751' %}
Paris {{ stat.zone|slice(-2) }}e.
{% endif %}
</a></td>
<td>{{ stat.zone }}</td>
<td>{{ stat.completionPercent }}%</td>
<td>{{ stat.placesCount }}</td>
<td>{{ (stat.placesCount / (stat.population or 1 ))|round(2) }}</td>
<td>{% if stat.budgetAnnuel %}{{ (stat.budgetAnnuel / 1000000)|number_format(1, '.', ' ') }} M€{% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel and stat.population %}{{ (stat.budgetAnnuel / stat.population)|number_format(0, '.', ' ') }}{% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel and stat.placesCount %}{{ (stat.budgetAnnuel / stat.placesCount)|number_format(0, '.', ' ') }}{% else %}-{% endif %}</td>
<td>{{ stat.osmDataDateAvg|date('Y-m-d H:i') }}</td>
<td>
<div class="btn-group" role="group">
<a href="{{ path('app_admin_stats', {'insee_code': stat.zone}) }}" class="btn btn-sm btn-primary" title="Voir les statistiques de cette ville">
<i class="bi bi-eye"></i>
</a>
<a href="{{ path('app_admin_labourer', {'insee_code': stat.zone, 'deleteMissing': 1}) }}"
class="btn btn-sm btn-success btn-labourer"
data-zip-code="{{ stat.zone }}"
title="Labourer cette ville"
>
<i class="bi bi-recycle"></i>
</a>
<a href="{{ path('app_admin_delete_by_zone', {'insee_code': stat.zone}) }}"
class="btn btn-sm btn-danger"
onclick="return confirm('Êtes-vous sûr de vouloir supprimer cette zone ?')"
title="Supprimer cette ville"
>
<i class="bi bi-trash"></i>
</a>
</div>
</td>
<th>Ville</th>
<th>Code postal</th>
<th>Complétion</th>
<th>Nombre de commerces</th>
<th>Lieux par habitants</th>
<th>Budget</th>
<th>Budget/habitant</th>
<th>Budget/lieu</th>
<th>Date moyenne de mise à jour</th>
<th>Actions</th>
</tr>
{% endfor %}
</tbody>
</table>
</thead>
<tbody>
{% for stat in stats_list %}
<tr>
<td><a href="{{ path('app_admin_stats', {'insee_code': stat.zone}) }}" title="Voir les statistiques de cette ville">
{{ stat.name }}
{% if not stat.name and stat.zone starts with '751' %}
Paris {{ stat.zone|slice(-2) }}e.
{% endif %}
</a></td>
<td>{{ stat.zone }}</td>
<td>{{ stat.completionPercent }}%</td>
<td>{{ stat.placesCount }}</td>
<td>{{ (stat.placesCount / (stat.population or 1 ))|round(2) }}</td>
<td>{% if stat.budgetAnnuel %}{{ (stat.budgetAnnuel / 1000000)|number_format(1, '.', ' ') }} M€{% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel and stat.population %}{{ (stat.budgetAnnuel / stat.population)|number_format(0, '.', ' ') }}{% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel and stat.placesCount %}{{ (stat.budgetAnnuel / stat.placesCount)|number_format(0, '.', ' ') }}{% else %}-{% endif %}</td>
<td>{{ stat.osmDataDateAvg|date('Y-m-d H:i') }}</td>
<td>
<div class="btn-group" role="group">
<a href="{{ path('app_admin_stats', {'insee_code': stat.zone}) }}" class="btn btn-sm btn-primary" title="Voir les statistiques de cette ville">
<i class="bi bi-eye"></i>
</a>
<a href="{{ path('app_admin_labourer', {'insee_code': stat.zone, 'deleteMissing': 1}) }}"
class="btn btn-sm btn-success btn-labourer"
data-zip-code="{{ stat.zone }}"
title="Labourer cette ville"
>
<i class="bi bi-recycle"></i>
</a>
<a href="{{ path('app_admin_delete_by_zone', {'insee_code': stat.zone}) }}"
class="btn btn-sm btn-danger"
onclick="return confirm('Êtes-vous sûr de vouloir supprimer cette zone ?')"
title="Supprimer cette ville"
>
<i class="bi bi-trash"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>