{{-- 대시보드 달력 그리드 (HTMX로 로드) --}} @php use Carbon\Carbon; use App\Models\System\Schedule; $firstDay = Carbon::create($year, $month, 1); $lastDay = $firstDay->copy()->endOfMonth(); $startOfWeek = $firstDay->copy()->startOfWeek(Carbon::SUNDAY); $endOfWeek = $lastDay->copy()->endOfWeek(Carbon::SATURDAY); $today = Carbon::today(); $prevMonth = $firstDay->copy()->subMonth(); $nextMonth = $firstDay->copy()->addMonth(); @endphp {{-- 달력 헤더 --}}

{{ $year }}년 {{ $month }}월

@if(!$today->isSameMonth($firstDay)) @endif
{{-- 달력 그리드 --}}
@php $currentDate = $startOfWeek->copy(); @endphp @while($currentDate <= $endOfWeek) @for($i = 0; $i < 7; $i++) @php $dateKey = $currentDate->format('Y-m-d'); $isCurrentMonth = $currentDate->month === $month; $isToday = $currentDate->isSameDay($today); $isSunday = $currentDate->dayOfWeek === Carbon::SUNDAY; $isSaturday = $currentDate->dayOfWeek === Carbon::SATURDAY; $daySchedules = $calendarData[$dateKey] ?? collect(); $holidayName = $holidayMap[$dateKey] ?? null; $isHoliday = $holidayName !== null; @endphp @php $currentDate->addDay(); @endphp @endfor @endwhile
{{-- 날짜 헤더 --}}
{{ $currentDate->day }} @if($isHoliday && $isCurrentMonth) {{ $holidayName }} @endif
@if($isCurrentMonth) @endif
{{-- 휴가/근태 목록 --}} @php $dayLeaves = $leaveData[$dateKey] ?? []; @endphp @if(count($dayLeaves) > 0)
@foreach($dayLeaves as $leave)
[{{ $leave['type_label'] }}] {{ $leave['user_name'] }} @if(!empty($leave['reason'])) {{ $leave['reason'] }} @endif
@endforeach
@endif {{-- 일정 목록 --}}
@foreach($daySchedules as $schedule) @endforeach