{% extends "base.html" %}
{% block title %}Mes formations — GMAO{% endblock %}

{% block content %}

<div class="container-fluid">
    <h1 class="mb-4"><i class="bi bi-mortarboard"></i> Mes formations</h1>
    
    {% if participations %}
    <div class="row">
        {% for participation in participations %}
        {% set training = participation.training %}
        <div class="col-md-6 col-lg-4 mb-3">
            <div class="card h-100">
                <div class="card-body">
                    <h5 class="card-title">{{ training.name }}</h5>
                    <p class="card-text small text-muted">{{ training.start_date.strftime('%d/%m/%Y') if training.start_date else 'Date à confirmer' }} - {{ training.end_date.strftime('%d/%m/%Y') if training.end_date else 'Date à confirmer' }}</p>
                    {% if training.location %}<p class="card-text small"><i class="bi bi-geo-alt"></i> {{ training.location }}</p>{% endif %}
                </div>
                <div class="card-footer">
                    <a href="{{ url_for('trainings.detail', id=training.id) }}" class="btn btn-sm btn-primary">Voir détail</a>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
    {% else %}
    <p class="text-muted">Vous n'êtes inscrit à aucune formation.</p>
    {% endif %}
</div>

{% endblock %}
