@extends('layouts.app') @section('content') {{-- Month Navigation --}}
@php $prevMonth = $month == 1 ? 12 : $month - 1; $prevYear = $month == 1 ? $year - 1 : $year; $nextMonth = $month == 12 ? 1 : $month + 1; $nextYear = $month == 12 ? $year + 1 : $year; @endphp الشهر السابق

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

الشهر التالي
{{-- Stats --}}
{{ $leaves->pluck('employee_id')->unique()->count() }}
موظفين في إجازة هذا الشهر
{{ $leaves->count() }}
إجمالي طلبات الإجازة
{{ $leaves->sum(function($l) { return $l->start_date->diffInDays($l->end_date) + 1; }) }}
إجمالي أيام الإجازة
{{-- Leave Type Legend --}} @php $usedTypes = $leaves->pluck('leaveType')->unique('id')->filter(); @endphp @if($usedTypes->count() > 0)
دليل الألوان: @foreach($usedTypes as $lt)
{{ $lt->name_ar }}
@endforeach
@endif {{-- Calendar Grid --}}

التقويم

@php $dayNames = ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت']; @endphp
{{-- Day headers --}} @foreach($dayNames as $dn)
{{ $dn }}
@endforeach {{-- Empty cells before first day --}} @php $firstDow = $calendarDays[0]['date']->dayOfWeek; @endphp @for($i = 0; $i < $firstDow; $i++)
@endfor {{-- Calendar days --}} @foreach($calendarDays as $day) @php $isToday = $day['date']->isToday(); $isWeekend = in_array($day['date']->dayOfWeek, [5, 6]); // Fri, Sat $hasLeaves = $day['leaves']->count() > 0; @endphp
{{ $day['date']->day }}
@foreach($day['leaves']->take(3) as $leave) @php $leaveColor = $leave->leaveType->color ?? '#6b7280'; @endphp
{{ $leave->employee->full_name ?? $leave->employee->first_name ?? 'موظف' }}
@endforeach @if($day['leaves']->count() > 3)
+{{ $day['leaves']->count() - 3 }} آخرين
@endif
@endforeach
{{-- Leave list for this month --}} @if($leaves->count() > 0)

قائمة الإجازات

@foreach($leaves->sortBy('start_date') as $leave) @php $leaveColor = $leave->leaveType->color ?? '#6b7280'; @endphp @endforeach
الموظف القسم نوع الإجازة من إلى المدة
{{ $leave->employee->full_name ?? $leave->employee->first_name ?? '—' }} {{ $leave->employee->department->name ?? '—' }} {{ $leave->leaveType->name_ar ?? '—' }} {{ $leave->start_date->format('Y-m-d') }} {{ $leave->end_date->format('Y-m-d') }} {{ $leave->start_date->diffInDays($leave->end_date) + 1 }} يوم
@endif @endsection