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

{% block title %}Reservations index{% endblock %}

{% block head %}
    <head>
        <meta charset="UTF-8">
        <link rel="icon" href="data:image/svg+xml,<svg  xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
        <link href="https://fonts.cdnfonts.com/css/brittany-signature" rel="stylesheet">
    </head>
{% endblock %}

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

{% block container_modal %}
<div id="container_modal">
    <div class="calendar-nav">
        <a href="{{ path('calendar_week', { year: startDate|date('Y'), week: startDate|date('W') - 1 }) }}">← Semaine précédente</a>
        <a href="{{ path('calendar_week', { year: startDate|date('Y'), week: startDate|date('W') + 1 }) }}">Semaine suivante →</a>
    </div>

    <div class="calendar">
        <div class="calendar-header">
            {% for i in 0..6 %}
                <div class="calendar-day">
                    {{ (startDate|date_modify("+" ~ i ~ " days"))|date('D d/m') }}
                </div>
            {% endfor %}
        </div>
        <div class="calendar-body">
            {% for i in 0..6 %}
                <div class="calendar-column">
                    {% set currentDate = startDate|date_modify("+" ~ i ~ " days") %}

                    {% for reservation in reservations %}
                        {% set res_date = reservation.dateHeure|date('Y-m-d') %}
                        {% set res_time = reservation.dateHeure|date('H:i') %}

                        {% if res_date == currentDate|date('Y-m-d') %}
                            <div class="reservation" style="background-color: lightblue;">
                                {{ res_time }} - {{ reservation.nbdeprsn }} pers.
                            </div>
                        {% endif %}
                    {% endfor %}
                </div>
            {% endfor %}
        </div>
    </div>

    <div class="add-reservation">
        <a href="{{ path('app_reservations_new') }}">+ Ajouter une réservation</a>
    </div>


</div>
{% endblock %}
