{% 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'}
} %}
{# Table header #}
{# Footer #}
Stagiaire
Email
Dernière connexion
Statut
Actions
{# Table body #}
{% if users|length > 0 %}
{% for user in users %}
{# Avatar + Name #}
{# Table footer — pagination #}
{% if users|length > 0 %}
{% 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'
} %}
{# Email #}
{{ user.fullname }}
@{{ user.username }}
{{ 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 %}
{{ 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 %}
© Bubul {{ "now"|date("Y") }} {% if lastSyncedAt %} · Synchronisé le {{ lastSyncedAt|date('d/m/Y à H:i') }} {% else %} · Non synchronisé {% endif %}