{% extends 'base.html.twig' %} {% block title %}Tableau de bord – EOS{% endblock %} {% block body %} {% set dayNames = {'1': 'Lun', '2': 'Mar', '3': 'Mer', '4': 'Jeu', '5': 'Ven', '6': 'Sam', '7': 'Dim'} %} {% set today = 'now'|date('Y-m-d') %} {# ── En-tête semaine ── #}

Semaine du {{ dashboard.weekStart|date('d/m') }} au {{ dashboard.weekEnd|date('d/m/Y') }}

{{ today|date('l d F Y')|capitalize }}

+ Offrande du jour
{# ── Feedback hebdo ── #} {% if weekFeedback %}
{{ weekFeedback.message }}
{% endif %} {# ── Feedback du jour ── #} {% if todayFeedback %}
{{ todayFeedback.message }}
{% endif %} {# ── Bilan Oracle en attente ── #} {% if dashboard.pendingAssessment %} {% set wa = dashboard.pendingAssessment %}
Oracle : proposition {{ wa.proposedCalories }} kcal/j pour la semaine du {{ wa.startDate|date('d/m') }} (TDEE estimé : {{ wa.estimatedTdee }} kcal).
{% endif %} {# ── KPIs ── #}
Calories moy.
{{ dashboard.averageCalories ? dashboard.averageCalories|round : '–' }}
kcal / jour
{% if dashboard.targetCalories > 0 %}
Plafond {{ dashboard.targetCalories }} kcal
{% if dashboard.averageCalories %}
{% set pct = [100, (dashboard.averageCalories / dashboard.targetCalories * 100)|round]|min %} {% set over = dashboard.averageCalories > dashboard.targetCalories %}
{% endif %} {% endif %}
Protéines moy.
{{ dashboard.averageProteins ? dashboard.averageProteins|round : '–' }}
g / jour
{% if dashboard.targetProteins > 0 %}
Plancher {{ dashboard.targetProteins }} g
{% if dashboard.averageProteins %}
{% set pctP = [100, (dashboard.averageProteins / dashboard.targetProteins * 100)|round]|min %}
{% endif %} {% endif %}
Poids moyen
{{ dashboard.averageWeight ?? '–' }}
kg (7 j)
Plafond
{{ (dashboard.calorieAdherenceRate * 100)|round }}%
jours respectés
Plancher
{{ (dashboard.proteinAdherenceRate * 100)|round }}%
jours atteints
{# ── Graphe CSS semaine + table 7 jours ── #} {% if dashboard.dailyItems is empty %}
🌅 Aucune offrande cette semaine.
Commencer maintenant
{% else %} {# Mini histogramme CSS #}
Calories cette semaine
{% for item in dashboard.dailyItems %} {% set isToday = item.date|date('Y-m-d') == today %} {% if item.caloriesConsumed is not null and dashboard.targetCalories > 0 %} {% set heightPct = [95, (item.caloriesConsumed / dashboard.targetCalories * 80)|round]|min %} {% set isOver = item.caloriesConsumed > dashboard.targetCalories %}
{{ dayNames[item.date|date('N')] }}
{% else %}
{{ dayNames[item.date|date('N')] }}
{% endif %} {% endfor %}
{# Table détaillée 7 jours #}
Détail des 7 derniers jours
{% for item in dashboard.dailyItems %} {% set isToday = item.date|date('Y-m-d') == today %} {% endfor %}
Jour Calories Protéines Poids 😊 😴 😓
{{ dayNames[item.date|date('N')] }} {{ item.date|date('d/m') }} {% if isToday %}auj.{% endif %} {% if item.caloriesConsumed is not null %} {{ item.caloriesConsumed }} {% if dashboard.targetCalories > 0 %} {% set cpct = item.calorieFillPercent() %} {% endif %} {% else %}{% endif %} {% if item.proteinsConsumed is not null %} {{ item.proteinsConsumed }} g {% if dashboard.targetProteins > 0 %} {% set ppct = item.proteinFillPercent() %} {% endif %} {% else %}{% endif %} {{ item.weight ? item.weight ~ ' kg' : '–' }} {{ item.moodScore ?? '–' }} {{ item.sleepScore ?? '–' }} {{ item.fatigueScore ?? '–' }}
{% endif %} {# ── Tendance poids 14 jours ── #} {% if weightTrend is not empty %}
Tendance poids – 14 jours
{% set prevWeight = null %} {% for point in weightTrend %}
{% if prevWeight is not null %} {% set delta = point.weight - prevWeight %}
{{ delta < 0 ? '↘' : (delta > 0 ? '↗' : '→') }}
{% else %}
 
{% endif %}
{{ point.weight }}
{{ dayNames[point.date|date('N')] }} {{ point.date|date('d/m') }}
{% set prevWeight = point.weight %} {% endfor %}
{% endif %}
Voir tous les bilans →
{% endblock %}