{% extends 'sam/layout.html.twig' %} {% block title %}Stagiaires - SAM{% endblock %} {% block sam_body %}
{# ══════════════════════════════════════════════════════════════ BREADCRUMB ══════════════════════════════════════════════════════════════ #} {% include '_molecules/breadcrumb/breadcrumb.html.twig' with { showHome: false, items: [ { label: 'Dashboard', href: path('app_sam_index') }, { label: 'Stagiaires' } ], class: 'mb-6' } %} {# ══════════════════════════════════════════════════════════════ PAGE HEADER ══════════════════════════════════════════════════════════════ #}
{% include '_atoms/icon/icon.html.twig' with { name: 'users', size: 'xl', color: 'cohorts' } only %}

Gestion des stagiaires

Consultez, modifiez et gérez les accès de vos {{ total }} stagiaire{{ total > 1 ? 's' : '' }} Moodle

{# Sync button — conserve les targets Stimulus sur l'icône SVG et le label #} {# Add user button — gradient cohorts #} {% include '_atoms/button/button.html.twig' with { label: 'Ajouter', variant: 'cohorts', size: 'md', icon: 'plus', attr: {'data-action': 'click->sam--user-crud#openAddModal'} } %}
{# ══════════════════════════════════════════════════════════════ SEARCH BAR — formulaire GET simple (rechargement page) ══════════════════════════════════════════════════════════════ #}
{% include '_atoms/icon/icon.html.twig' with { name: 'search', size: 'md', color: 'muted' } only %}
{# ══════════════════════════════════════════════════════════════ DATA TABLE ══════════════════════════════════════════════════════════════ #}
{# Table header #}
Stagiaire Email Dernière connexion Statut Actions
{# Table body #}
{% if users|length > 0 %} {% for user in users %} {# Avatar + Name #}
{% include '_atoms/avatar/avatar.html.twig' with { initials: user.firstname|slice(0, 1) ~ user.lastname|slice(0, 1), size: 'sm', variant: user.suspended ? 'gray' : 'cohorts' } %}
{{ user.fullname }}
@{{ user.username }}
{# Email #}
{{ user.email }}
{# Last access #}
{% if user.lastAccessAt %} {{ user.lastAccessAt|date('d/m/Y H:i') }} {% else %} {% endif %}
{# Status badge — presets atomiques #}
{% if user.suspended %} {% include '_atoms/badge/badge.html.twig' with { preset: 'user-inactive', size: 'sm' } %} {% else %} {% include '_atoms/badge/badge.html.twig' with { preset: 'user-active', size: 'sm' } %} {% endif %}
{# Row actions — stopPropagation pour éviter la navigation #}
{# Toggle activate/suspend #} {# Edit #} {% include '_atoms/button/button.html.twig' with { variant: 'ghost', size: 'sm', icon: 'edit', iconOnly: true, class: 'text-gray-400 hover:text-primary hover:bg-primary/10 shrink-0', attr: { 'data-action': 'click->sam--user-crud#openEditModal', 'data-user-id': user.moodleId, 'data-username': user.username, 'data-email': user.email, 'data-firstname': user.firstname, 'data-lastname': user.lastname } } %} {# Delete #} {% include '_atoms/button/button.html.twig' with { variant: 'ghost', size: 'sm', icon: 'trash', iconOnly: true, class: 'text-gray-400 hover:text-error hover:bg-error/10 shrink-0', attr: { 'data-action': 'click->sam--user-crud#openDeleteModal', 'data-user-id': user.moodleId, 'data-fullname': user.fullname } } %}
{% endfor %} {% else %} {% if search is defined and search %} {% include '_molecules/empty-state/empty-state.html.twig' with { title: 'Aucun résultat pour "' ~ search ~ '"', description: 'Essayez avec un autre nom, email ou identifiant', icon: 'search' } %} {% else %} {% include '_molecules/empty-state/empty-state.html.twig' with { title: 'Aucun stagiaire trouvé', description: 'Cliquez sur "Synchroniser" pour récupérer les données depuis Moodle', icon: 'users' } %} {% endif %} {% endif %}
{# Table footer — pagination #} {% if users|length > 0 %}
{{ total }} stagiaire{{ total > 1 ? 's' : '' }} {% if search is defined and search %}pour "{{ search }}"{% endif %} {% if totalPages > 1 %} {% include '_molecules/pagination/pagination.html.twig' with { currentPage: page, totalPages: totalPages, baseUrl: path('app_sam_users') ~ (search is defined and search ? '?search=' ~ search|url_encode : ''), size: 'sm', showFirstLast: false } %} {% endif %}
{% endif %}
{# Footer #}

© Bubul {{ "now"|date("Y") }} {% if lastSyncedAt %} · Synchronisé le {{ lastSyncedAt|date('d/m/Y à H:i') }} {% else %} · Non synchronisé {% endif %}

{# ══════════════════════════════════════════════════════════════ MODAL AJOUT / ÉDITION ══════════════════════════════════════════════════════════════ #} {# ══════════════════════════════════════════════════════════════ MODAL SUPPRESSION ══════════════════════════════════════════════════════════════ #}
{% endblock %}