@extends('layouts.app') @section('title', 'Leave Calendar') @section('breadcrumbs') @endsection @section('content')
{{-- Header --}}

Leave Calendar

{{ $startDate->format('F Y') }} — Team leave overview

{{-- Navigation + Filters --}}
@php $prevMonth = $startDate->copy()->subMonth(); $nextMonth = $startDate->copy()->addMonth(); @endphp {{ $startDate->format('F Y') }} Today
{{-- Legend --}}
@foreach($leaveTypes as $type)
{{ $type->name }}
@endforeach
{{-- Calendar Grid --}}
{{-- Day headers --}}
@foreach(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as $dayName)
{{ $dayName }}
@endforeach
{{-- Calendar cells --}}
{{-- Empty cells for days before month starts --}} @for($i = 0; $i < $startDate->dayOfWeek; $i++)
@endfor {{-- Actual days --}} @foreach($calendarData as $day => $leaves) @php $date = Carbon\Carbon::create($year, $month, $day); $isToday = $date->isToday(); $isWeekend = in_array($date->dayOfWeek, [5, 6]); // Fri, Sat for Oman @endphp
{{ $day }} @if(count($leaves) > 0) {{ count($leaves) }} @endif
@foreach(array_slice($leaves, 0, 3) as $leave)
{{ $leave->employee->first_name }}
@endforeach @if(count($leaves) > 3)
+{{ count($leaves) - 3 }} more
@endif
@endforeach {{-- Empty cells for remaining --}} @php $totalCells = $startDate->dayOfWeek + $endDate->day; $remainingCells = (7 - ($totalCells % 7)) % 7; @endphp @for($i = 0; $i < $remainingCells; $i++)
@endfor
@endsection