{% extends '@App/app.html.twig' %} {% block title %}Planning hebdomadaire{% endblock %} {% block page_header %}{% endblock %} {% block content %} {% set french_days = { 1: 'Lundi', 2: 'Mardi', 3: 'Mercredi', 4: 'Jeudi', 5: 'Vendredi', 6: 'Samedi', 7: 'Dimanche' } %} {% 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 previous_start = calendar.start|date_modify('-7 days')|date('Y-m-d') %} {% set next_start = calendar.start|date_modify('+7 days')|date('Y-m-d') %} {% set completion = calendar.contractMinutes > 0 ? ((calendar.totalMinutes / calendar.contractMinutes * 100)|round(0, 'floor')) : 0 %} {% set completion = completion > 100 ? 100 : completion %} {% set week_is_editable = calendar.editableSchedule is not empty %} {% set schedule_count = calendar.schedules|length %} {% set week_is_published = schedule_count > 0 and not week_is_editable %} {% set conflict_count = conflicts|length %} {% set show_avatars = settings is defined ? settings.getOption('showAvatars', true) : true %} {% set show_breaks = settings is defined ? settings.getOption('showBreaks', true) : true %} {% set color_by = settings is defined ? settings.getOption('colorBy', 'service') : 'service' %}
Plannings Gestion des Plannings

Planning Hebdomadaire

Gestion des horaires - Semaine {{ calendar.start|date('W') }} ({{ calendar.start|date('d/m/Y') }} - {{ calendar.end|date('d/m/Y') }})

{% if schedule_count == 0 %}
{% elseif week_is_editable %}
{% elseif week_is_published %} {% endif %}
Matin A-Midi Nuit Congé Maladie
Salarié
{% for day in calendar.days %}
{{ french_days[day|date('N')]|upper }} {{ day|date('j') }} {{ french_months[day|date('n')] }}
{% endfor %}
{% for group in calendar.rowGroups %}
{{ group.label }} {{ group.employeeCount }} salarié{{ group.employeeCount > 1 ? 's' : '' }}
{% for row in group.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 show_avatars %} {% if avatar_src %} {{ salarie }} {% else %} {{ initials }} {% endif %} {% endif %}
{{ salarie }} {{ salarie.employeeJob ? salarie.employeeJob.nom : salarie.poste|default('Salarié') }}
{% for leave in row.leaveSpans %}
{{ leave.tone == 'sick' ? 'Arrêt maladie' : 'Congé payé' }} {% if leave.request.startDate and leave.request.endDate %} {{ leave.request.startDate|date('d/m') }} → {{ leave.request.endDate|date('d/m') }} {% endif %}
{% endfor %} {% for day in calendar.days %} {% set day_key = day|date('Y-m-d') %} {% set cell = row.cells[day_key] %}
{% for assignment in cell.assignments %} {% 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 = week_is_editable and shift_schedule and shift_schedule.id == calendar.editableSchedule.id %} {% set shift_unpublished = shift_schedule and shift_schedule.status in ['draft', 'ready'] %} {% set shift_state = shift_unpublished ? 'draft' : 'published' %} {% set status_label = shift_unpublished ? (shift_schedule.status == 'ready' ? 'Planifié' : 'Brouillon') : 'Publié' %} {% set shift_conflicts = conflicts|filter(conflict => (conflict.shift and conflict.shift.id == shift.id) or (conflict.assignment and conflict.assignment.id == assignment.id)) %} {% set shift_has_conflict = shift_conflicts|length > 0 %} {% set shift_alert_message = shift_conflicts|map(conflict => conflict.message)|join(' · ') %}
{{ shift.title ?: (tone == 'afternoon' ? 'A-Midi' : (tone == 'night' ? 'Nuit' : 'Matin')) }} {% if shift_has_conflict %} {% elseif shift_state == 'published' %} {% endif %}
{{ shift.startTime|date('H:i') }}-{{ shift.endTime|date('H:i') }} {% if show_breaks and shift.breakDurationMinutes > 0 %} Pause: {{ shift.breakDurationMinutes }} min {% elseif shift.service %} {{ shift.service }} {% else %} {{ (shift.netDurationMinutes / 60)|number_format(1, ',', ' ') }}h {% endif %} {{ status_label }}
{% else %} {% if week_is_editable and not cell.coveredByLeave %} {% endif %} {% endfor %}
{% endfor %}
{% endfor %} {% else %}
Aucun salarié actif.
{% endfor %}
Publié Brouillon / Modifié Congé Arrêt maladie Nuit Conflit
Affichage de {{ calendar.rows|length }} salariés sur {{ calendar.employees|length }} {% if calendar.employees|length > calendar.rows|length %} Tout afficher {% endif %}

Conflits

{% if conflicts|length > 0 %}BLOQUANT{% endif %}
{% for conflict in conflicts|slice(0, 2) %}
{{ conflict.type|replace({'_': ' '})|title }} {{ conflict.salarie ? conflict.salarie ~ ' - ' : '' }}{{ conflict.message }} {% if conflict.schedule %} Régler {% endif %}
{% else %}
Aucun conflit ouvert La semaine ne contient pas d'alerte active.
{% endfor %}

Répartition

{{ completion }}%

Modèles

{% for template in templates %} {{ template.nom }} {{ template.service ? template.service.nom : 'Tous services' }} {% else %}
Aucun modèle actif Créez un modèle pour accélérer les prochaines semaines.
{% endfor %} Gérer les modèles
{% if week_is_editable and conflict_count > 0 %} {% endif %} {% if week_is_published %} {% endif %}
{% endblock %}