{% extends 'base.html.twig' %} {% block title %}Support - Administration{% endblock %} {% block body %}
{# Header #} {% include '_molecules/page-header/page-header.html.twig' with { title: 'Support', subtitle: 'Gérez les demandes des utilisateurs', icon: 'message' } only %} {# Stats — atomic design stat-card #}
{% include '_molecules/stat-card/stat-card.html.twig' with { label: 'Non lus', value: stats.unread, icon: 'bell', variant: 'primary', detail: stats.unread > 0 ? 'À traiter en priorité' : 'Tout est à jour', size: 'sm', layout: 'horizontal' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { label: 'Ouverts', value: stats.open, icon: 'alert', variant: 'warning', detail: 'En attente de réponse', size: 'sm', layout: 'horizontal' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { label: 'En cours', value: stats.in_progress, icon: 'clock', variant: 'info', detail: 'En traitement', size: 'sm', layout: 'horizontal' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { label: 'Résolus', value: stats.resolved, icon: 'check-circle', variant: 'success', detail: 'Tickets fermés', size: 'sm', layout: 'horizontal' } only %}
{# ================================================================ SECTION 1 : À TRAITER (ouverts + en cours) ================================================================ #}
{% include '_atoms/icon/icon.html.twig' with { name: 'alert', size: 'md', color: 'warning' } only %}

À traiter

{{ pending|length }} ticket{{ pending|length > 1 ? 's' : '' }} en attente de réponse

{% if stats.unread > 0 %} {% include '_atoms/badge/badge.html.twig' with { label: stats.unread ~ ' non lu' ~ (stats.unread > 1 ? 's' : ''), variant: 'primary', dot: true, pulse: true } only %} {% endif %}
{% if pending|length == 0 %} {% include '_molecules/empty-state/empty-state.html.twig' with { title: 'Aucun ticket en attente', subtitle: 'Tous les tickets ont été traités.', icon: 'check-circle', size: 'sm', variant: 'minimal' } only %} {% else %}
{% for ticket in pending %} {% set statusVariant = ticket.status == 'open' ? 'warning' : 'info' %} {% set catIcon = ticket.category == 'bug' ? 'alert' : (ticket.category == 'billing' ? 'wallet' : (ticket.category == 'suggestion' ? 'star' : (ticket.category == 'question' ? 'help' : 'message'))) %} {% set catColor = ticket.category == 'bug' ? 'error' : (ticket.category == 'billing' ? 'success' : (ticket.category == 'suggestion' ? 'warning' : (ticket.category == 'question' ? 'info' : 'primary'))) %} {% set catBg = ticket.category == 'bug' ? 'bg-error/10' : (ticket.category == 'billing' ? 'bg-success/10' : (ticket.category == 'suggestion' ? 'bg-warning/10' : (ticket.category == 'question' ? 'bg-info/10' : 'bg-primary/10'))) %} {# Icône catégorie + point non-lu #}
{% include '_atoms/icon/icon.html.twig' with { name: catIcon, size: 'sm', color: catColor } only %}
{% if ticket.hasUnreadForAdmin %} {% endif %}
{# Infos ticket #}
{{ ticket.reference }} {% include '_atoms/badge/badge.html.twig' with { label: ticket.categoryLabel, variant: 'neutral', size: 'xs' } only %} {% if ticket.hasUnreadForAdmin %} {% include '_atoms/badge/badge.html.twig' with { label: 'Nouveau message', variant: 'primary', size: 'xs', dot: true } only %} {% endif %}

{{ ticket.subject }}

{{ ticket.user.fullName ?: ticket.user.email }} · {{ ticket.messages|length }} message{{ ticket.messages|length > 1 ? 's' : '' }} · {{ ticket.lastMessageAt ? ticket.lastMessageAt|date('d/m/Y H:i') : ticket.createdAt|date('d/m/Y H:i') }}

{# Statut + flèche #}
{% include '_atoms/badge/badge.html.twig' with { label: ticket.statusLabel, variant: statusVariant, dot: true, size: 'sm' } only %} {% include '_atoms/icon/icon.html.twig' with { name: 'arrow-right', size: 'sm', color: 'gray', class: 'opacity-0 group-hover:opacity-100 transition-opacity' } only %}
{% endfor %}
{% endif %}
{# ================================================================ SECTION 2 : RÉSOLUS (paginés) ================================================================ #}
{% include '_atoms/icon/icon.html.twig' with { name: 'check-circle', size: 'md', color: 'success' } only %}

Résolus

{{ pagination.totalItems }} ticket{{ pagination.totalItems > 1 ? 's' : '' }} archivés

{% if resolved|length == 0 %} {% include '_molecules/empty-state/empty-state.html.twig' with { title: 'Aucun ticket résolu', icon: 'check-circle', size: 'sm', variant: 'minimal' } only %} {% else %}
{% for ticket in resolved %} {% set catIcon = ticket.category == 'bug' ? 'alert' : (ticket.category == 'billing' ? 'wallet' : (ticket.category == 'suggestion' ? 'star' : (ticket.category == 'question' ? 'help' : 'message'))) %} {% set catColor = ticket.category == 'bug' ? 'error' : (ticket.category == 'billing' ? 'success' : (ticket.category == 'suggestion' ? 'warning' : (ticket.category == 'question' ? 'info' : 'primary'))) %} {% set catBg = ticket.category == 'bug' ? 'bg-error/10' : (ticket.category == 'billing' ? 'bg-success/10' : (ticket.category == 'suggestion' ? 'bg-warning/10' : (ticket.category == 'question' ? 'bg-info/10' : 'bg-primary/10'))) %}
{% include '_atoms/icon/icon.html.twig' with { name: catIcon, size: 'sm', color: catColor } only %}
{{ ticket.reference }} {% include '_atoms/badge/badge.html.twig' with { label: ticket.categoryLabel, variant: 'neutral', size: 'xs' } only %}

{{ ticket.subject }}

{{ ticket.user.fullName ?: ticket.user.email }} · {{ ticket.lastMessageAt ? ticket.lastMessageAt|date('d/m/Y H:i') : ticket.createdAt|date('d/m/Y H:i') }}

{% include '_atoms/badge/badge.html.twig' with { label: 'Résolu', variant: 'success', dot: true, size: 'sm' } only %} {% include '_atoms/icon/icon.html.twig' with { name: 'arrow-right', size: 'sm', color: 'gray', class: 'opacity-0 group-hover:opacity-100 transition-opacity' } only %}
{% endfor %}
{% if pagination.total > 1 %}
{% include '_molecules/pagination/pagination.html.twig' with { currentPage: pagination.current, totalPages: pagination.total, routeName: 'admin_support_index' } only %}
{% endif %} {% endif %}
{% endblock %}