@php /** @var \Carbon\Carbon $month */ /** @var \Illuminate\Support\Collection $events grouped by Y-m-d */ $prevMonth = $month->copy()->subMonthNoOverflow()->format('Y-m'); $nextMonth = $month->copy()->addMonthNoOverflow()->format('Y-m'); $thisMonth = now()->format('Y-m'); $today = now()->format('Y-m-d'); $weekdays = __('group_calendar.weekdays'); $monthName = __('group_calendar.months.' . (int) $month->format('n')); // Build a 6x7 grid starting on Monday $firstOfMonth = $month->copy()->startOfMonth(); $gridStart = $firstOfMonth->copy()->startOfWeek(\Carbon\Carbon::MONDAY); $cells = []; for ($i = 0; $i < 42; $i++) { $d = $gridStart->copy()->addDays($i); $cells[] = [ 'date' => $d, 'in_month' => $d->format('Y-m') === $month->format('Y-m'), 'is_today' => $d->format('Y-m-d') === $today, 'events' => $events[$d->format('Y-m-d')] ?? collect(), ]; } $typeColors = [ 'meetup' => '#405189', 'rally' => '#f06548', 'webinar' => '#7a5af8', 'fundraiser' => '#f7b84b', 'volunteer' => '#0ab39c', 'conference' => '#0d6efd', 'other' => '#6c757d', ]; @endphp