@extends('layouts.app') @section('title', 'Planning équipe · ' . $organization->name) @section('eyebrow', 'Organiser') @section('heading', 'Planning équipe') @section('content') @php $previousMonth = $month->copy()->subMonth()->format('Y-m'); $nextMonth = $month->copy()->addMonth()->format('Y-m'); $dayNames = [ 1 => 'Lundi', 2 => 'Mardi', 3 => 'Mercredi', 4 => 'Jeudi', 5 => 'Vendredi', ]; $shiftByName = $shifts->keyBy('name'); $entryCode = function ($entry) use ($shiftByName) { if (!$entry) { return '—'; } if ($entry->entry_type === 'Formation') { return 'FO'; } if ($entry->entry_type === 'Absence') { return str_contains((string) $entry->comment, '[LEAVE]') || $entry->slot === 'CP' ? 'CP' : 'ABS'; } $shift = $shiftByName->get($entry->slot); if ($shift) { return $shift->code; } if (preg_match('/\[CUSTOM:([^\]]+)\]/', (string) $entry->comment)) { return $entry->slot; } return mb_strtoupper(mb_substr($entry->slot, 0, 3)); }; $entryKind = function ($entry) { if (!$entry) { return 'off'; } if ($entry->entry_type === 'Formation') { return 'formation'; } if ($entry->entry_type === 'Absence') { return str_contains((string) $entry->comment, '[LEAVE]') || $entry->slot === 'CP' ? 'leave' : 'absence'; } return str_contains((string) $entry->comment, '[CUSTOM:') ? 'custom' : 'shift'; }; $closureForDate = function ($date) use ($closures) { return $closures->first(function ($closure) use ($date) { return \Carbon\Carbon::parse($date)->betweenIncluded( \Carbon\Carbon::parse($closure->start_date), \Carbon\Carbon::parse($closure->end_date) ); }); }; @endphp
{{ ucfirst($month->translatedFormat('F Y')) }}
@if($canEdit) Paramétrer l’équipe @else Consultation uniquement @endif

{{ ucfirst($month->translatedFormat('F Y')) }} — planning mensuel

Cliquez sur une cellule pour modifier le poste ou enregistrer une exception individuelle.

@php $redDays = collect($coverage) ->where('state', 'red') ->count(); @endphp {{ $redDays ? $redDays . ' jour(s) avec alerte' : 'Mois conforme' }}
@foreach($shifts as $shift) {{ $shift->code }} {{ $shift->name }} · {{ substr($shift->start_time, 0, 5) }} – {{ substr($shift->end_time, 0, 5) }} @endforeach @foreach($sections as $section) {{ $section->name }} · {{ $section->capacity }} places @endforeach
Salariée · section
@foreach($days as $day)
{{ $day['short'] }} {{ $day['date']->day }}
@endforeach
Total
@foreach($employees as $employee) @php $employeeName = trim( $employee->first_name . ' ' . $employee->last_name ); $employeeKey = mb_strtolower($employeeName); $monthHours = 0; @endphp
{{ mb_strtoupper(mb_substr($employee->first_name, 0, 1)) }} {{ mb_strtoupper(mb_substr($employee->last_name, 0, 1)) }} {{ $employeeName }} {{ $employee->job_type }} @if($employee->section) · {{ $employee->section->name }} @endif
@foreach($days as $day) @php $dateKey = $day['key']; $entry = $entries->get( $employeeKey . '|' . $dateKey ); $closure = $closureForDate($dateKey); $code = $entryCode($entry); $kind = $entryKind($entry); $monthHours += (float) ($entry?->planned_hours ?? 0); $shift = $entry ? $shiftByName->get($entry->slot) : null; @endphp
@if($closure && $closure->closure_type === 'Fermeture') @else @endif
@endforeach
{{ number_format($monthHours, 1, ',', ' ') }} h
@endforeach
Encadrement
@foreach($days as $day) @php $state = $coverage[$day['key']]; @endphp
@endforeach
Fermeture complète Journée pédagogique CP · congé individuel FO · formation Encadrement conforme Encadrement insuffisant
@if($canEdit)
@csrf
PLANNING

Modifier une journée

@endif @endsection