{% set french_days = { 1: 'Lun', 2: 'Mar', 3: 'Mer', 4: 'Jeu', 5: 'Ven', 6: 'Sam', 7: 'Dim' } %} {% set has_schedule = schedule is defined and schedule %}
Salariés
{% for day in has_schedule ? grid.days : days|default([]) %} {% set day_date = has_schedule ? day.date : day %}
{{ french_days[day_date|date('N')] }} {{ day_date|date('d/m') }} {% if has_schedule %} {{ day.shiftCount }} shift{{ day.shiftCount > 1 ? 's' : '' }} · {{ (day.totalMinutes / 60)|number_format(1, ',', ' ') }} h {% endif %}
{% endfor %} {% if has_schedule %} {% for employee in grid.employees %} {% include '@Planning/planning/_employee_row.html.twig' with {employee: employee} %} {% for day in grid.days %} {% include '@Planning/planning/_day_cell.html.twig' with { schedule: schedule, employee: employee, day: day, cell: grid.cells[employee.id][day.key]|default({assignments: [], leaves: [], sickLeaves: [], availabilities: [], conflicts: []}) } %} {% endfor %} {% else %}
Aucun salarié actif.
{% endfor %} {% else %} {% for salarie in employees|default([]) %} {% 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.employeeJob ? salarie.employeeJob.nom : salarie.poste|default('') }}
{% for day in days|default([]) %} {% set day_key = day|date('Y-m-d') %}
{% set has_assignment = false %} {% for assignment in assignments|default([]) %} {% if assignment.salarie and assignment.salarie.id == salarie.id and assignment.shift and assignment.shift.date and assignment.shift.date|date('Y-m-d') == day_key and assignment.status != 'cancelled' %} {% set has_assignment = true %} {% include '@Planning/planning/_shift_card.html.twig' with {shift: assignment.shift, assignment: assignment} %} {% endif %} {% endfor %} {% if not has_assignment %} - {% endif %}
{% endfor %} {% else %}
Aucun salarié actif.
{% endfor %} {% endif %}