{{-- Training Sessions — calendar (this month / next month / year) + agenda. From EmployeeSessionController@index: $filter, $anchor, $periodLabel, $sessions, $byDate, $weeks, $myStatuses --}} @extends('layouts.app') @section('title', 'Training Sessions') @section('content') @include('employee._flash') {{-- Toolbar: filter segmented control + period label --}}
@php $filters = ['this_month' => 'This Month', 'next_month' => 'Next Month', 'year' => 'This Year']; @endphp @foreach($filters as $key => $label) {{ $label }} @endforeach
calendar_month {{ $periodLabel }}
{{-- Calendar grid (month views only) --}} @if($weeks)
{{-- Weekday header --}}
@foreach(['Mon','Tue','Wed','Thu','Fri','Sat','Sun'] as $dow)
{{ $dow }}
@endforeach
{{-- Weeks --}}
@foreach($weeks as $week)
@foreach($week as $day)
{{ $day['date']->format('j') }}
@foreach($day['sessions']->take(3) as $s) @php $st = $myStatuses[$s->id] ?? null; $booked = $st && $st !== 'cancelled'; $pill = $booked ? 'bg-primary/10 text-primary ring-1 ring-primary/30' : ($s->format === 'in_person' ? 'bg-secondary-container text-on-secondary-container' : 'bg-surface-container-high text-secondary'); @endphp {{ \Carbon\Carbon::parse($s->start_time)->format('H:i') }} {{ $s->title }} @endforeach @if($day['sessions']->count() > 3) +{{ $day['sessions']->count() - 3 }} more @endif
@endforeach
@endforeach
{{-- Legend --}}
Registered In-Person Online
@endif {{-- Agenda --}}
event_note

{{ $filter === 'year' ? 'Sessions This Year' : 'Sessions in ' . $periodLabel }}

({{ $sessions->count() }})
@if($sessions->isEmpty())
calendar_today

No sessions in this period

Try another range, or check back once new dates are scheduled.

@elseif($filter === 'year') {{-- Year view: group agenda by month --}} @foreach($sessions->groupBy(fn ($s) => $s->session_date->format('Y-m')) as $monthKey => $monthSessions)

{{ \Carbon\Carbon::createFromFormat('Y-m', $monthKey)->format('F Y') }} · {{ $monthSessions->count() }}

@foreach($monthSessions as $session) @include('employee._session-agenda-item') @endforeach
@endforeach @else
@foreach($sessions as $session) @include('employee._session-agenda-item') @endforeach
@endif @endsection