@extends('layouts.app') @section('title', 'Training Calendar') @section('content')

Training Calendar

View and manage scheduled training sessions

@php $prevMonth = $month - 1; $prevYear = $year; if ($prevMonth < 1) { $prevMonth = 12; $prevYear = $year - 1; } $nextMonth = $month + 1; $nextYear = $year; if ($nextMonth > 12) { $nextMonth = 1; $nextYear = $year + 1; } $filterParams = request()->except(['year', 'month']); $prevParams = array_merge(['year' => $prevYear, 'month' => $prevMonth], $filterParams); $nextParams = array_merge(['year' => $nextYear, 'month' => $nextMonth], $filterParams); @endphp

{{ \Carbon\Carbon::create($year, $month, 1)->format('F Y') }}

Today
@if(request()->hasAny(['status', 'session_type'])) Clear @endif
@foreach(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as $day)
{{ $day }}
@endforeach @php $firstDay = \Carbon\Carbon::create($year, $month, 1); $lastDay = $firstDay->copy()->endOfMonth(); $startDate = $firstDay->copy()->startOfWeek(); $endDate = $lastDay->copy()->endOfWeek(); $currentDate = $startDate->copy(); @endphp @while($currentDate <= $endDate) @php $daySessions = $sessions->filter(function($session) use ($currentDate) { return $session->scheduled_start->format('Y-m-d') == $currentDate->format('Y-m-d'); }); $isToday = $currentDate->isToday(); $isCurrentMonth = $currentDate->month == $month; @endphp
{{ $currentDate->day }}
@if($daySessions->count() > 0) {{ $daySessions->count() }} @endif
@foreach($daySessions->take(3) as $session)
{{ $session->title }}
{{ $session->scheduled_start->format('g:i A') }} @if($session->location_name) {{ Str::limit($session->location_name, 15) }} @endif
@endforeach @if($daySessions->count() > 3)
+{{ $daySessions->count() - 3 }} more
@endif
@php $currentDate->addDay(); @endphp @endwhile
Scheduled
In Progress
Completed
Cancelled

This Month

Total Sessions {{ $stats['total_sessions'] }}
Scheduled {{ $stats['scheduled'] }}
Completed {{ $stats['completed'] }}

Upcoming (Next 7 Days)

@php $upcomingSessions = $sessions->filter(function($session) { return $session->scheduled_start->isFuture() && $session->scheduled_start->diffInDays(now()) <= 7; })->take(5); @endphp @forelse($upcomingSessions as $session)
{{ $session->title }}
{{ $session->scheduled_start->format('M d, Y') }}
{{ $session->scheduled_start->format('g:i A') }}
@if($session->location_name)
{{ Str::limit($session->location_name, 20) }}
@endif
@empty

No upcoming sessions

@endforelse
@endsection