{% extends 'app/base.html.twig' %} {% block title %}Suivi — {{ suivi.nom_personne }}{% endblock %} {% block body %} {# ── En-tête ───────────────────────────────────────────────────────────────── #}

{{ suivi.nom_personne }} {% if suivi.actif %} En cours {% else %} Clôturé {% endif %}

{% if suivi.type_personne == 'eleve' %}🏫 Élève {% elseif suivi.type_personne == 'resident' %}🏠 Résident {% elseif suivi.type_personne == 'patient' %}🏥 Patient {% else %}👤 Autre{% endif %} {% if suivi.groupe_service %} {{ suivi.groupe_service }} {% endif %} Débuté le {{ suivi.date_debut|date('d/m/Y') }} {% if suivi.date_fin %} — clôturé le {{ suivi.date_fin|date('d/m/Y') }}{% endif %}
Liste {% if is_granted('ROLE_TENANT_GESTIONNAIRE') %} Modifier {% if suivi.actif %}
{% else %}
{% endif %} {% if is_granted('ROLE_TENANT_ADMIN') %}
{% endif %} {% endif %}
{# ── Flash messages ────────────────────────────────────────────────────────── #} {% for type, messages in app.flashes(['success','error','warning','info']) %} {% for msg in messages %}
{{ msg }}
{% endfor %} {% endfor %} {# ── Motif médical ─────────────────────────────────────────────────────────── #} {% if suivi.motif %}
Prescription médicale : {{ suivi.motif }} {% if suivi.notes %}
{{ suivi.notes }} {% endif %}
{% endif %} {# ── KPIs ──────────────────────────────────────────────────────────────────── #}
Relevés effectués
{{ stats.nb_releves }}
Moy. servi
{{ stats.avg_servi|number_format(0) }} g
par repas
Moy. consommé
{{ stats.avg_consomme|number_format(0) }} g
retour : {{ stats.avg_retour|number_format(0) }} g moy.
{% set tauxColor = stats.taux_consommation >= 80 ? 'success' : (stats.taux_consommation >= 50 ? 'warning' : 'danger') %}
Taux de consommation
{{ stats.taux_consommation|number_format(1) }} %
{% if stats.taux_consommation >= 80 %}✓ Bon appétit {% elseif stats.taux_consommation >= 50 %}⚠ Appétit réduit {% else %}⚠ Appétit très faible{% endif %}
{# ── Colonne gauche : graphique + tableau ──────────────────────────────── #}
{# Graphique #} {% if evolution is not empty %}
Évolution — quantité servie vs consommée
{% endif %} {# Tableau des relevés #}
Historique des relevés
{{ releves|length }}
{% if releves is empty %}
Aucun relevé pour l'instant
{% else %}
{% if is_granted('ROLE_TENANT_GESTIONNAIRE') %}{% endif %} {% for r in releves %} {% set taux = r.poids_servi > 0 ? (r.poids_consomme / r.poids_servi * 100) : 0 %} {% set rowColor = taux >= 80 ? 'success' : (taux >= 50 ? 'warning' : 'danger') %} {% if is_granted('ROLE_TENANT_GESTIONNAIRE') %} {% endif %} {% endfor %}
Date Repas Menu Servi (g) Retour (g) Consommé (g) Taux Notes
{{ r.date_releve|date('d/m/Y') }} {% if r.service == 'dejeuner' %}🍽️ Déjeuner {% elseif r.service == 'diner' %}🌙 Dîner {% elseif r.service == 'petit_dejeuner' %}☀️ Petit-déj. {% else %}🍎 Goûter{% endif %} {{ r.description_repas ?: '—' }} {{ r.poids_servi|number_format(0) }} {{ r.poids_retour|number_format(0) }} {{ r.poids_consomme|number_format(0) }} {{ taux|number_format(0) }}% {{ r.notes ?: '—' }}
{% endif %}
{# ── Colonne droite : formulaire d'ajout ───────────────────────────────── #} {% if suivi.actif and is_granted('ROLE_TENANT_GESTIONNAIRE') %}
Saisir un pesage
Avant le repas
Non mangé
{# Résultat calculé en temps réel #}
Consommé : | Taux :
{% endif %}
{# ── Chart.js ─────────────────────────────────────────────────────────────── #} {% if evolution is not empty %} {% endif %} {# Calcul en temps réel (visible si formulaire présent) #} {% if suivi.actif %} {% endif %} {% endblock %}