{% set months = { 1:'Janvier', 2:'Février', 3:'Mars', 4:'Avril', 5:'Mai', 6:'Juin', 7:'Juillet', 8:'Août', 9:'Septembre', 10:'Octobre', 11:'Novembre', 12:'Décembre' } %} {% set dow = ['Lu','Ma','Me','Je','Ve','Sa','Di'] %} {% set dayColWidthMm = 5 %} {# Ligne 1 : mois #} {% set currentMonth = '' %} {% set monthCount = 0 %} {% for day in days %} {% set m = day.date|date('n') %} {% set monthLabel = months[m] ~ ' ' ~ (day.date|date('Y')) %} {% if monthLabel != currentMonth %} {% if not loop.first %} {% endif %} {% set currentMonth = monthLabel %} {% set monthCount = 1 %} {% else %} {% set monthCount = monthCount + 1 %} {% endif %} {% if loop.last %} {% endif %} {% endfor %} {# Ligne 2 : numéro de semaine #} {% set currentWeek = '' %} {% set weekCount = 0 %} {% for day in days %} {% set weekLabel = 'S' ~ (day.date|date('W')) %} {% if weekLabel != currentWeek %} {% if not loop.first %} {% endif %} {% set currentWeek = weekLabel %} {% set weekCount = 1 %} {% else %} {% set weekCount = weekCount + 1 %} {% endif %} {% if loop.last %} {% endif %} {% endfor %} {# Ligne 3 : jour semaine #} {% for day in days %} {% set idx = (day.date|date('N') - 1) %} {% set isMonthEnd = (not loop.last) and (days[loop.index].date|date('n') != day.date|date('n')) %} {% set isWeekend = day.date|date('N') in [6, 7] %} {% endfor %} {# Ligne 4 : numéro #} {% for day in days %} {% set isMonthEnd = (not loop.last) and (days[loop.index].date|date('n') != day.date|date('n')) %} {% set isWeekend = day.date|date('N') in [6, 7] %} {% endfor %} {% set currentSiteId = null %} {% for employee in employees %} {% set site = employee.site %} {% set siteId = site ? site.id : 'none' %} {% set siteName = site ? site.name : 'Sans site' %} {# couleur de fond du site (si tu as un champ color) #} {% set siteColor = '#ffd7d7' %} {% if site and attribute(site, 'color') is defined and site.color %} {% set siteColor = site.color %} {% endif %} {# Nouvelle section site #} {% if siteId != currentSiteId %} {% set currentSiteId = siteId %} {% endif %} {# Ligne employé #} {% for day in days %} {% set isHoliday = holidayMap[day.date] ?? null %} {% set info = absenceMap[employee.id][day.date] ?? null %} {% set hasFormation = formationMap[employee.id][day.date] ?? false %} {% set isFormationOnly = hasFormation and not info and not isHoliday %} {% set isMonthEnd = (not loop.last) and (days[loop.index].date|date('n') != day.date|date('n')) %} {% set isWeekend = day.date|date('N') in [6, 7] %} {% endfor %} {% else %} {% endfor %}
{{ currentMonth }}{{ currentMonth }}
{{ currentWeek }}{{ currentWeek }}
{{ dow[idx] }}
{{ day.label }}
{{ siteName }}
{{ employee.firstName }}{% if employee.lastName %} {{ employee.lastName|first }}.{% endif %} {% if isHoliday %} Férié {% elseif isFormationOnly %} F {% elseif info %} {% if info.half %}
{% if info.halfLabel == 'AM' %}{{ info.code }}{% endif %}
{% if info.halfLabel == 'PM' %}{{ info.code }}{% endif %}
{% else %} {{ info.code }}{% if hasFormation %}*{% endif %} {% endif %} {% endif %}
Aucun employé.