{% extends "base.html" %}
{% block title %}Fermetures — Planning{% endblock %}
{% block content %}
<div class="container-fluid">
    <h1 class="mb-4"><i class="bi bi-calendar-x"></i> Fermetures du collège</h1>
    <div class="card"><div class="card-body">
        <form method="POST" action="{{ url_for('planning.closure_add') }}">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <div class="row mb-3">
                <div class="col-md-4"><label class="form-label">Date début</label><input type="date" name="start_date" class="form-control"></div>
                <div class="col-md-4"><label class="form-label">Date fin</label><input type="date" name="end_date" class="form-control"></div>
                <div class="col-md-4"><label class="form-label">Raison</label><input type="text" name="reason" class="form-control"></div>
            </div>
            <button type="submit" class="btn btn-primary"><i class="bi bi-plus"></i> Ajouter</button>
        </form>
        {% if closures %}
        <table class="table table-hover mt-3">
            <thead><tr><th>Du</th><th>Au</th><th>Raison</th><th>Actions</th></tr></thead>
            <tbody>
                {% for c in closures %}
                <tr><td>{{ c.start_date }}</td><td>{{ c.end_date }}</td><td>{{ c.reason }}</td>
                <td><a href="{{ url_for('planning.closure_delete', id=c.id) }}" class="btn btn-sm btn-outline-danger">Supprimer</a></td></tr>
                {% endfor %}
            </tbody>
        </table>
        {% else %}<p class="text-muted mt-3">Aucune fermeture enregistrée.</p>{% endif %}
    </div></div>
</div>
{% endblock %}