{% extends 'base.html.twig' %}

{% block title %}Reservations index{% endblock %}
{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->

{% endblock %}
{% block body %}
    <h1>Reservations index</h1>

    <table class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>DateHeure</th>
                <th>Nb_de_prsn</th>
                <th>actions</th>
            </tr>
        </thead>
        <tbody>
        {% for reservation in reservations %}
            <tr>
                <td>{{ reservation.id }}</td>
                <td>{{ reservation.DateHeure ? reservation.DateHeure|date('Y-m-d H:i:s') : '' }}</td>
                <td>{{ reservation.NbDePrsn }}</td>
                <td>
                    <form method="post" action="{{ path('app_reservations_delete', {'id': reservation.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
                        <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ reservation.id) }}">
                        {{ include('reservations/_delete_form.html.twig') }}
                    </form>
                    <a href="{{ path('app_reservations_edit', {'id': reservation.id}) }}">Modifier</a>
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="4">Aucun enregistrement trouvé</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <a href="{{ path('app_reservations_new') }}">Créer une réservation</a>
{% endblock %}
