{{-- Tooltip stabile (segue il mouse) --}}
{{-- HEADER --}} {{-- CONTROLLI --}}
Medico
{{-- CALENDARIO 3 MESI --}} @php $base = \Carbon\Carbon::create($calBaseYear, $calBaseMonth, 1); $months = [ $base->copy(), $base->copy()->addMonth(), $base->copy()->addMonths(2), ]; $selectedStart = \Carbon\Carbon::parse($weekStart); $selectedEnd = $selectedStart->copy()->addDays(6); $selectedDayYmd = $selectedStart->toDateString(); $todayYmd = now()->toDateString(); @endphp
Cambia data
@foreach($months as $m) @php $start = $m->copy()->startOfMonth(); $firstDow = $start->dayOfWeekIso; // 1..7 $daysInMonth = $m->daysInMonth; $label = $m->translatedFormat('F Y'); $pad = $firstDow - 1; @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; // OGGI: colore diverso (azzurro) 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
{{-- TIMELINE SETTIMANA --}}
@foreach($weekDays as $day) @php $date = is_array($day) ? ($day['date'] ?? null) : $day; $dayLabel = $date ? \Carbon\Carbon::parse($date)->translatedFormat('l d/m/Y') : ''; $visibleDoctors = ($doctorId === 'all') ? $doctors : $doctors->where('id', (int)$doctorId)->values(); $total = (int) $timelineTotalMinutes; @endphp
{{ $dayLabel }}
{{-- intestazione ore --}}
Medico
@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
{{-- righe medici --}}
@foreach($visibleDoctors as $doc) @php $row = $timelineRows[$date][$doc->id] ?? ['availBlocks'=>[], 'apptBlocks'=>[], 'cancelledBlocks'=>[]]; $availBlocks = $row['availBlocks'] ?? []; $apptBlocks = $row['apptBlocks'] ?? []; $cancelledBlocks = $row['cancelledBlocks'] ?? []; // avail ranges in minutes [start,end] $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
{{-- colonna medico --}}
{{ $doc->name }}
{{ $doc->email }}
Fasce: {{ count($availBlocks) }} · App: {{ count($apptBlocks) }}
{{-- timeline + cancelled below --}}
{{-- LANE principale --}}
{{-- hover cell SOLO disponibile: deve stare SOPRA availability (z-20) --}}
{{-- fasce disponibili: overlay chiaro (NO seconda griglia, evita sovrapposizioni) --}} @foreach($availBlocks as $b)
@endforeach {{-- appuntamenti attivi --}} @foreach($apptBlocks as $b) @php $patientLabel = $b['patient_label'] ?? $b['patient_name'] ?? 'Paziente'; $patientInitials = $b['patient_initials'] ?? ''; $serviceName = $b['service_name'] ?? ($b['service_short'] ?? ''); $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)) : $patientInitials; @endphp
{{ $line1 }}
{{ $line2 }}
{{-- popover ancorato allo slot (hover) --}}
@endforeach
{{-- STRIP cancellati sotto (cliccabili + popover + riconferma) --}} @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; $cTime = $c['time'] ?? ''; $cService = $c['service_name'] ?? ($c['service_short'] ?? ''); @endphp
{{ $ini !== '' ? $ini : '×' }}
{{ $p }}
×
{{-- popover hover per cancellati --}}
@endforeach
@endif
@endforeach @if($visibleDoctors->count() === 0)
Nessun medico da mostrare.
@endif
@endforeach
{{-- MODAL PRENOTA --}} @if($showBookingModal)
Nuova prenotazione
@if(!empty($bookingForced))
Attenzione: stai inserendo un appuntamento fuori dalle fasce disponibili (forzatura segreteria).
@endif
@error('bookingDoctorId')
{{ $message }}
@enderror
@error('bookingDate')
{{ $message }}
@enderror
@error('bookingServiceId')
{{ $message }}
@enderror
@error('bookingSelectedSlot')
{{ $message }}
@enderror
@error('patient_name')
{{ $message }}
@enderror @if($showPatientSuggestions && !empty($patientSuggestions))
@foreach($patientSuggestions as $p) @endforeach
@endif @if($bookingPatientStatus === 'existing' && !empty($bookingPatientMatch))
Paziente trovato: {{ $bookingPatientMatch['name'] ?? '' }} @if(!empty($bookingPatientMatch['email'])) — {{ $bookingPatientMatch['email'] }} @endif
Apri scheda
@elseif($bookingPatientStatus === 'new' && !empty($patient_name))
Nuovo paziente: verrà creato al salvataggio.
@endif
@error('patient_phone')
{{ $message }}
@enderror
@error('patient_email')
{{ $message }}
@enderror @if($bookingPatientStatus === 'existing' && !empty($bookingPatientMatch))
Paziente già presente: {{ $bookingPatientMatch['name'] ?? '' }} @if(!empty($bookingPatientMatch['phone'])) — {{ $bookingPatientMatch['phone'] }} @endif
Apri scheda
@elseif($bookingPatientStatus === 'new')
Nuovo paziente: verrà creato automaticamente al salvataggio (se inserisci un'email valida).
@elseif($bookingPatientStatus === 'email_taken')
Questa email è già usata da un account non-paziente. Usa un'altra email oppure lascia vuoto il campo email.
@endif
@endif {{-- MODAL MODIFICA APPUNTAMENTO --}} @if($showEditModal)
Modifica prenotazione
ID: {{ $editingAppointmentId }}
@if($editPatientId) Apri scheda paziente @endif
@error('editDoctorId')
{{ $message }}
@enderror
@error('editDate')
{{ $message }}
@enderror
@error('editServiceId')
{{ $message }}
@enderror
@error('editSelectedSlot')
{{ $message }}
@enderror @if($isRescheduleMode)
Modalità ripianifica attiva (slot ricalcolati).
@endif
@error('editPatientName')
{{ $message }}
@enderror
@error('editPatientPhone')
{{ $message }}
@enderror
@error('editPatientEmail')
{{ $message }}
@enderror
@error('editNotes')
{{ $message }}
@enderror
@endif