{% extends 'base.html.twig' %} {% block title %}Détails Absences{% endblock %} {% block stylesheet %} {% endblock %} {% block body %}

Schématisation absences

{% set isAbsenceDay = false %} {% for day in 1..31 %} {% endfor %} {% set months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'] %} {% for monthIndex, month in months %} {% for day in 1..31 %} {% for absence in absences %} {% set absenceStartMonth = absence.dateDebut|date('m') %} {% set absenceStartDay = absence.dateDebut|date('d') %} {% set absenceEndMonth = absence.dateFin|date('m') %} {% set absenceEndDay = absence.dateFin|date('d') %} {% set absenceStartYear = absence.dateDebut|date('Y') %} {% set absenceEndYear = absence.dateFin|date('Y') %} {% set currentYear = "now"|date('Y') %} {# Condition principale pour les jours d'absence #} {% if (isAbsenceDay==false and (monthIndex + 1 == absenceStartMonth and day >= absenceStartDay and currentYear == absenceStartYear) and (monthIndex + 1 == absenceEndMonth and day <= absenceEndDay and currentYear == absenceStartYear) )%} {% set isAbsenceDay = true %} {% endif %} {# Condition supplémentaire pour les jours entre un endDay et un startDay dans le même mois #} {% if monthIndex + 1 == absenceStartMonth and monthIndex + 1 == absenceEndMonth and day > absenceEndDay and day < absenceStartDay %} {% set isAbsenceDay = false %} {% endif %} {% endfor %} {% if isAbsenceDay %} {% else %} {% endif %} {% endfor %} {% endfor %}
 {{ day }}
{{ months[monthIndex] }}
{% endblock %} {% block javascripts %} {{ parent() }} {% endblock %}