{% extends '@App/app.html.twig' %} {% block title %}Planning mensuel{% endblock %} {% block page_header %}{% endblock %} {% block content %} {% set french_days = { 1: 'L', 2: 'M', 3: 'M', 4: 'J', 5: 'V', 6: 'S', 7: 'D' } %} {% set french_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 current_query = app.request.query.all %} {% set month_label = french_months[calendar.start|date('n')] ~ ' ' ~ calendar.start|date('Y') %}
Plannings{{ month_label }}
Exporter {% if calendar.isEditable %}
{% endif %} Nouveau shift

{{ month_label }}

Salariés ({{ calendar.rows|length }})
{% for column in calendar.columns %} {% if column.type == 'day' %}
{{ french_days[column.date|date('N')] }} {{ column.date|date('j') }}
{% else %}
Sem.
{% endif %} {% endfor %}
Mois
{% for row in calendar.rows %} {% set salarie = row.employee %} {% set photo_path = salarie.photo ? salarie.photo|trim : null %} {% set avatar_src = photo_path ? (photo_path starts with 'http://' or photo_path starts with 'https://' ? photo_path : asset(photo_path starts with '/' ? photo_path|slice(1) : photo_path)) : null %} {% set initials = (salarie.prenom|default('?')|first ~ salarie.nom|default('')|first)|upper %}
{% if avatar_src %} {{ salarie }} {% else %} {{ initials }} {% endif %}
{{ salarie }} {{ salarie.employeeService ? salarie.employeeService.nom : (salarie.employeeJob ? salarie.employeeJob.nom : 'Employé') }}
{% for column in calendar.columns %} {% if column.type == 'week' %} {% set week_minutes = row.weekTotals[column.weekKey]|default(0) %}
{{ (week_minutes / 60)|number_format(week_minutes % 60 == 0 ? 0 : 1, ',', ' ') }}h
{% else %} {% set day_key = column.key %} {% set cell = row.cells[day_key] %} {% set editable_schedule = calendar.editableScheduleByDate[day_key]|default(null) %}
{% if cell.leaves is not empty %} {% set leave = cell.leaves|first %} {% set leave_label = leave.leaveType ? leave.leaveType.nom|lower : '' %} {% set leave_tone = leave_label matches '/malad|arrêt/' ? 'sick' : 'leave' %}
{{ leave_tone == 'sick' ? 'Maladie' : 'Congé' }}
{% else %} {% for assignment in cell.assignments|slice(0, 2) %} {% set shift = assignment.shift %} {% set start_hour = shift.startTime ? shift.startTime|date('H') : '08' %} {% set tone = start_hour >= '18' or start_hour < '06' ? 'night' : (start_hour >= '12' ? 'afternoon' : 'morning') %} {% set shift_schedule = shift.schedule %} {% set shift_editable = shift_schedule and shift_schedule.status in ['draft', 'ready'] %} {% set shift_state = shift_editable ? 'draft' : 'published' %}
{{ shift.startTime|date('H:i') }}-{{ shift.endTime|date('H:i') }} {{ shift.title ?: (tone == 'night' ? 'Nuit' : 'Matin') }}
{% endfor %} {% if cell.assignments|length > 2 %} +{{ cell.assignments|length - 2 }} {% elseif editable_schedule and cell.assignments is empty %} {% endif %} {% endif %}
{% endif %} {% endfor %}
{{ (row.totalMinutes / 60)|number_format(row.totalMinutes % 60 == 0 ? 0 : 1, ',', ' ') }}h
{% else %}
Aucun salarié actif.
{% endfor %}
{% endblock %}