@extends('layouts.provider') @php $pageWidth = 'narrow'; @endphp @section('title', 'Calendrier') @section('page-title', 'Calendrier') @section('footer-class', 'footer-spacing') @section('content')
@php $months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre']; $selectedDate = now()->parse($date); @endphp @if($view === 'month')

{{ $months[(int)now()->parse($date)->format('n') - 1] }} {{ now()->parse($date)->format('Y') }}

@elseif($view === 'year')
@else

@php $monthIndex = (int)now()->parse($date)->format('n') - 1; $weekNumber = $selectedDate->week; @endphp {{ $months[$monthIndex] }} {{ now()->parse($date)->format('Y') }} · Semaine {{ $weekNumber }}

@php $startOfWeek = $selectedDate->copy()->startOfWeek(); $daysOfWeek = ['L', 'M', 'M', 'J', 'V', 'S', 'D']; @endphp
@for($i = 0; $i < 7; $i++) @php $day = $startOfWeek->copy()->addDays($i); $isSelected = $day->format('Y-m-d') === $selectedDate->format('Y-m-d'); $isToday = $day->isToday(); $dayAppointments = $appointments->filter(fn($apt) => $apt->start_time->format('Y-m-d') === $day->format('Y-m-d')); $hasAppointments = $dayAppointments->count() > 0; @endphp @if($isToday && !$isSelected) @endif {{ $daysOfWeek[$i] }} {{ $day->format('d') }} @if($hasAppointments && !$isSelected) @endif @endfor
@if($view === 'day' && $selectedDate->format('Y-m-d') !== now()->format('Y-m-d')) @endif
@endif @if($view === 'day')

@php $daysLong = ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi']; $dayOfWeek = $daysLong[$selectedDate->dayOfWeek]; $monthIndex = (int)$selectedDate->format('n') - 1; @endphp {{ $dayOfWeek }}, {{ $selectedDate->format('d') }} {{ $months[$monthIndex] }} {{ $selectedDate->format('Y') }}

@endif @if($view === 'year')
@for($m = 1; $m <= 12; $m++) @php $monthDate = now()->parse($date)->month($m)->startOfMonth(); $monthEnd = $monthDate->copy()->endOfMonth(); $monthAppts = $appointments->filter(function($apt) use ($monthDate, $monthEnd) { return $apt->start_time->between($monthDate, $monthEnd); }); $total = $monthAppts->count(); @endphp

{{ $months[$m - 1] }}

{{ $total }} RDV
@endfor
@elseif($view === 'month') @php $currentMonth = now()->parse($date); $startOfMonth = $currentMonth->copy()->startOfMonth(); $endOfMonth = $currentMonth->copy()->endOfMonth(); $startDate = $startOfMonth->copy()->startOfWeek(); $endDate = $endOfMonth->copy()->endOfWeek(); @endphp
@foreach(['Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam', 'Dim'] as $day)
{{ $day }}
@endforeach
@php $currentDay = $startDate->copy(); @endphp @while($currentDay->lte($endDate)) @php $dayStr = $currentDay->format('Y-m-d'); $isCurrentMonth = $currentDay->month === $currentMonth->month && $currentDay->year === $currentMonth->year; $isToday = $currentDay->isToday(); $dayAppts = $appointments->filter(fn($apt) => $apt->start_time->format('Y-m-d') === $dayStr); @endphp
{{ $currentDay->format('d') }}
@if($dayAppts->count() > 0)
{{ $dayAppts->count() }} RDV
@endif
@php $currentDay->addDay(); @endphp @endwhile
@else
@for($hour = 6; $hour <= 20; $hour++) @endfor
Terminé
Annulé
Programmé
Séance facturée
Séance non facturée
Clic droit (ou long clic) pour changer le statut
@endif
@endsection