{# Macros pour composants réutilisables #} {# Macro pour section hero avec gradient #} {% macro hero_section(title, subtitle=None, meta_info=[], primary_action=None, icon=None, gradient_class="from-purple-600 to-blue-600") %}
{% if caller %} {{ caller() }} {% endif %}

{{ title }}

{% if subtitle %}

{{ subtitle }}

{% endif %} {% if meta_info %}
{% for info in meta_info %} {% if info.icon %} {{ info.icon|safe }} {% endif %} {{ info.text }} {% endfor %}
{% endif %}
{% endmacro %} {# Macro pour card standardisée #} {% macro card(title=None, actions=[], classes="", body_classes="p-6") %}
{% if title %}

{{ title }}

{% if actions %}
{% for action in actions %} {{ action.text }} {% endfor %}
{% endif %}
{% endif %}
{{ caller() }}
{% endmacro %} {# Macro pour bouton avec gradient #} {% macro gradient_button(url, text, icon=None, gradient_class="from-blue-500 to-blue-600", hover_gradient="from-blue-600 to-blue-700", size="md", classes="") %} {% set size_classes = { 'sm': 'px-4 py-2 text-sm', 'md': 'px-6 py-3 text-base', 'lg': 'px-8 py-4 text-lg' } %} {% if icon %}
{{ icon|safe }}
{% endif %} {{ text }}
{% endmacro %} {# Macro pour action card (comme les cartes d'actions principales) #} {% macro action_card(url, title, subtitle, icon, gradient_class="from-green-500 to-green-600", hover_gradient="from-green-600 to-green-700", is_button=False) %} {% if is_button %} {% else %} {% endif %} {% endmacro %} {# Macro pour indicateur de progression #} {% macro progress_indicator(progress, clickable=True, assessment_id=None, compact=False) %} {% set base_classes = "inline-flex items-center rounded-full text-xs font-medium border" %} {% set size_classes = "px-3 py-2" if not compact else "px-2 py-1" %} {% if progress.status == 'completed' %}
Correction 100%
{% elif progress.status == 'in_progress' %} {% if clickable and assessment_id %}
Correction {{ progress.percentage }}% {% if clickable and assessment_id %}
{% else %}{% endif %} {% elif progress.status == 'not_started' %} {% if clickable and assessment_id %} Correction 0% {% if clickable and assessment_id %}{% else %}{% endif %} {% else %}
Non définie
{% endif %} {% endmacro %} {# Macro pour carte de statistique cliquable #} {% macro stat_card(title, value, url, icon, color="blue", description=None) %}
{{ title }}
{{ value }}
{% if description %}
{{ description }}
{% endif %}
{{ icon|safe }}
{% endmacro %} {# Macro pour filtres standardisés - Version classique (conservée pour compatibilité) #} {% macro filter_section(filters, current_values={}) %}
{% for filter in filters %}
{% endfor %}
{% if caller %}
{{ caller() }}
{% endif %}
{% endmacro %} {# Macro pour page layout standardisé avec hero section #} {% macro page_layout(title, subtitle=None, breadcrumbs=[], actions=[]) %} {% if breadcrumbs %} {% endif %}

{{ title }}

{% if subtitle %}

{{ subtitle }}

{% endif %}

{{ moment().format('dddd D MMMM YYYY') if moment else 'Lundi 16 août 2025' }}

{{ caller() }} {% endmacro %} {# Macro pour section de contenu standardisée #} {% macro content_section(title=None, description=None, actions=[], classes="") %}
{% if title %}

{{ title }}

{% if description %}

{{ description }}

{% endif %}
{% if actions %} {% endif %}
{% endif %}
{{ caller() }}
{% endmacro %} {# Macro pour état vide unifié #} {% macro empty_state(title, description, icon, action=None, secondary_action=None) %}
{{ icon|safe }}

{{ title }}

{{ description }}

{% if action %} {% if action.icon %}{{ action.icon|safe }}{% endif %} {{ action.text }} {% endif %} {% if secondary_action %}

💡 Astuce : {{ secondary_action.text }}

{% endif %}
{% endmacro %} {# Macro pour filtres simplifiés et discrets #} {% macro simple_filter_section(filters_config, current_values={}, total_items=0, filtered_items=0) %}
{{ filtered_items }}/{{ total_items }}
{% if filters_config.trimester %}
Trimestre: {% for i in range(1, 4) %} {% endfor %}
{% endif %} {% if filters_config.class_options %}
Classe: {% for option in filters_config.class_options %} {% endfor %}
{% endif %} {% if filters_config.correction %}
État:
{% endif %}
{% if caller %} {{ caller() }} {% endif %}
{% endmacro %} {# Macro pour tableau standardisé #} {% macro data_table(headers, rows, actions_column=False, zebra=True) %}
{% for header in headers %} {% endfor %} {% if actions_column %} {% endif %} {% for row in rows %} {% for cell in row.cells %} {% endfor %} {% if actions_column and row.actions %} {% endif %} {% endfor %}
{{ header }} Actions
{{ cell|safe }}
{% for action in row.actions %} {{ action.text }} {% endfor %}
{% endmacro %} {# Macro pour liste d'éléments uniformisée #} {% macro item_list(items, show_meta=True, show_actions=True) %}
{% for item in items %}
{% if item.avatar %}
{{ item.avatar.content|safe }}
{% endif %}

{{ item.title }}

{% if show_meta and item.meta %}
{% for meta in item.meta %} {% if meta.icon %}{{ meta.icon|safe }}{% endif %} {{ meta.text }} {% if not loop.last %}{% endif %} {% endfor %}
{% endif %}
{% if show_actions and item.indicators %}
{% for indicator in item.indicators %} {{ indicator|safe }} {% endfor %}
{% endif %}
{% endfor %}
{% endmacro %} {# Macro pour notifications/alertes uniformisées #} {% macro alert(type, title, message, dismissible=True, icon=True) %} {% set alert_classes = { 'info': 'bg-blue-50 border-blue-200 text-blue-800', 'success': 'bg-green-50 border-green-200 text-green-800', 'warning': 'bg-orange-50 border-orange-200 text-orange-800', 'error': 'bg-red-50 border-red-200 text-red-800' } %} {% set icons = { 'info': '', 'success': '', 'warning': '', 'error': '' } %} {% endmacro %}