{# Avatar cohort #}
{% include '_atoms/avatar/avatar.html.twig' with {
initials: cohort.name|slice(0, 2)|upper,
size: 'xl',
rounded: 'xl',
variant: 'cohorts'
} only %}
{% if cohort.description %}
{{ cohort.name }}
{% if cohort.idnumber %}{{ cohort.idnumber }}
{% endif %}
{{ cohort.description }}
{% endif %} {# Cibles Stimulus pour mise à jour du compteur membres #} {{ cohort.membersCount }}
{% include '_atoms/button/button.html.twig' with {
label: 'Modifier',
variant: 'soft-cohorts',
size: 'md',
icon: 'edit',
attr: {'data-action': 'click->sam--cohort-detail#openEditModal'}
} %}
{% include '_atoms/button/button.html.twig' with {
variant: 'soft-error',
size: 'md',
icon: 'trash',
iconOnly: true,
attr: {'data-action': 'click->sam--cohort-detail#openDeleteModal'}
} %}
{% include '_molecules/empty-state/empty-state.html.twig' with {
title: 'Aucun cours associé',
description: 'Cette cohorte n\'est inscrite à aucun cours',
icon: 'book'
} %}
{% else %}
{% endif %}
{# ══════════════════════════════════════════════════════════════
SECTION: MEMBRES DE LA COHORTE
══════════════════════════════════════════════════════════════ #}
{% embed '_molecules/section-divider/section-divider.html.twig' with {
title: 'Membres de la cohorte',
subtitle: cohort.membersCount ~ ' membre' ~ (cohort.membersCount > 1 ? 's' : '') ~ ' inscrit' ~ (cohort.membersCount > 1 ? 's' : ''),
icon: 'users',
iconColor: 'cohorts'
} %}
{% block right %}
{% include '_atoms/button/button.html.twig' with {
label: 'Gérer',
variant: 'cohorts',
size: 'md',
icon: 'settings',
attr: {'data-action': 'click->sam--cohort-detail#openAddMembersModal'}
} %}
{% endblock %}
{% endembed %}
{% if members|length == 0 %}
{% include '_molecules/empty-state/empty-state.html.twig' with {
title: 'Aucun membre',
description: 'Ajoutez des utilisateurs a cette cohorte',
icon: 'users'
} %}
{% else %}
{# Table header #}
Membre
Email
Dernière connexion
Actions
{% for member in members %}
{% set initials = (member.firstname|default('?')|first ~ member.lastname|default('?')|first)|upper %}
{% set isSuspended = member.suspended is defined and member.suspended %}
{# Avatar + Name #}
{% include '_atoms/avatar/avatar.html.twig' with {
initials: initials,
size: 'sm',
variant: isSuspended ? 'gray' : 'cohorts'
} %}
{# Email #}
{% endfor %}
{# Footer #}
{{ member.firstname }} {{ member.lastname }}
{% if isSuspended %}
{% include '_atoms/badge/badge.html.twig' with { label: 'Inactif', variant: 'error', dot: true, size: 'xs' } %}
{% endif %}
{{ member.email }}
{# Last access #}
{% if member.last_access_at is null %}
Jamais connecté
{% else %}
{% set daysAgo = date().diff(member.last_access_at).days %}
{% if daysAgo == 0 %}
Aujourd'hui
{% elseif daysAgo == 1 %}
Hier
{% elseif daysAgo < 30 %}
Il y a {{ daysAgo }}j
{% else %}
{{ member.last_access_at|date('d/m/Y') }}
{% endif %}
{% endif %}
{# Remove button #}
{% include '_atoms/button/button.html.twig' with {
variant: 'ghost',
size: 'sm',
icon: 'x',
iconOnly: true,
class: 'text-gray-300 hover:text-error hover:bg-error/10 shrink-0',
attr: {
'data-action': 'click->sam--cohort-detail#removeMember',
'data-user-id': member.moodle_id
}
} %}
{{ cohort.membersCount }} membre{{ cohort.membersCount > 1 ? 's' : '' }}
{% endif %}