{% extends 'account/base_account.html.twig' %} {% block title %}Mon compte{% endblock %} {% block content %} {# ── Flash messages ── #} {% for msg in app.flashes('warning') %}
⚠️{{ msg|raw }}
{% endfor %} {% for msg in app.flashes('success') %}
{{ msg|raw }}
{% endfor %} {% for msg in app.flashes('info') %}
ℹ️{{ msg|raw }}
{% endfor %} {# ── Bannière expiration MDP (Politique V1.0 §3) ── #} {% if app.user.isPasswordExpired %}
🔒
Votre mot de passe a expiré
La politique de sécurité SANAGENCY impose un renouvellement tous les 12 mois. Veuillez mettre à jour votre mot de passe pour continuer à accéder à votre compte.
🔐 Renouveler maintenant
{% elseif app.user.passwordChangedAt is not null %} {# Avertissement préventif à 14 jours ── calcul Twig natif #} {% set expiry_date = app.user.passwordChangedAt|date_modify('+12 months') %} {% set days_left = ((expiry_date|date('U') - 'now'|date('U')) / 86400)|round(0, 'ceil') %} {% if days_left <= 14 and days_left > 0 %}
Votre mot de passe expire dans {{ days_left }} jour{{ days_left > 1 ? 's' }}. Renouveler maintenant →
{% endif %} {% endif %} {# ══════════════════════════════════════════════════════════════════ HEADER ══════════════════════════════════════════════════════════════════ #} {# ══════════════════════════════════════════════════════════════════ STATISTIQUES ══════════════════════════════════════════════════════════════════ #}
💰
{{ stats.total_depense|number_format(2, ',', ' ') }} €
Total dépensé
📦
{{ stats.total_commandes }}
Commandes totales
{{ stats.commandes_payees }}
Commandes payées
{{ stats.commandes_en_cours }}
En cours
{# ══════════════════════════════════════════════════════════════════ BOUTON PARTAGER MA CARTE (desktop uniquement) ══════════════════════════════════════════════════════════════════ #} {% set has_paid_cards = false %} {% for commande in app.user.commandes %} {% if commande.isPaid %}{% set has_paid_cards = true %}{% endif %} {% endfor %} {# ══════════════════════════════════════════════════════════════════ DERNIÈRES COMMANDES ══════════════════════════════════════════════════════════════════ #}
Mes commandes
{% if commandes is empty %}
📦
Aucune commande

Vous n'avez pas encore passé de commande.

Découvrir nos offres
{% else %} {# ── Filtres ── #}
{# ── Table ── #}
{% for commande in commandes %} {% set statusClass = { 'draft': 'badge-draft', 'pending': 'badge-pending', 'paid': 'badge-paid', 'processing': 'badge-processing', 'completed': 'badge-completed', 'cancelled': 'badge-cancelled' } %} {% set statusLabel = { 'draft': 'Brouillon', 'pending': 'En attente', 'paid': 'Payée', 'processing': 'En cours', 'completed': 'Terminée', 'cancelled': 'Annulée' } %} {% endfor %}
Référence Date Pack Cartes Montant TTC Statut
{{ commande.reference }} {% if commande.isPaid %} {% endif %} {{ commande.createdAt|date('d/m/Y') }}
{{ commande.createdAt|date('H:i') }}
Pack {{ commande.packType|capitalize }} {% if commande.beneficiaires|length > 0 %} {% for b in commande.beneficiaires %}
{{ b.prenom|slice(0,1)|upper }}{{ b.nom|slice(0,1)|upper }}
{{ b.prenom }} {{ b.nom }}
{% endfor %} {% else %} {% endif %}
{{ commande.totalTTC|number_format(2, ',', ' ') }} € {{ statusLabel[commande.status] ?? commande.status }} Détails →
{% endif %}
{# ══════════════════════════════════════════════════════════════════ MES CARTES & HÉBERGEMENT ══════════════════════════════════════════════════════════════════ #} {% if beneficiaires is not empty %}
🃏 Mes cartes & hébergement
{% for b in beneficiaires %}
{{ b.prenom }} {{ b.nom }} {% if b.packType is defined and b.packType %} {{ b.packType }} {% endif %} {% if b.isActive is defined %} {% if b.isActive %} ✅ Active {% else %} ⚠️ Expirée {% endif %} {% endif %}
🏠 Hébergement
{% endfor %}
{% endif %} {# ══════════════════════════════════════════════════════════════════ PRÉFÉRENCES DE COMMUNICATION — RGPD ══════════════════════════════════════════════════════════════════ #}
📧 Préférences de communication
{% if app.request.query.get('optin_updated') %}
✅ Vos préférences ont été mises à jour.
{% endif %}
{# ══════════════════════════════════════════════════════════════════ MODALE QR CODE (desktop) ══════════════════════════════════════════════════════════════════ #} {% if has_paid_cards %}
📲 Partager ma carte
{% for commande in app.user.commandes %} {% if commande.isPaid %} {% for beneficiaire in commande.beneficiaires %} {% set slug = (beneficiaire.prenom ~ '-' ~ beneficiaire.nom)|lower|replace({' ': '-', 'é': 'e', 'è': 'e', 'ê': 'e', 'à': 'a', 'â': 'a', 'ô': 'o', 'û': 'u', 'ù': 'u', 'î': 'i', 'ï': 'i', 'ç': 'c'}) %} {% set carteUrl = 'https://' ~ slug ~ '.num-ecard.com' %}

{{ beneficiaire.prenom }} {{ beneficiaire.nom }} — {{ commande.packType }}

{{ carteUrl }}

🔗 Ouvrir
{% endfor %} {% endif %} {% endfor %}
{% endif %} {# ══════════════════════════════════════════════════════════════════ JAVASCRIPT ══════════════════════════════════════════════════════════════════ #} {# ══════════════════════════════════════════════════════════════════ CSS ══════════════════════════════════════════════════════════════════ #} {% endblock %}