@php $typeColors = [ 'tour_assignment' => ['color' => '#2563eb', 'bg' => '#eff6ff', 'label' => 'Tur Görevi', 'icon' => 'fa-bus'], 'block' => ['color' => '#ef4444', 'bg' => '#fef2f2', 'label' => 'Bloke', 'icon' => 'fa-ban'], 'maintenance' => ['color' => '#f59e0b', 'bg' => '#fffbeb', 'label' => 'Bakım', 'icon' => 'fa-wrench'], 'leave' => ['color' => '#8b5cf6', 'bg' => '#f5f3ff', 'label' => 'İzin', 'icon' => 'fa-plane-departure'], ]; $typeMeta = fn ($t) => $typeColors[$t] ?? ['color' => '#64748b', 'bg' => '#f1f5f9', 'label' => $t, 'icon' => 'fa-calendar']; $events = $schedules->map(function ($s) use ($typeMeta) { $tc = $typeMeta($s->schedule_type); $allDay = empty($s->start_time); return [ 'title' => $s->title, 'start' => $s->start_date->format('Y-m-d') . ($s->start_time ? 'T' . substr($s->start_time, 0, 5) : ''), 'end' => $allDay ? $s->end_date->copy()->addDay()->format('Y-m-d') : $s->end_date->format('Y-m-d') . ($s->end_time ? 'T' . substr($s->end_time, 0, 5) : ''), 'allDay' => $allDay, 'color' => $tc['color'], 'extendedProps' => [ 'typeLabel' => $tc['label'], 'icon' => $tc['icon'], 'description' => $s->description, 'dateText' => $s->start_date->format('d.m.Y') . ($s->start_date->ne($s->end_date) ? ' → ' . $s->end_date->format('d.m.Y') : ''), 'timeText' => $s->start_time ? substr($s->start_time, 0, 5) . ' - ' . substr($s->end_time ?? '', 0, 5) : null, ], ]; })->values(); $initials = collect(explode(' ', $resource->name))->map(fn ($w) => mb_strtoupper(mb_substr($w, 0, 1)))->take(2)->implode(''); $typeLabel = $resource->type === 'guide' ? 'Rehber' : ($resource->type === 'captain' ? 'Kaptan / Şoför' : 'Araç'); $avatarBg = $resource->type === 'guide' ? 'linear-gradient(135deg,#3b82f6,#2563eb)' : ($resource->type === 'captain' ? 'linear-gradient(135deg,#8b5cf6,#7c3aed)' : 'linear-gradient(135deg,#10b981,#059669)'); $now = now()->startOfDay(); $upcoming = $schedules->filter(fn ($s) => $s->end_date->gte($now))->sortBy('start_date')->values(); $past = $schedules->filter(fn ($s) => $s->end_date->lt($now))->sortByDesc('start_date')->values(); @endphp