{% extends 'sam/layout.html.twig' %} {% block title %}{{ cohort.name }} - Cohorte - SAM{% endblock %} {% block sam_body %}
{# ══════════════════════════════════════════════════════════════ BREADCRUMB ══════════════════════════════════════════════════════════════ #} {% include '_molecules/breadcrumb/breadcrumb.html.twig' with { showHome: false, items: [ { label: 'Dashboard', href: path('app_sam_index') }, { label: 'Cohortes', href: path('app_sam_cohorts') }, { label: cohort.name } ], class: 'mb-6' } %} {# ══════════════════════════════════════════════════════════════ PAGE HEADER ══════════════════════════════════════════════════════════════ #} {# ── HEADER CARD ── #}
{# Avatar cohort #} {% include '_atoms/avatar/avatar.html.twig' with { initials: cohort.name|slice(0, 2)|upper, size: 'xl', rounded: 'xl', variant: 'cohorts' } only %}

{{ cohort.name }}

{% if cohort.idnumber %} {{ cohort.idnumber }} {% endif %}
{% if cohort.description %}

{{ cohort.description }}

{% endif %} {# Cibles Stimulus pour mise à jour du compteur membres #}
{% 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'} } %}
{# ══════════════════════════════════════════════════════════════ SECTION: COURS ASSOCIES ══════════════════════════════════════════════════════════════ #} {% embed '_molecules/section-divider/section-divider.html.twig' with { title: 'Cours associés', subtitle: coursesData|length == 0 ? 'Aucun cours associé à cette cohorte' : (coursesData|length == 1 ? '1 cours accessible via cette cohorte' : coursesData|length ~ ' cours accessibles via cette cohorte'), icon: 'book', iconColor: 'primary' } %} {% block right %}{% endblock %} {% endembed %} {% if coursesData|length == 0 %}
{% 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' } %}
{{ member.firstname }} {{ member.lastname }}
{% if isSuspended %} {% include '_atoms/badge/badge.html.twig' with { label: 'Inactif', variant: 'error', dot: true, size: 'xs' } %} {% endif %}
{# Email #}
{{ 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 } } %}
{% endfor %} {# Footer #}
{{ cohort.membersCount }} membre{{ cohort.membersCount > 1 ? 's' : '' }}
{% endif %}
{# ══════════════════════════════════════════════════════════════ MODAL EDITION ══════════════════════════════════════════════════════════════ #} {# ══════════════════════════════════════════════════════════════ MODAL AJOUT MEMBRES ══════════════════════════════════════════════════════════════ #} {# ══════════════════════════════════════════════════════════════ MODAL SUPPRESSION ══════════════════════════════════════════════════════════════ #}
{% endblock %}