{% extends 'base.html.twig' %} {% block title %}Abonnements B2C — Admin{% endblock %} {% block body %}
{# ================================================================ HEADER ================================================================ #}
{% include '_molecules/page-header/page-header.html.twig' with { title: 'Abonnements B2C', subtitle: 'Tous les abonnements individuels (actifs, annulés, inactifs).', icon: 'wallet', backHref: path('app_dashboard'), backLabel: 'Retour au dashboard' } only %}
{# ================================================================ STATS RAPIDES ================================================================ #} {% set countActive = subscriptions|filter(s => s.status == 'active')|length %} {% set countCanceled = subscriptions|filter(s => s.status == 'canceled')|length %} {% set countInactive = subscriptions|filter(s => s.status == 'inactive')|length %} {% set countPastDue = subscriptions|filter(s => s.status == 'past_due')|length %}
{% include '_molecules/stat-card/stat-card.html.twig' with { label: 'Actifs', value: countActive, icon: 'check-circle', variant: 'success' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { label: 'Annulés', value: countCanceled, icon: 'circle-x', variant: 'warning' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { label: 'Inactifs', value: countInactive, icon: 'circle-minus', variant: 'default' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { label: 'En retard', value: countPastDue, icon: 'alert-triangle', variant: 'error' } only %}
{# ================================================================ TABLEAU ================================================================ #}
{% if subscriptions|length == 0 %} {% include '_molecules/empty-state/empty-state.html.twig' with { icon: 'wallet', title: 'Aucun abonnement', description: 'Aucun abonnement B2C trouvé.' } only %} {% else %}
{% for sub in subscriptions %} {% set statusVariant = { 'active': 'success', 'canceled': 'warning', 'inactive': 'default', 'past_due': 'error', 'incomplete': 'error', 'paused': 'info', 'created': 'default' }[sub.status] ?? 'default' %} {% set statusLabel = { 'active': 'Actif', 'canceled': 'Annulé', 'inactive': 'Inactif', 'past_due': 'En retard', 'incomplete': 'Incomplet', 'paused': 'Pausé', 'created': 'Créé' }[sub.status] ?? sub.status %} {% endfor %}
Utilisateur Plan Cycle Statut
{% include '_atoms/avatar/avatar.html.twig' with { name: sub.user.fullName, size: 'sm' } only %}

{{ sub.user.fullName }}

{{ sub.user.email }}

{% if sub.plan %} {{ sub.plan.name }} {% if sub.pendingPlan %} → {{ sub.pendingPlan.name }} {% endif %} {% else %} {% endif %} {{ sub.billingCycle == 'annual' ? 'Annuel' : 'Mensuel' }} {% include '_atoms/badge/badge.html.twig' with { label: statusLabel, variant: statusVariant, size: 'sm' } only %}
{{ subscriptions|length }} abonnement{{ subscriptions|length > 1 ? 's' : '' }} au total
{% endif %}
{% endblock %}