@extends('layouts.app') @section('title', $event->title) @section('page-title', 'Parent-Teacher Meeting') @section('content') @php // Gather class teacher IDs from children's classes $ctIds = collect(); $actIds = collect(); foreach ($children as $child) { $cls = $child->studentProfile?->class_; if ($cls) { if ($cls->class_teacher_id) $ctIds->push($cls->class_teacher_id); if ($cls->asst_class_teacher_id) $actIds->push($cls->asst_class_teacher_id); } } $ctIds = $ctIds->unique(); $actIds = $actIds->unique(); @endphp
{{-- Back + Event Header --}}

{{ $event->title }}

{{ $event->date->format('l, d M Y') }} · {{ $event->formatted_time }} @if($event->venue) · {{ $event->venue }} @endif

{{-- My Bookings for this event --}} @if($myBookings->where('status', 'booked')->isNotEmpty())

My Booked Slots

@foreach($myBookings->where('status', 'booked') as $booking)

{{ $booking->slot->formatted_time }}

@csrf @method('DELETE')

{{ $booking->slot->teacher->name ?? '—' }} @if($ctIds->contains($booking->slot->teacher_id)) ★ Class Teacher @elseif($actIds->contains($booking->slot->teacher_id)) Asst. CT @endif

For: {{ $booking->student->name ?? '—' }}

@endforeach
@endif {{-- Available Teachers & Slots --}} @if($availableSlots->isNotEmpty())

Available Slots

@foreach($availableSlots as $teacherId => $slots) @php $teacher = $slots->first()->teacher; @endphp
{{-- Teacher Header --}}
{{ strtoupper(substr($teacher->name ?? '?', 0, 1)) }}

{{ $teacher->name ?? 'Unknown' }}

@if($ctIds->contains($teacherId)) ★ Class Teacher @elseif($actIds->contains($teacherId)) Asst. Class Teacher @endif

{{ $teacher->teacherProfile?->specialization ?? '' }} · {{ $slots->count() }} slots available

{{-- Slot Grid --}}
@foreach($slots->sortBy('start_time') as $slot) @endforeach
@endforeach
@else

No available slots

Teachers haven't set their availability yet, or all slots are booked

@endif
{{-- Booking Modal --}} @endsection