arrondi completion sur ville

This commit is contained in:
Tykayn 2025-08-12 12:01:49 +02:00 committed by tykayn
parent 1659864efb
commit b9f57e48b5

View file

@ -13,35 +13,44 @@
stroke: #fff;
stroke-width: 3;
}
#distribution_completion {
height: 300px;
margin: 20px 0;
}
.completion-info {
margin-bottom: 2rem;
}
.osm-modification-info {
font-size: 0.85rem;
line-height: 1.3;
}
.osm-modification-info .text-muted {
font-size: 0.75rem;
}
.osm-modification-info a {
text-decoration: none;
color: #0d6efd;
}
.osm-modification-info a:hover {
text-decoration: underline;
}
.osm-freshness-info {
font-size: 0.95rem;
line-height: 1.4;
}
.osm-freshness-info .alert {
border-left: 4px solid #0dcaf0;
background-color: #f8f9fa;
}
.completion-badge {
display: inline-block;
width: 18px;
@ -51,14 +60,17 @@
border: 2px solid #fff;
box-shadow: 0 0 2px #888;
}
.completion-low {
background: #b2dfdb;
border-color: #009688;
}
.completion-medium {
background: #81c784;
border-color: #388e3c;
}
.completion-high {
background: #388e3c;
border-color: #1b5e20;
@ -87,27 +99,33 @@
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
.theme-row-scroll {
overflow-x: auto;
white-space: nowrap;
padding-bottom: 0.5rem;
}
.theme-row-scroll .col-auto {
display: inline-block;
float: none;
}
.theme-row-scroll .compact-theme-card {
display: inline-block;
vertical-align: top;
margin-right: 8px;
}
.tab-content {
margin-top: 1.5rem;
}
.table-theme th, .table-theme td {
vertical-align: middle;
font-size: 0.95em;
}
.table-theme th {
background: #f8f9fa;
}
@ -175,7 +193,8 @@
{% if stats.dateLabourageDone %}
<div class="alert alert-info">
Dernier labourage : {{ include('admin/_labourage_time_ago.html.twig', { date: stats.dateLabourageDone }) }}
Dernier labourage
: {{ include('admin/_labourage_time_ago.html.twig', { date: stats.dateLabourageDone }) }}
</div>
{% endif %}
@ -215,14 +234,21 @@
<h2 class="section-anchor">Thèmes</h2>
<ul class="nav nav-tabs" id="themeTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="tab-table" data-bs-toggle="tab" data-bs-target="#tabTableContent" type="button" role="tab" aria-controls="tabTableContent" aria-selected="true">Tableau</button>
<button class="nav-link active" id="tab-table" data-bs-toggle="tab"
data-bs-target="#tabTableContent" type="button" role="tab"
aria-controls="tabTableContent" aria-selected="true">Tableau
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="tab-cards" data-bs-toggle="tab" data-bs-target="#tabCardsContent" type="button" role="tab" aria-controls="tabCardsContent" aria-selected="false">Cartes</button>
<button class="nav-link" id="tab-cards" data-bs-toggle="tab"
data-bs-target="#tabCardsContent" type="button" role="tab"
aria-controls="tabCardsContent" aria-selected="false">Cartes
</button>
</li>
</ul>
<div class="tab-content" id="themeTabsContent">
<div class="tab-pane fade show active" id="tabTableContent" role="tabpanel" aria-labelledby="tab-table">
<div class="tab-pane fade show active" id="tabTableContent" role="tabpanel"
aria-labelledby="tab-table">
<table class="table table-theme">
<thead>
<tr>
@ -268,7 +294,9 @@
{{ followup_labels[type]|default(type|capitalize) }}
</td>
<td>{{ count is not null ? count : '?' }}</td>
<td><span class="completion-badge {{ completion_class }}"></span> {{ completion is not null ? completion ~ '%' : '?' }}</td>
<td>
<span class="completion-badge {{ completion_class }}"></span> {{ completion is not null ? completion ~ '%' : '?' }}
</td>
<td>
{% if progression7Days[type] is defined %}
{% set countDelta = progression7Days[type].count %}
@ -288,7 +316,10 @@
{% endif %}
</td>
<td>
<a href="{{ path('admin_followup_theme_graph', {'insee_code': stats.zone, 'theme': type}) }}" target="_blank" class="btn btn-sm btn-outline-primary" title="Voir le graphique">
<a href="{{ path('admin_followup_theme_graph', {'insee_code': stats.zone, 'theme': type}) }}"
target="_blank"
class="btn btn-sm btn-outline-primary"
title="Voir le graphique">
<i class="bi bi-graph-up"></i>
</a>
</td>
@ -298,7 +329,8 @@
</tbody>
</table>
</div>
<div class="tab-pane fade" id="tabCardsContent" role="tabpanel" aria-labelledby="tab-cards">
<div class="tab-pane fade" id="tabCardsContent" role="tabpanel"
aria-labelledby="tab-cards">
{% set all_types = followup_labels|keys %}
<div class="row">
{% for type in all_types %}
@ -316,26 +348,37 @@
{% endif %}
{% endif %}
<div class="col-auto">
<div class="card shadow-sm text-center compact-theme-card" style="min-width: 120px; max-width: 140px;">
<div class="card shadow-sm text-center compact-theme-card"
style="min-width: 120px; max-width: 140px;">
<div class="card-body p-2">
<div class="d-flex align-items-center justify-content-between mb-1">
<span class="completion-badge {{ completion_class }}"></span>
<i class="bi {{ followup_icons[type]|default('bi-question-circle') }} fs-4"></i>
</div>
<div class="theme-title mb-1">
<a href="https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}" target="_blank" class="fw-bold text-decoration-none text-dark small" title="Voir le JSON Overpass">
<a href="https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}"
target="_blank"
class="fw-bold text-decoration-none text-dark small"
title="Voir le JSON Overpass">
{{ followup_labels[type]|default(type|capitalize) }}
</a>
</div>
<div class="theme-stats small">
<span title="Nombre">{{ data and data.count is defined ? data.count.getMeasure() : '?' }}</span> |
<span title="Complétion">{{ completion is not null ? completion : '?' }}%</span>
<span title="Nombre">{{ data and data.count is defined ? data.count.getMeasure() : '?' }}</span>
|
<span title="Complétion">{{ completion is not null ? completion|round(1) : '?' }}%</span>
</div>
<div class="theme-actions mt-1">
<a href="{{ path('admin_followup_theme_graph', {'insee_code': stats.zone, 'theme': type}) }}" target="_blank" class="btn btn-sm btn-outline-primary btn-sm" title="Voir le graphique">
<a href="{{ path('admin_followup_theme_graph', {'insee_code': stats.zone, 'theme': type}) }}"
target="_blank"
class="btn btn-sm btn-outline-primary btn-sm"
title="Voir le graphique">
<i class="bi bi-graph-up"></i>
</a>
<a href="http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}" target="_blank" class="btn btn-sm btn-outline-dark btn-sm ms-1" title="Ouvrir dans JOSM">
<a href="http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}"
target="_blank"
class="btn btn-sm btn-outline-dark btn-sm ms-1"
title="Ouvrir dans JOSM">
<i class="bi bi-box-arrow-up-right"></i> JOSM
</a>
</div>
@ -348,7 +391,12 @@
{% for type in all_types %}
<div class="col-md-4 col-12 mb-2">
<span class="fw-bold">{{ followup_labels[type]|default(type|capitalize) }}</span>
<button class="btn btn-link p-0 ms-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-tags-{{ type }}" aria-expanded="false" aria-controls="collapse-tags-{{ type }}" title="Voir les critères de complétion">
<button class="btn btn-link p-0 ms-1" type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse-tags-{{ type }}"
aria-expanded="false"
aria-controls="collapse-tags-{{ type }}"
title="Voir les critères de complétion">
<i class="bi bi-question-circle"></i>
</button>
<div class="collapse mt-2" id="collapse-tags-{{ type }}">
@ -358,7 +406,8 @@
{% for tag in completion_tags[type] ?? [] %}
<li><code>{{ tag }}</code></li>
{% else %}
<li><span class="text-muted">Aucun critère défini</span></li>
<li><span class="text-muted">Aucun critère défini</span>
</li>
{% endfor %}
</ul>
</div>
@ -417,7 +466,6 @@
</div>
<div id="carte" class="section-anchor">
<h2>Carte</h2>
<div id="maploader">
@ -445,16 +493,19 @@
<h2>Graphiques</h2>
<div class="row">
<div class="col-md-6 col-12">
<canvas id="repartition_tags" width="600" height="400" style="max-width:100%; margin: 20px 0;"></canvas>
<canvas id="repartition_tags" width="600" height="400"
style="max-width:100%; margin: 20px 0;"></canvas>
</div>
<div class="col-md-6 col-12">
<div class="card">
<div class="card-header">
<i class="bi bi-calendar-event"></i> Fréquence des mises à jour par trimestre pour {{stats.name}}
<i class="bi bi-calendar-event"></i> Fréquence des mises à jour par
trimestre pour {{ stats.name }}
</div>
<div class="card-body">
<canvas id="modificationsByQuarterChart" style="min-height: 250px; width: 100%;"></canvas>
<canvas id="modificationsByQuarterChart"
style="min-height: 250px; width: 100%;"></canvas>
</div>
</div>
</div>
@ -473,15 +524,18 @@
<div class="row" id="lieux">
<div class="col-md-6 col-12">
<h1 class="card-title p-4 section-anchor">Tableau des {{ stats.places |length }} lieux</h1>
<h1 class="card-title p-4 section-anchor">Tableau des {{ stats.places |length }}
lieux</h1>
</div>
<div class="col-md-6 col-12">
<div class="btn-group mt-4" role="group">
<a href="{{ path('app_admin_export_overpass_csv', {'insee_code': stats.zone}) }}" class="btn btn-primary">
<a href="{{ path('app_admin_export_overpass_csv', {'insee_code': stats.zone}) }}"
class="btn btn-primary">
<i class="bi bi-filetype-csv"></i>
Export Overpass CSV
</a>
<a href="{{ path('app_admin_export_table_csv', {'insee_code': stats.zone}) }}" class="btn btn-success">
<a href="{{ path('app_admin_export_table_csv', {'insee_code': stats.zone}) }}"
class="btn btn-success">
<i class="bi bi-table"></i>
Export Tableau CSV
</a>
@ -490,7 +544,8 @@
</div>
<div id="table_container" class="table-container">
<table id="stats-table" class="table table-bordered table-striped table-hover table-responsive table-sort">
<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 %}
@ -554,7 +609,9 @@
</td>
</tr>
{% else %}
<tr><td colspan="6">Aucun contributeur trouvé pour cette ville.</td></tr>
<tr>
<td colspan="6">Aucun contributeur trouvé pour cette ville.</td>
</tr>
{% endfor %}
</tbody>
</table>
@ -680,17 +737,21 @@
// Correction : toujours un tableau
f.properties.missing_tags = Array.isArray(f.properties.missing_tags) ? f.properties.missing_tags : (f.properties.missing_tags ? [f.properties.missing_tags] : []);
});
// Fonction de couleur dégradée
function lerpColor(a, b, t) {
const ah = a.replace('#', '');
const bh = b.replace('#', '');
const ar = parseInt(ah.substring(0,2), 16), ag = parseInt(ah.substring(2,4), 16), ab = parseInt(ah.substring(4,6), 16);
const br = parseInt(bh.substring(0,2), 16), bg = parseInt(bh.substring(2,4), 16), bb = parseInt(bh.substring(4,6), 16);
const ar = parseInt(ah.substring(0, 2), 16), ag = parseInt(ah.substring(2, 4), 16),
ab = parseInt(ah.substring(4, 6), 16);
const br = parseInt(bh.substring(0, 2), 16), bg = parseInt(bh.substring(2, 4), 16),
bb = parseInt(bh.substring(4, 6), 16);
const rr = Math.round(ar + (br - ar) * t);
const rg = Math.round(ag + (bg - ag) * t);
const rb = Math.round(ab + (bb - ab) * t);
return '#' + rr.toString(16).padStart(2, '0') + rg.toString(16).padStart(2, '0') + rb.toString(16).padStart(2, '0');
}
let map;
let map_is_loaded = false;
let currentMode = 'drop';
@ -877,7 +938,8 @@
const place_nodes = [];
const place_ways = [];
const place_relations = [];
const places = {{ geojson|raw }}.features;
const places = {{ geojson|raw }}.
features;
places.forEach(place => {
if (
place.properties.getOsmKind() === 'node'
@ -898,7 +960,13 @@
(place_relations.length > 0 ? 'relation(id:' + place_relations.join(',') + ');\n' : '') +
'(._;>;);\nout meta;';
const url = 'http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data=' + encodeURIComponent(overpass_josm_query);
openInJOSM(map, map_is_loaded, [{osm_id: place_nodes.join(','), osm_type: 'node'}, {osm_id: place_ways.join(','), osm_type: 'way'}, {osm_id: place_relations.join(','), osm_type: 'relation'}], url);
openInJOSM(map, map_is_loaded, [{
osm_id: place_nodes.join(','),
osm_type: 'node'
}, {osm_id: place_ways.join(','), osm_type: 'way'}, {
osm_id: place_relations.join(','),
osm_type: 'relation'
}], url);
});
}
@ -939,7 +1007,8 @@
// Créer un graphique de la répartition des tags
const tagsCount = {};
const places = {{ geojson|raw }}.features;
const places = {{ geojson|raw }}.
features;
places.forEach(place => {
const mainTag = place.properties.main_tag;
@ -1128,7 +1197,12 @@ if(dc){
id: 'geo-marker',
type: 'circle',
source: 'geo-marker',
paint: { 'circle-radius': 10, 'circle-color': '#007bff', 'circle-stroke-width': 2, 'circle-stroke-color': '#fff' }
paint: {
'circle-radius': 10,
'circle-color': '#007bff',
'circle-stroke-width': 2,
'circle-stroke-color': '#fff'
}
});
window._geoMarker = true;
window._geoMarkerSource = true;