{# templates/admin/hebergement/index.html.twig #} {% extends 'admin/base_admin.html.twig' %} {% block title %}Hébergement annuel — Admin NUM-ECARD{% endblock %} {% block content %}
{# ── HEADER ── #}

🏠 Hébergement annuel

Gestion des abonnements d'hébergement — 12 € HT / an / carte après 1 an gratuit

{# ── STATS ── #} {% set statsData = [ {label: 'Total cartes', value: stats.total, color: '#667eea'}, {label: 'Essai gratuit', value: stats.trial, color: '#34c759'}, {label: 'Actives (payées)', value: stats.active, color: '#007aff'}, {label: 'Expirées', value: stats.expired, color: '#ff3b30'} ] %}
{% for item in statsData %}
{{ item.value }}
{{ item.label }}
{% endfor %}
{# ── FILTRES ── #}
{# ── TABLEAU COMPLET TOUTES LES CARTES ── #}

📋 Toutes les cartes

{{ allSubscriptions|length }} cartes
{% if allSubscriptions is empty %}
📭
Aucune carte enregistrée pour le moment.
{% else %}
{% for sub in allSubscriptions %} {% set b = sub.beneficiaire %} {% set days = sub.daysUntilExpiration %} {% set rowClass = '' %} {% if days <= 7 and sub.status != 'expired' %} {% set rowClass = 'row-urgent' %} {% elseif days <= 30 and sub.status != 'expired' %} {% set rowClass = 'row-warning' %} {% endif %} {# Bénéficiaire #} {# Pack #} {# Statut #} {# Création #} {# Expiration #} {# Jours restants #} {# Rappels #} {# Actions #} {% endfor %}
Bénéficiaire Pack Statut Création Expiration Jours restants Rappels Actions
{{ b.fullName }}
{{ b.commande.user.email }}
{{ b.commande.packLabel }} {% if sub.isFreeForever %} ♾️ Gratuit permanent
👤 carte admin
{% else %} {% if sub.status == 'trial' %}🟢 Essai gratuit {% elseif sub.status == 'active' %}✅ Actif (payé) {% elseif sub.status == 'expired' %}🔴 Expiré {% else %}⚠️ Suspendu{% endif %} {% endif %} {% if sub.renewedByAdmin and not sub.isFreeForever %}
👤 renouvelé admin
{% endif %}
{{ sub.startsAt|date('d/m/Y') }}
{{ sub.createdAt|date('d/m/Y H:i') }}
{{ sub.expiresAt|date('d/m/Y') }}
{% if sub.lastRenewalAt %}
🔄 renouvelé le {{ sub.lastRenewalAt|date('d/m/Y') }}
{% endif %}
{% if sub.isFreeForever %} ♾️ {% elseif sub.status == 'expired' %} {{ days|abs }}j dépassé {% else %}
{{ days }}j
{% set pct = (days / 365 * 100)|round %} {% if pct > 100 %}{% set pct = 100 %}{% endif %} {% if pct < 0 %}{% set pct = 0 %}{% endif %}
{% endif %}
{% set rem = sub.remindersSentAt %}
J-30
J-7
J=0
{# Renouveler #}
{# Ajuster date #}
{# Suspendre / Réactiver selon le statut #} {% if sub.status == 'expired' or sub.status == 'suspended' %}
{% else %}
{% endif %}
{% endif %}
{% endblock %}