@include('partials.doctor-header', ['doctor' => $doctor])

Calendario

Clicca nella timeline per inserire un paziente. Clicca un appuntamento per vedere dettagli.

@php $base = \Carbon\Carbon::create($calBaseYear, $calBaseMonth, 1); $months = [ $base->copy(), $base->copy()->addMonth(), $base->copy()->addMonths(2), ]; $selectedStart = \Carbon\Carbon::parse($weekStartDate); $selectedEnd = $selectedStart->copy()->addDays(6); $selectedDayYmd = $selectedStart->toDateString(); $todayYmd = now()->toDateString(); @endphp
Cambia data
Settimana: {{ \Carbon\Carbon::parse($weekStartDate)->format('d/m/Y') }} – {{ \Carbon\Carbon::parse($weekStartDate)->addDays(6)->format('d/m/Y') }}
@foreach($months as $m) @php $start = $m->copy()->startOfMonth(); $firstDow = $start->dayOfWeekIso; $daysInMonth = $m->daysInMonth; $label = $m->translatedFormat('F Y'); $pad = $firstDow - 1; $today = \Carbon\Carbon::today(); $isRealCurrentMonth = $m->month === $today->month && $m->year === $today->year; @endphp
{{ $label }}
L
M
M
G
V
S
D
@for($i=0; $i<$pad; $i++)
@endfor @for($d=1; $d<=$daysInMonth; $d++) @php $ymd = $m->copy()->day($d)->toDateString(); $isToday = $ymd === $todayYmd; $isSelectedWeek = \Carbon\Carbon::parse($ymd)->betweenIncluded($selectedStart, $selectedEnd); $isSelectedDay = $ymd === $selectedDayYmd; if ($isToday) { $calClass = 'bg-sky-600 text-white border-sky-600 hover:bg-sky-700'; } elseif ($isSelectedDay) { $calClass = 'bg-emerald-700 text-white border-emerald-700 hover:bg-emerald-800'; } elseif ($isSelectedWeek) { $calClass = 'bg-emerald-100 text-emerald-900 border-emerald-200 hover:bg-emerald-200'; } else { $calClass = 'bg-white text-gray-800 border-gray-200 hover:bg-gray-50'; } @endphp @endfor
@endforeach
@if (session()->has('success'))
{{ session('success') }}
@endif
@foreach($weekDays as $day) @php $date = $day['date']; $row = $timelineRows[$date] ?? ['availBlocks' => [], 'apptBlocks' => [], 'cancelledBlocks' => []]; $availBlocks = $row['availBlocks'] ?? []; $apptBlocks = $row['apptBlocks'] ?? []; $cancelledBlocks = $row['cancelledBlocks'] ?? []; $total = (int) $timelineTotalMinutes; $zoomWidth = max(700, intval(1600 * $zoomPercent / 100)); $availRanges = []; foreach ($availBlocks as $ab) { $startMin = (int) round(($ab['left'] / 100) * $timelineTotalMinutes); $endMin = (int) round((($ab['left'] + $ab['width']) / 100) * $timelineTotalMinutes); $availRanges[] = [$startMin, $endMin]; } @endphp
{{ $day['label'] }}
@foreach($timelineHours as $h) @php $minFromStart = ($h * 60) - ((int)substr($timelineStart,0,2) * 60); $left = ($minFromStart / $total) * 100; @endphp @if($left >= 0 && $left <= 100)
{{ str_pad($h, 2, '0', STR_PAD_LEFT) }}:00
@endif @endforeach
@for($m = 0; $m <= $timelineTotalMinutes; $m += $stepMinutes) @php $isHour = $m % 60 === 0; $isQuarter = $m % 15 === 0; $lineClass = $isHour ? 'bg-gray-300' : ($isQuarter ? 'bg-gray-200' : 'bg-gray-100'); $lineWidth = $isHour ? '2px' : '1px'; @endphp
@endfor
@foreach($availBlocks as $b)
@endforeach @foreach($apptBlocks as $b) @php $fullName = trim((string)($b['patient_name'] ?? '')); $label = trim((string)($b['patient_label'] ?? $fullName)); if ($label === '') $label = 'Paziente'; $parts = preg_split('/\s+/', $label); $line1 = $parts ? ($parts[0] ?? $label) : $label; $line2 = count($parts) > 1 ? implode(' ', array_slice($parts, 1)) : ($b['service_name'] ?? ''); @endphp
{{ $b['time'] ?? '' }} @if(!empty($b['service_name'])) · {{ $b['service_name'] }} @endif
{{ $b['patient_name'] ?? '' }}
@endforeach
@if(!empty($cancelledBlocks))
@foreach($cancelledBlocks as $c) @php $p = trim((string)($c['patient_name'] ?? $c['patient_label'] ?? 'Paziente')); if ($p === '') $p = 'Paziente'; $ini = $c['patient_initials'] ?? ''; $cid = $c['appointment_id'] ?? null; @endphp
{{ $ini !== '' ? $ini : '×' }}
{{ $p }}
×
@endforeach
@endif
@endforeach
{{-- MODAL: NUOVO APPUNTAMENTO --}} @if($showBookingModal)
Nuovo appuntamento
Slot: {{ \Carbon\Carbon::parse($selectedSlot)->format('d/m/Y H:i') }}
@if($showPatientSuggestions && !empty($patientSuggestions))
@foreach($patientSuggestions as $p) @endforeach
@endif @error('patient_name')
{{ $message }}
@enderror @if($bookingPatientStatus === 'existing' && !empty($bookingPatientMatch))
Paziente trovato: {{ $bookingPatientMatch['name'] ?? '' }} @if(!empty($bookingPatientMatch['email'])) — {{ $bookingPatientMatch['email'] }} @endif
@elseif($bookingPatientStatus === 'new' && !empty($patient_name))
Nuovo paziente: verrà creato al salvataggio.
@endif
@error('patient_name')
{{ $message }}
@enderror
@error('patient_email')
{{ $message }}
@enderror @if($bookingPatientStatus === 'existing' && !empty($bookingPatientMatch))
Paziente già presente nel database.
@elseif($bookingPatientStatus === 'new' && !empty($patient_email))
Nuovo paziente: verrà creato automaticamente al salvataggio.
@elseif($bookingPatientStatus === 'email_taken')
Questa email è già usata da un account non-paziente. Usa un'altra email oppure lascia vuoto il campo email.
@endif
@error('patient_phone')
{{ $message }}
@enderror
@if (!empty($services))
@error('service_id')
{{ $message }}
@enderror
@endif
@endif {{-- MODAL: DETTAGLIO APPUNTAMENTO --}} @if($showAppointmentModal && $openAppointmentData)
Appuntamento
{{ $openAppointmentData['date_label'] }} · {{ $openAppointmentData['time_label'] }} · {{ $openAppointmentData['status'] }}
Paziente
{{ $openAppointmentData['patient_name'] ?: '—' }}
@if(!empty($openAppointmentData['patient_id'])) @endif
Email
{{ $openAppointmentData['patient_email'] ?: '—' }}
Telefono
{{ $openAppointmentData['patient_phone'] ?: '—' }}
@if(!empty($openAppointmentData['service']))
Prestazione
{{ $openAppointmentData['service']['name'] }}
@endif
@if($openAppointmentData['status'] === 'cancelled')
@else
@endif
@endif