@php $configData = Helper::appClasses(); @endphp @extends('layouts/layoutMaster') @section('title', __('My Holidays')) @section('vendor-style') @vite([ 'resources/assets/vendor/libs/fullcalendar/fullcalendar.scss', 'resources/assets/vendor/libs/sweetalert2/sweetalert2.scss' ]) @endsection @section('vendor-script') @vite([ 'resources/assets/vendor/libs/moment/moment.js', 'resources/assets/vendor/libs/fullcalendar/fullcalendar.js', 'resources/assets/vendor/libs/sweetalert2/sweetalert2.js' ]) @endsection @section('page-script') @vite(['resources/assets/js/app/hrcore-holidays-calendar.js']) @endsection @section('content')
{{-- Breadcrumb --}} {{-- No Holidays Alert --}} @if($totalHolidays === 0) @endif {{-- Holiday Statistics --}}

{{ __('Total Holidays') }}

{{ $totalHolidays }}

{{ __('in') }} {{ $currentYear }}

{{ __('Past Holidays') }}

{{ $pastHolidays }}

{{ __('enjoyed') }}

{{ __('Upcoming Holidays') }}

{{ $futureHolidays }}

{{ __('remaining') }}
{{-- Holiday Calendar --}}
{{ __('Holiday Calendar') }} {{ $currentYear }}
{{-- Fallback if calendar doesn't load --}}
{{-- Upcoming Holidays List --}}
{{ __('Upcoming Holidays') }}
@if($upcomingHolidays->count() > 0)
@foreach($upcomingHolidays as $holiday) @php $daysUntil = ceil(now()->diffInDays($holiday->date, false)); $isToday = $holiday->date->isToday(); $isTomorrow = $holiday->date->isTomorrow(); @endphp
{{ $holiday->name }}
{{ $holiday->date->format('M d, Y') }} {{ $holiday->date->format('l') }}
@if($holiday->notes) {{ $holiday->notes }} @endif
@if($isToday) {{ __('Today') }} @elseif($isTomorrow) {{ __('Tomorrow') }} @else {{ $daysUntil }} {{ $daysUntil == 1 ? __('day') : __('days') }} @endif
@endforeach
@else

{{ __('No upcoming holidays') }}

@endif
{{-- Holidays by Month --}}
{{ __('Holidays by Month') }}
@foreach($holidaysByMonth as $month => $monthHolidays)

@foreach($monthHolidays as $holiday)
{{ $holiday->name }} {{ $holiday->date->format('D, M d') }}
@if($holiday->date->isPast()) @else {{ $holiday->date->diffForHumans() }} @endif
@endforeach
@endforeach
{{-- All Holidays Table --}}
{{ __('All Holidays') }} - {{ $currentYear }}
@forelse($holidays as $holiday) @empty @endforelse
{{ __('Holiday') }} {{ __('Date') }} {{ __('Day') }} {{ __('Notes') }} {{ __('Status') }}
{{ $holiday->name }} {{ $holiday->date->format('M d, Y') }} {{ $holiday->date->format('l') }} @if($holiday->notes) {{ $holiday->notes }} @else - @endif @if($holiday->date->isPast()) {{ __('Past') }} @elseif($holiday->date->isToday()) {{ __('Today') }} @else {{ __('Upcoming') }} @endif

{{ __('No holidays available for') }} {{ $currentYear }}

{{-- Holiday Data for Calendar --}} @php $holidayData = $holidays->map(function($holiday) { return [ 'id' => $holiday->id, 'title' => $holiday->name, 'start' => $holiday->date->format('Y-m-d'), 'allDay' => true, 'backgroundColor' => $holiday->color ?? ($holiday->date->isPast() ? '#6c757d' : ($holiday->date->isToday() ? '#28a745' : '#007bff')), 'borderColor' => $holiday->color ?? ($holiday->date->isPast() ? '#6c757d' : ($holiday->date->isToday() ? '#28a745' : '#007bff')), 'textColor' => '#ffffff', 'extendedProps' => [ 'notes' => $holiday->notes, 'code' => $holiday->code, 'type' => $holiday->type ] ]; })->values()->toArray(); @endphp @endsection