mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
arrondi completion sur ville
This commit is contained in:
parent
1659864efb
commit
b9f57e48b5
1 changed files with 1030 additions and 956 deletions
|
@ -5,43 +5,52 @@
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
<link href='{{ asset('js/maplibre/maplibre-gl.css') }}' rel='stylesheet' />
|
<link href='{{ asset('js/maplibre/maplibre-gl.css') }}' rel='stylesheet'/>
|
||||||
<link href='{{ asset('css/city-sidebar.css') }}' rel='stylesheet' />
|
<link href='{{ asset('css/city-sidebar.css') }}' rel='stylesheet'/>
|
||||||
<style>
|
<style>
|
||||||
.completion-circle {
|
.completion-circle {
|
||||||
fill-opacity: 0.6;
|
fill-opacity: 0.6;
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
stroke-width: 3;
|
stroke-width: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#distribution_completion {
|
#distribution_completion {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.completion-info {
|
.completion-info {
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osm-modification-info {
|
.osm-modification-info {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osm-modification-info .text-muted {
|
.osm-modification-info .text-muted {
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osm-modification-info a {
|
.osm-modification-info a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #0d6efd;
|
color: #0d6efd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osm-modification-info a:hover {
|
.osm-modification-info a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osm-freshness-info {
|
.osm-freshness-info {
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osm-freshness-info .alert {
|
.osm-freshness-info .alert {
|
||||||
border-left: 4px solid #0dcaf0;
|
border-left: 4px solid #0dcaf0;
|
||||||
background-color: #f8f9fa;
|
background-color: #f8f9fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.completion-badge {
|
.completion-badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 18px;
|
width: 18px;
|
||||||
|
@ -51,14 +60,17 @@
|
||||||
border: 2px solid #fff;
|
border: 2px solid #fff;
|
||||||
box-shadow: 0 0 2px #888;
|
box-shadow: 0 0 2px #888;
|
||||||
}
|
}
|
||||||
|
|
||||||
.completion-low {
|
.completion-low {
|
||||||
background: #b2dfdb;
|
background: #b2dfdb;
|
||||||
border-color: #009688;
|
border-color: #009688;
|
||||||
}
|
}
|
||||||
|
|
||||||
.completion-medium {
|
.completion-medium {
|
||||||
background: #81c784;
|
background: #81c784;
|
||||||
border-color: #388e3c;
|
border-color: #388e3c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.completion-high {
|
.completion-high {
|
||||||
background: #388e3c;
|
background: #388e3c;
|
||||||
border-color: #1b5e20;
|
border-color: #1b5e20;
|
||||||
|
@ -70,7 +82,7 @@
|
||||||
|
|
||||||
.compact-theme-card:hover {
|
.compact-theme-card:hover {
|
||||||
transform: translateY(-2px);
|
transform: translateY(-2px);
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-title a {
|
.theme-title a {
|
||||||
|
@ -87,27 +99,33 @@
|
||||||
padding: 0.25rem 0.5rem;
|
padding: 0.25rem 0.5rem;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-row-scroll {
|
.theme-row-scroll {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-row-scroll .col-auto {
|
.theme-row-scroll .col-auto {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-row-scroll .compact-theme-card {
|
.theme-row-scroll .compact-theme-card {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-content {
|
.tab-content {
|
||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-theme th, .table-theme td {
|
.table-theme th, .table-theme td {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-theme th {
|
.table-theme th {
|
||||||
background: #f8f9fa;
|
background: #f8f9fa;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +134,7 @@
|
||||||
|
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Sidebar de navigation -->
|
<!-- Sidebar de navigation -->
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
@ -175,16 +193,17 @@
|
||||||
|
|
||||||
{% if stats.dateLabourageDone %}
|
{% if stats.dateLabourageDone %}
|
||||||
<div class="alert alert-info">
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div id="followups">
|
<div id="followups">
|
||||||
|
|
||||||
|
|
||||||
{% set overpass_type_queries = {
|
{% set overpass_type_queries = {
|
||||||
'fire_hydrant': 'nwr["emergency"="fire_hydrant"](area.searchArea);',
|
'fire_hydrant': 'nwr["emergency"="fire_hydrant"](area.searchArea);',
|
||||||
'charging_station': 'nwr["amenity"="charging_station"](area.searchArea);',
|
'charging_station': 'nwr["amenity"="charging_station"](area.searchArea);',
|
||||||
'bicycle_parking' : 'nwr["amenity"="bicycle_parking"](area.searchArea);',
|
'bicycle_parking' : 'nwr["amenity"="bicycle_parking"](area.searchArea);',
|
||||||
|
@ -199,30 +218,37 @@
|
||||||
'police': 'nwr["amenity"="police"](area.searchArea);',
|
'police': 'nwr["amenity"="police"](area.searchArea);',
|
||||||
'drinking_water' : 'nwr["amenity"="drinking_water"](area.searchArea);',
|
'drinking_water' : 'nwr["amenity"="drinking_water"](area.searchArea);',
|
||||||
'healthcare': 'nwr["healthcare"](area.searchArea);nwr["amenity"="doctors"](area.searchArea);nwr["amenity"="pharmacy"](area.searchArea);nwr["amenity"="hospital"](area.searchArea);nwr["amenity"="clinic"](area.searchArea);nwr["amenity"="social_facility"](area.searchArea);'
|
'healthcare': 'nwr["healthcare"](area.searchArea);nwr["amenity"="doctors"](area.searchArea);nwr["amenity"="pharmacy"](area.searchArea);nwr["amenity"="hospital"](area.searchArea);nwr["amenity"="clinic"](area.searchArea);nwr["amenity"="social_facility"](area.searchArea);'
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{% set theme_groups = {
|
{% set theme_groups = {
|
||||||
'emergency': ['fire_hydrant', 'defibrillator'],
|
'emergency': ['fire_hydrant', 'defibrillator'],
|
||||||
'transport': ['bus_stop', 'charging_station', 'bicycle_parking'],
|
'transport': ['bus_stop', 'charging_station', 'bicycle_parking'],
|
||||||
'healthcare': ['healthcare', 'laboratory', 'drinking_water'],
|
'healthcare': ['healthcare', 'laboratory', 'drinking_water'],
|
||||||
'education': ['school'],
|
'education': ['school'],
|
||||||
'security': ['police', 'camera'],
|
'security': ['police', 'camera'],
|
||||||
'infrastructure': ['toilets', 'recycling', 'substation']
|
'infrastructure': ['toilets', 'recycling', 'substation']
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
<div class="row mb-4" id="themes">
|
<div class="row mb-4" id="themes">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h2 class="section-anchor">Thèmes</h2>
|
<h2 class="section-anchor">Thèmes</h2>
|
||||||
<ul class="nav nav-tabs" id="themeTabs" role="tablist">
|
<ul class="nav nav-tabs" id="themeTabs" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<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>
|
||||||
<li class="nav-item" role="presentation">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content" id="themeTabsContent">
|
<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">
|
<table class="table table-theme">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -268,7 +294,9 @@
|
||||||
{{ followup_labels[type]|default(type|capitalize) }}
|
{{ followup_labels[type]|default(type|capitalize) }}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ count is not null ? count : '?' }}</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>
|
<td>
|
||||||
{% if progression7Days[type] is defined %}
|
{% if progression7Days[type] is defined %}
|
||||||
{% set countDelta = progression7Days[type].count %}
|
{% set countDelta = progression7Days[type].count %}
|
||||||
|
@ -288,7 +316,10 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<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>
|
<i class="bi bi-graph-up"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -298,7 +329,8 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</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 %}
|
{% set all_types = followup_labels|keys %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for type in all_types %}
|
{% for type in all_types %}
|
||||||
|
@ -316,26 +348,37 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="col-auto">
|
<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="card-body p-2">
|
||||||
<div class="d-flex align-items-center justify-content-between mb-1">
|
<div class="d-flex align-items-center justify-content-between mb-1">
|
||||||
<span class="completion-badge {{ completion_class }}"></span>
|
<span class="completion-badge {{ completion_class }}"></span>
|
||||||
<i class="bi {{ followup_icons[type]|default('bi-question-circle') }} fs-4"></i>
|
<i class="bi {{ followup_icons[type]|default('bi-question-circle') }} fs-4"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-title mb-1">
|
<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) }}
|
{{ followup_labels[type]|default(type|capitalize) }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-stats small">
|
<div class="theme-stats small">
|
||||||
<span title="Nombre">{{ data and data.count is defined ? data.count.getMeasure() : '?' }}</span> |
|
<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="Complétion">{{ completion is not null ? completion|round(1) : '?' }}%</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-actions mt-1">
|
<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>
|
<i class="bi bi-graph-up"></i>
|
||||||
</a>
|
</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
|
<i class="bi bi-box-arrow-up-right"></i> JOSM
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -348,7 +391,12 @@
|
||||||
{% for type in all_types %}
|
{% for type in all_types %}
|
||||||
<div class="col-md-4 col-12 mb-2">
|
<div class="col-md-4 col-12 mb-2">
|
||||||
<span class="fw-bold">{{ followup_labels[type]|default(type|capitalize) }}</span>
|
<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>
|
<i class="bi bi-question-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="collapse mt-2" id="collapse-tags-{{ type }}">
|
<div class="collapse mt-2" id="collapse-tags-{{ type }}">
|
||||||
|
@ -358,7 +406,8 @@
|
||||||
{% for tag in completion_tags[type] ?? [] %}
|
{% for tag in completion_tags[type] ?? [] %}
|
||||||
<li><code>{{ tag }}</code></li>
|
<li><code>{{ tag }}</code></li>
|
||||||
{% else %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -369,7 +418,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-12">
|
<div class="col-md-3 col-12">
|
||||||
|
@ -380,7 +429,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-12">
|
<div class="col-md-3 col-12">
|
||||||
<span class="badge bg-primary">
|
<span class="badge bg-primary">
|
||||||
<i class="bi bi-building"></i> {{ stats.places | length}}
|
<i class="bi bi-building"></i> {{ stats.places | length }}
|
||||||
</span>lieux dans la zone.
|
</span>lieux dans la zone.
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-12">
|
<div class="col-md-3 col-12">
|
||||||
|
@ -417,7 +466,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="carte" class="section-anchor">
|
<div id="carte" class="section-anchor">
|
||||||
<h2>Carte</h2>
|
<h2>Carte</h2>
|
||||||
<div id="maploader">
|
<div id="maploader">
|
||||||
|
@ -445,16 +493,19 @@
|
||||||
<h2>Graphiques</h2>
|
<h2>Graphiques</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<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>
|
||||||
|
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<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>
|
||||||
<div class="card-body">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -473,15 +524,18 @@
|
||||||
|
|
||||||
<div class="row" id="lieux">
|
<div class="row" id="lieux">
|
||||||
<div class="col-md-6 col-12">
|
<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>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<div class="btn-group mt-4" role="group">
|
<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>
|
<i class="bi bi-filetype-csv"></i>
|
||||||
Export Overpass CSV
|
Export Overpass CSV
|
||||||
</a>
|
</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>
|
<i class="bi bi-table"></i>
|
||||||
Export Tableau CSV
|
Export Tableau CSV
|
||||||
</a>
|
</a>
|
||||||
|
@ -489,8 +543,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="table_container" class="table-container" >
|
<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' %}
|
{% include 'admin/stats/table-head.html.twig' %}
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for commerce in stats.places %}
|
{% for commerce in stats.places %}
|
||||||
|
@ -508,7 +563,7 @@
|
||||||
<h2>Podium des contributeurs OSM de cette ville</h2>
|
<h2>Podium des contributeurs OSM de cette ville</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="table-container" >
|
<div class="table-container">
|
||||||
|
|
||||||
<table class="table table-striped table-bordered mt-4" style="max-width:800px">
|
<table class="table table-striped table-bordered mt-4" style="max-width:800px">
|
||||||
<thead class="table-dark">
|
<thead class="table-dark">
|
||||||
|
@ -526,7 +581,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ loop.index }}</th>
|
<th scope="row">{{ loop.index }}</th>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.openstreetmap.org/user/{{ row.osm_user|e('url') }}" >
|
<a href="https://www.openstreetmap.org/user/{{ row.osm_user|e('url') }}">
|
||||||
{{ row.osm_user }}
|
{{ row.osm_user }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -554,7 +609,9 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -605,8 +662,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Espace de dump JSON -->
|
<!-- Espace de dump JSON -->
|
||||||
<div id="ctc-json-dump-container" class="mt-4" style="display:none;">
|
<div id="ctc-json-dump-container" class="mt-4" style="display:none;">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header p-2">
|
<div class="card-header p-2">
|
||||||
<i class="bi bi-file-earmark-code"></i> Dump du JSON récupéré
|
<i class="bi bi-file-earmark-code"></i> Dump du JSON récupéré
|
||||||
|
@ -615,7 +672,7 @@
|
||||||
<pre id="ctc-json-dump" style="max-height:400px;overflow:auto;"></pre>
|
<pre id="ctc-json-dump" style="max-height:400px;overflow:auto;"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3 ctc-tests">
|
<div class="mt-3 ctc-tests">
|
||||||
<div class="card ctc-tests">
|
<div class="card ctc-tests">
|
||||||
|
@ -646,11 +703,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ctc-json-error" class="alert alert-danger mt-4" style="display:none;"></div>
|
<div id="ctc-json-error" class="alert alert-danger mt-4" style="display:none;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -658,7 +715,7 @@
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const geojsonData = {{ geojson|raw }};
|
const geojsonData = {{ geojson|raw }};
|
||||||
const map_token = "{{ maptiler_token }}";
|
const map_token = "{{ maptiler_token }}";
|
||||||
// Liste des tags attendus pour la complétion des lieux
|
// Liste des tags attendus pour la complétion des lieux
|
||||||
|
@ -680,23 +737,27 @@
|
||||||
// Correction : toujours un tableau
|
// 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] : []);
|
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
|
// Fonction de couleur dégradée
|
||||||
function lerpColor(a, b, t) {
|
function lerpColor(a, b, t) {
|
||||||
const ah = a.replace('#', '');
|
const ah = a.replace('#', '');
|
||||||
const bh = b.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 ar = parseInt(ah.substring(0, 2), 16), ag = parseInt(ah.substring(2, 4), 16),
|
||||||
const br = parseInt(bh.substring(0,2), 16), bg = parseInt(bh.substring(2,4), 16), bb = parseInt(bh.substring(4,6), 16);
|
ab = parseInt(ah.substring(4, 6), 16);
|
||||||
const rr = Math.round(ar + (br-ar)*t);
|
const br = parseInt(bh.substring(0, 2), 16), bg = parseInt(bh.substring(2, 4), 16),
|
||||||
const rg = Math.round(ag + (bg-ag)*t);
|
bb = parseInt(bh.substring(4, 6), 16);
|
||||||
const rb = Math.round(ab + (bb-ab)*t);
|
const rr = Math.round(ar + (br - ar) * t);
|
||||||
return '#' + rr.toString(16).padStart(2,'0') + rg.toString(16).padStart(2,'0') + rb.toString(16).padStart(2,'0');
|
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;
|
||||||
let map_is_loaded = false;
|
let map_is_loaded = false;
|
||||||
let currentMode = 'drop';
|
let currentMode = 'drop';
|
||||||
|
|
||||||
// Fonction pour mettre à jour le style des marqueurs
|
// Fonction pour mettre à jour le style des marqueurs
|
||||||
window.updateMarkers = function(mode) {
|
window.updateMarkers = function (mode) {
|
||||||
currentMode = mode;
|
currentMode = mode;
|
||||||
// Mettre à jour l'état visuel des boutons
|
// Mettre à jour l'état visuel des boutons
|
||||||
document.getElementById('circleMarkersBtn').classList.toggle('active', mode === 'circle');
|
document.getElementById('circleMarkersBtn').classList.toggle('active', mode === 'circle');
|
||||||
|
@ -762,7 +823,7 @@
|
||||||
zoom: 14
|
zoom: 14
|
||||||
});
|
});
|
||||||
window.mapInstance = map;
|
window.mapInstance = map;
|
||||||
map.on('load', function() {
|
map.on('load', function () {
|
||||||
map_is_loaded = true;
|
map_is_loaded = true;
|
||||||
document.getElementById('maploader').style.display = 'none';
|
document.getElementById('maploader').style.display = 'none';
|
||||||
|
|
||||||
|
@ -811,18 +872,18 @@
|
||||||
window.updateMarkers('drop');
|
window.updateMarkers('drop');
|
||||||
|
|
||||||
// Listeners boutons
|
// Listeners boutons
|
||||||
document.getElementById('circleMarkersBtn').addEventListener('click', function() {
|
document.getElementById('circleMarkersBtn').addEventListener('click', function () {
|
||||||
window.updateMarkers('circle');
|
window.updateMarkers('circle');
|
||||||
});
|
});
|
||||||
document.getElementById('dropMarkersBtn').addEventListener('click', function() {
|
document.getElementById('dropMarkersBtn').addEventListener('click', function () {
|
||||||
window.updateMarkers('drop');
|
window.updateMarkers('drop');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Popups et clusters (inchangé)
|
// Popups et clusters (inchangé)
|
||||||
map.on('click', 'clusters', function(e) {
|
map.on('click', 'clusters', function (e) {
|
||||||
const features = map.queryRenderedFeatures(e.point, { layers: ['clusters'] });
|
const features = map.queryRenderedFeatures(e.point, {layers: ['clusters']});
|
||||||
const clusterId = features[0].properties.cluster_id;
|
const clusterId = features[0].properties.cluster_id;
|
||||||
map.getSource('places').getClusterExpansionZoom(clusterId, function(err, zoom) {
|
map.getSource('places').getClusterExpansionZoom(clusterId, function (err, zoom) {
|
||||||
if (err) return;
|
if (err) return;
|
||||||
map.easeTo({
|
map.easeTo({
|
||||||
center: features[0].geometry.coordinates,
|
center: features[0].geometry.coordinates,
|
||||||
|
@ -831,7 +892,7 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
map.on('click', 'unclustered-point', function(e) {
|
map.on('click', 'unclustered-point', function (e) {
|
||||||
const coordinates = e.features[0].geometry.coordinates.slice();
|
const coordinates = e.features[0].geometry.coordinates.slice();
|
||||||
const properties = e.features[0].properties;
|
const properties = e.features[0].properties;
|
||||||
|
|
||||||
|
@ -856,10 +917,10 @@
|
||||||
.addTo(map);
|
.addTo(map);
|
||||||
});
|
});
|
||||||
|
|
||||||
map.on('mouseenter', 'clusters', function() {
|
map.on('mouseenter', 'clusters', function () {
|
||||||
map.getCanvas().style.cursor = 'pointer';
|
map.getCanvas().style.cursor = 'pointer';
|
||||||
});
|
});
|
||||||
map.on('mouseleave', 'clusters', function() {
|
map.on('mouseleave', 'clusters', function () {
|
||||||
map.getCanvas().style.cursor = '';
|
map.getCanvas().style.cursor = '';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -877,7 +938,8 @@
|
||||||
const place_nodes = [];
|
const place_nodes = [];
|
||||||
const place_ways = [];
|
const place_ways = [];
|
||||||
const place_relations = [];
|
const place_relations = [];
|
||||||
const places = {{ geojson|raw }}.features;
|
const places = {{ geojson|raw }}.
|
||||||
|
features;
|
||||||
places.forEach(place => {
|
places.forEach(place => {
|
||||||
if (
|
if (
|
||||||
place.properties.getOsmKind() === 'node'
|
place.properties.getOsmKind() === 'node'
|
||||||
|
@ -898,7 +960,13 @@
|
||||||
(place_relations.length > 0 ? 'relation(id:' + place_relations.join(',') + ');\n' : '') +
|
(place_relations.length > 0 ? 'relation(id:' + place_relations.join(',') + ');\n' : '') +
|
||||||
'(._;>;);\nout meta;';
|
'(._;>;);\nout meta;';
|
||||||
const url = 'http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data=' + encodeURIComponent(overpass_josm_query);
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,12 +991,12 @@
|
||||||
options: {
|
options: {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: { display: false },
|
legend: {display: false},
|
||||||
title: { display: true, text: 'Fréquence des mises à jour par trimestre' }
|
title: {display: true, text: 'Fréquence des mises à jour par trimestre'}
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
y: { beginAtZero: true, title: { display: true, text: 'Nombre de lieux' } },
|
y: {beginAtZero: true, title: {display: true, text: 'Nombre de lieux'}},
|
||||||
x: { title: { display: true, text: 'Trimestre' } }
|
x: {title: {display: true, text: 'Trimestre'}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,7 +1007,8 @@
|
||||||
|
|
||||||
// Créer un graphique de la répartition des tags
|
// Créer un graphique de la répartition des tags
|
||||||
const tagsCount = {};
|
const tagsCount = {};
|
||||||
const places = {{ geojson|raw }}.features;
|
const places = {{ geojson|raw }}.
|
||||||
|
features;
|
||||||
|
|
||||||
places.forEach(place => {
|
places.forEach(place => {
|
||||||
const mainTag = place.properties.main_tag;
|
const mainTag = place.properties.main_tag;
|
||||||
|
@ -951,15 +1020,15 @@
|
||||||
const sortedTags = Object.entries(tagsCount).sort(([, a], [, b]) => b - a);
|
const sortedTags = Object.entries(tagsCount).sort(([, a], [, b]) => b - a);
|
||||||
const labels = sortedTags.map(item => item[0]);
|
const labels = sortedTags.map(item => item[0]);
|
||||||
const data = sortedTags.map(item => item[1]);
|
const data = sortedTags.map(item => item[1]);
|
||||||
const container_tags= document.getElementById('repartition_tags');
|
const container_tags = document.getElementById('repartition_tags');
|
||||||
|
|
||||||
console.log('répartition', tagsCount, container_tags)
|
console.log('répartition', tagsCount, container_tags)
|
||||||
if(!container_tags){
|
if (!container_tags) {
|
||||||
console.log('pas de container_tags', container_tags)
|
console.log('pas de container_tags', container_tags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ctx = container_tags.getContext ? container_tags.getContext('2d') : null;
|
const ctx = container_tags.getContext ? container_tags.getContext('2d') : null;
|
||||||
if(ctx){
|
if (ctx) {
|
||||||
new Chart(ctx, {
|
new Chart(ctx, {
|
||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: {
|
data: {
|
||||||
|
@ -1020,11 +1089,11 @@
|
||||||
return parseInt(a.split('-')[0]) - parseInt(b.split('-')[0]);
|
return parseInt(a.split('-')[0]) - parseInt(b.split('-')[0]);
|
||||||
});
|
});
|
||||||
const completionValues = completionLabels.map(label => completionDistribution[label]);
|
const completionValues = completionLabels.map(label => completionDistribution[label]);
|
||||||
const dc = document.getElementById('distribution_completion');
|
const dc = document.getElementById('distribution_completion');
|
||||||
|
|
||||||
if(dc){
|
if (dc) {
|
||||||
const completionCtx = dc.getContext ? dc.getContext('2d') : null;
|
const completionCtx = dc.getContext ? dc.getContext('2d') : null;
|
||||||
if(!completionCtx){
|
if (!completionCtx) {
|
||||||
console.log('pas de completionCtx');
|
console.log('pas de completionCtx');
|
||||||
} else {
|
} else {
|
||||||
new Chart(completionCtx, {
|
new Chart(completionCtx, {
|
||||||
|
@ -1058,26 +1127,26 @@ if(dc){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('pas de distribution_completion');
|
console.log('pas de distribution_completion');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const trigger = document.querySelector('.completion-hover-trigger');
|
const trigger = document.querySelector('.completion-hover-trigger');
|
||||||
const content = document.getElementById('completionInfoContent');
|
const content = document.getElementById('completionInfoContent');
|
||||||
const icon = document.getElementById('completionInfoIcon');
|
const icon = document.getElementById('completionInfoIcon');
|
||||||
if (trigger && content) {
|
if (trigger && content) {
|
||||||
trigger.addEventListener('mouseenter', function() {
|
trigger.addEventListener('mouseenter', function () {
|
||||||
content.style.display = 'block';
|
content.style.display = 'block';
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.classList.remove('bi-chevron-down');
|
icon.classList.remove('bi-chevron-down');
|
||||||
icon.classList.add('bi-chevron-up');
|
icon.classList.add('bi-chevron-up');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
trigger.addEventListener('mouseleave', function() {
|
trigger.addEventListener('mouseleave', function () {
|
||||||
content.style.display = 'none';
|
content.style.display = 'none';
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.classList.remove('bi-chevron-up');
|
icon.classList.remove('bi-chevron-up');
|
||||||
|
@ -1085,10 +1154,10 @@ if(dc){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Pour garder la popup ouverte si la souris va sur la popup
|
// Pour garder la popup ouverte si la souris va sur la popup
|
||||||
content.addEventListener('mouseenter', function() {
|
content.addEventListener('mouseenter', function () {
|
||||||
content.style.display = 'block';
|
content.style.display = 'block';
|
||||||
});
|
});
|
||||||
content.addEventListener('mouseleave', function() {
|
content.addEventListener('mouseleave', function () {
|
||||||
content.style.display = 'none';
|
content.style.display = 'none';
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.classList.remove('bi-chevron-up');
|
icon.classList.remove('bi-chevron-up');
|
||||||
|
@ -1099,9 +1168,9 @@ if(dc){
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const btn = document.getElementById('btn-geolocate');
|
const btn = document.getElementById('btn-geolocate');
|
||||||
btn && btn.addEventListener('click', function() {
|
btn && btn.addEventListener('click', function () {
|
||||||
console.log('[GEOLOC] Bouton cliqué');
|
console.log('[GEOLOC] Bouton cliqué');
|
||||||
if (!navigator.geolocation) {
|
if (!navigator.geolocation) {
|
||||||
alert('La géolocalisation n\'est pas supportée par ce navigateur.');
|
alert('La géolocalisation n\'est pas supportée par ce navigateur.');
|
||||||
|
@ -1110,7 +1179,7 @@ if(dc){
|
||||||
}
|
}
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Localisation...';
|
btn.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Localisation...';
|
||||||
navigator.geolocation.getCurrentPosition(function(pos) {
|
navigator.geolocation.getCurrentPosition(function (pos) {
|
||||||
const lat = pos.coords.latitude;
|
const lat = pos.coords.latitude;
|
||||||
const lon = pos.coords.longitude;
|
const lon = pos.coords.longitude;
|
||||||
console.log('[GEOLOC] Position obtenue', lat, lon);
|
console.log('[GEOLOC] Position obtenue', lat, lon);
|
||||||
|
@ -1122,13 +1191,18 @@ if(dc){
|
||||||
if (window._geoMarkerSource) window.mapInstance.removeSource('geo-marker');
|
if (window._geoMarkerSource) window.mapInstance.removeSource('geo-marker');
|
||||||
window.mapInstance.addSource('geo-marker', {
|
window.mapInstance.addSource('geo-marker', {
|
||||||
type: 'geojson',
|
type: 'geojson',
|
||||||
data: { type: 'Feature', geometry: { type: 'Point', coordinates: [lon, lat] } }
|
data: {type: 'Feature', geometry: {type: 'Point', coordinates: [lon, lat]}}
|
||||||
});
|
});
|
||||||
window.mapInstance.addLayer({
|
window.mapInstance.addLayer({
|
||||||
id: 'geo-marker',
|
id: 'geo-marker',
|
||||||
type: 'circle',
|
type: 'circle',
|
||||||
source: 'geo-marker',
|
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._geoMarker = true;
|
||||||
window._geoMarkerSource = true;
|
window._geoMarkerSource = true;
|
||||||
|
@ -1137,7 +1211,7 @@ if(dc){
|
||||||
}
|
}
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
btn.innerHTML = '<i class="bi bi-geo-alt"></i> Me localiser';
|
btn.innerHTML = '<i class="bi bi-geo-alt"></i> Me localiser';
|
||||||
}, function(err) {
|
}, function (err) {
|
||||||
alert('Impossible de vous localiser : ' + err.message);
|
alert('Impossible de vous localiser : ' + err.message);
|
||||||
console.error('[GEOLOC] Erreur de géolocalisation', err);
|
console.error('[GEOLOC] Erreur de géolocalisation', err);
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
@ -1147,22 +1221,22 @@ if(dc){
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const btn = document.getElementById('ctc-json-test-btn');
|
const btn = document.getElementById('ctc-json-test-btn');
|
||||||
const select = document.getElementById('ctc-json-select');
|
const select = document.getElementById('ctc-json-select');
|
||||||
const dumpContainer = document.getElementById('ctc-json-dump-container');
|
const dumpContainer = document.getElementById('ctc-json-dump-container');
|
||||||
const dump = document.getElementById('ctc-json-dump');
|
const dump = document.getElementById('ctc-json-dump');
|
||||||
const error = document.getElementById('ctc-json-error');
|
const error = document.getElementById('ctc-json-error');
|
||||||
if(btn && select) {
|
if (btn && select) {
|
||||||
btn.addEventListener('click', function() {
|
btn.addEventListener('click', function () {
|
||||||
const url = select.value;
|
const url = select.value;
|
||||||
dumpContainer.style.display = 'none';
|
dumpContainer.style.display = 'none';
|
||||||
error.style.display = 'none';
|
error.style.display = 'none';
|
||||||
dump.textContent = '';
|
dump.textContent = '';
|
||||||
if(!url) return;
|
if (!url) return;
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
if(!r.ok) throw new Error('Erreur HTTP ' + r.status);
|
if (!r.ok) throw new Error('Erreur HTTP ' + r.status);
|
||||||
return r.json();
|
return r.json();
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
@ -1178,17 +1252,17 @@ if(dc){
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const ctcCompletionSeries = {{ ctc_completion_series|json_encode|raw }};
|
const ctcCompletionSeries = {{ ctc_completion_series|json_encode|raw }};
|
||||||
|
|
||||||
console.log('ctcCompletionSeries',ctcCompletionSeries)
|
console.log('ctcCompletionSeries', ctcCompletionSeries)
|
||||||
// Exemple d'intégration dans un graphique Chart.js :
|
// Exemple d'intégration dans un graphique Chart.js :
|
||||||
// Pour chaque type, ajouter une série CTC si elle existe
|
// Pour chaque type, ajouter une série CTC si elle existe
|
||||||
Object.keys(ctcCompletionSeries).forEach(function(type) {
|
Object.keys(ctcCompletionSeries).forEach(function (type) {
|
||||||
const data = ctcCompletionSeries[type].map(pt => ({ x: pt.date, y: pt.value }));
|
const data = ctcCompletionSeries[type].map(pt => ({x: pt.date, y: pt.value}));
|
||||||
// Ajoute la série au graphique correspondant (ex: name_count, hours_count...)
|
// Ajoute la série au graphique correspondant (ex: name_count, hours_count...)
|
||||||
// À adapter selon l'ID du canvas et la structure du graphique
|
// À adapter selon l'ID du canvas et la structure du graphique
|
||||||
const canvasId = type.replace('_count','') + 'Chart';
|
const canvasId = type.replace('_count', '') + 'Chart';
|
||||||
const canvas = document.getElementById(canvasId);
|
const canvas = document.getElementById(canvasId);
|
||||||
if (!canvas) return;
|
if (!canvas) return;
|
||||||
// On suppose que le graphique existe déjà, on ajoute la série CTC
|
// On suppose que le graphique existe déjà, on ajoute la série CTC
|
||||||
|
@ -1200,7 +1274,7 @@ if(dc){
|
||||||
backgroundColor: 'rgba(255,165,0,0.1)',
|
backgroundColor: 'rgba(255,165,0,0.1)',
|
||||||
fill: false,
|
fill: false,
|
||||||
yAxisID: 'y',
|
yAxisID: 'y',
|
||||||
borderDash: [5,3],
|
borderDash: [5, 3],
|
||||||
datalabels: {
|
datalabels: {
|
||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue