{% extends 'sam/layout.html.twig' %} {% block title %}{{ course.fullname }} - Formation - SAM{% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block sam_body %}
{# ══════════════════════════════════════════════════════════════ BREADCRUMB ══════════════════════════════════════════════════════════════ #} {% include '_molecules/breadcrumb/breadcrumb.html.twig' with { showHome: false, items: [ { label: 'Dashboard', href: path('app_sam_index') }, { label: 'Formations', href: path('app_sam_courses') }, { label: course.shortname } ], class: 'mb-6' } %} {# ══════════════════════════════════════════════════════════════ PRÉ-CALCULS ══════════════════════════════════════════════════════════════ #} {% set totalTrackable = trackableActivities * enrolledCount %} {% set completionPct = totalTrackable > 0 ? (totalCompletedActivities / totalTrackable * 100)|round : 0 %} {% set healthColor = averageProgress >= 75 ? 'success' : (averageProgress > 0 ? 'warning' : 'error') %} {% set healthLabel = averageProgress >= 75 ? 'Bonne progression' : (averageProgress > 0 ? 'En cours' : 'Pas commencé') %} {% set distCompleted = 0 %} {% set distInProgress = 0 %} {% set distNotStarted = 0 %} {% for data in enrolledUsers %} {% if data.progress.percentage >= 75 %}{% set distCompleted = distCompleted + 1 %} {% elseif data.progress.percentage > 0 %}{% set distInProgress = distInProgress + 1 %} {% else %}{% set distNotStarted = distNotStarted + 1 %} {% endif %} {% endfor %} {% set atRiskList = [] %} {% set otherList = [] %} {% for data in enrolledUsers %} {% if data.progress.percentage == 0 and not data.user.suspended %} {% set atRiskList = atRiskList|merge([data]) %} {% else %} {% set otherList = otherList|merge([data]) %} {% endif %} {% endfor %} {% set sortedUsers = atRiskList|merge(otherList) %} {# ══════════════════════════════════════════════════════════════ HERO CARD ══════════════════════════════════════════════════════════════ #}
{# Identité de la formation #}
{% include '_atoms/icon/icon.html.twig' with { name: 'presentation-graph', size: '2xl', color: 'cohorts' } only %}

{{ course.fullname }}

{% if not course.visible %} {% include '_atoms/badge/badge.html.twig' with { label: 'Masqué', variant: 'warning', size: 'sm' } %} {% endif %}

{{ course.shortname }}  ·  {{ sections|length }} section{{ sections|length != 1 ? 's' : '' }}  ·  {{ totalActivities }} activité{{ totalActivities != 1 ? 's' : '' }}

{% if courseCohorts|length > 0 %} {% endif %}
{# Actions #}
{# Ouvrir sur Moodle #} Ouvrir sur Moodle {# Bouton sync #}
{# KPI inline strip #}
{% include '_atoms/icon/icon.html.twig' with { name: 'users', size: 'md', color: 'muted' } only %}
{{ enrolledCount }}
Inscrits
{% include '_atoms/icon/icon.html.twig' with { name: 'check-circle', size: 'md', color: 'success' } only %}
{{ completionPct }}%
{{ totalCompletedActivities }}/{{ totalTrackable }} activités
{% include '_atoms/icon/icon.html.twig' with { name: 'clock', size: 'md', color: 'warning' } only %}
{{ totalTimeFormatted ?: '—' }}
Apprentissage
{% include '_atoms/icon/icon.html.twig' with { name: 'users', size: 'md', color: 'error' } only %}
{{ distNotStarted }}
Pas commencé
{# ══════════════════════════════════════════════════════════════ SUIVI DES STAGIAIRES ══════════════════════════════════════════════════════════════ #} {% embed '_molecules/section-divider/section-divider.html.twig' with { title: 'Suivi des stagiaires', subtitle: enrolledCount ~ ' inscrit' ~ (enrolledCount != 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: {'onclick': 'openManageModal()'} } %} {% endblock %} {% endembed %} {% if enrolledUsers|length == 0 %}
{% include '_molecules/empty-state/empty-state.html.twig' with { title: 'Aucun inscrit', description: "Cette formation n'a pas encore de stagiaires inscrits.", icon: 'users', variant: 'minimal', size: 'sm' } %}
{% else %} {# ── Barre de recherche ── #}
{# ── Tableau des inscrits ── #}
Stagiaire Inscription Temps Progression
{# end #cd-user-list #}
{{ enrolledCount }} stagiaire{{ enrolledCount != 1 ? 's' : '' }}
{% endif %} {# ══════════════════════════════════════════════════════════════ CONTENU DE LA FORMATION ══════════════════════════════════════════════════════════════ #} {% embed '_molecules/section-divider/section-divider.html.twig' with { title: 'Contenu de la formation', subtitle: sections|length ~ ' section' ~ (sections|length != 1 ? 's' : '') ~ ' · ' ~ totalActivities ~ ' activité' ~ (totalActivities != 1 ? 's' : ''), icon: 'book', iconColor: 'warning' } %} {% block right %} {% include '_molecules/expand-toggle/expand-toggle.html.twig' with { id: 'cd-toggle-all', onclick: 'toggleAllSections()' } %} {% endblock %} {% endembed %}
{% if sections|length == 0 %}
{% include '_molecules/empty-state/empty-state.html.twig' with { title: 'Aucune section', description: 'Cette formation ne contient pas encore de sections.', icon: 'book', variant: 'minimal', size: 'sm' } %}
{% else %} {% for section in sections %} {% set trackableCount = 0 %} {% for activity in section.activities %} {% if activity.isTrackable %}{% set trackableCount = trackableCount + 1 %}{% endif %} {% endfor %}
{# En-tête de section — cliquable #} {# Liste des activités — fermée par défaut #}
{% if section.activities|length == 0 %}

Aucune activité dans cette section.

{% else %} {% for activity in section.activities %}
{# Icône du type — verte si suivi, grise sinon #}
{% include 'sam/_activity_icon.html.twig' with {type: activity.type, color: activity.isTrackable ? 'success' : 'gray-400'} only %}
{# Nom + type #}
{{ activity.name }} {{ activity.type }}
{# Badge suivi #} {% if activity.isTrackable %} Suivi {% else %} Non suivi {% endif %} {# Lien Moodle #} {% if activity.url %} {% endif %}
{% endfor %} {% endif %}
{% endfor %} {% endif %}
{# ══════════════════════════════════════════════════════════════ MODAL — Gérer les stagiaires ══════════════════════════════════════════════════════════════ #}
{% endblock %} {% block javascripts %} {{ parent() }} {% endblock %}