followup service refacto

This commit is contained in:
Tykayn 2025-06-29 19:24:00 +02:00 committed by tykayn
parent 1c2c3575f9
commit 0611b28172
7 changed files with 341 additions and 596 deletions

View file

@ -15,34 +15,16 @@
<hr>
<h3>Suivi par thématique</h3>
<div class="row">
{% set themes = [
'fire_hydrant', 'charging_station', 'toilets', 'bus_stop', 'defibrillator', 'camera', 'recycling', 'substation', 'laboratory', 'school', 'police', 'healthcare', 'places'
] %}
{% set theme_icons = {
'fire_hydrant': 'bi-droplet',
'charging_station': 'bi-lightning-charge',
'toilets': 'bi-toilet',
'bus_stop': 'bi-bus-front',
'defibrillator': 'bi-heart-pulse',
'camera': 'bi-camera-video',
'recycling': 'bi-recycle',
'substation': 'bi-plug',
'laboratory': 'bi-beaker',
'school': 'bi-mortarboard',
'police': 'bi-shield-lock',
'healthcare': 'bi-hospital',
'places': 'bi-geo-alt'
} %}
{% for theme in themes %}
{% for type, label in followup_labels %}
<div class="col-md-6 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">
<i class="bi {{ theme_icons[theme]|default('bi-question-circle') }}"></i>
{{ theme|replace({'_': ' '})|title }}
<i class="bi {{ followup_icons[type]|default('bi-question-circle') }}"></i>
{{ label }}
</h5>
<canvas id="chart-{{ theme }}-count" height="60"></canvas>
<canvas id="chart-{{ theme }}-completion" height="60"></canvas>
<canvas id="chart-{{ type }}-count" height="60"></canvas>
<canvas id="chart-{{ type }}-completion" height="60"></canvas>
</div>
</div>
</div>
@ -87,7 +69,7 @@ new Chart(ctxSummary, {
}
});
// Graphes par thème
const themes = {{ themes|json_encode|raw }};
const themes = {{ followup_labels|keys|json_encode|raw }};
themes.forEach(theme => {
// Count
const countData = (series[theme + '_count'] || []).map(e => ({x: e.date, y: e.value}));