@extends('layouts.dashboard') @section('title', 'My Leaves') @section('content')

My Leaves

View and manage your leave requests

Total Leaves

{{ $stats['total'] }} days

Used Leaves

{{ $stats['used'] }} days

Available

{{ $stats['available'] }} days

Pending

{{ $stats['pending'] }} days

Annual Leave Usage

{{ $stats['used'] }} of {{ $stats['total'] }} days used
0 days {{ round($stats['total'] / 2) }} days {{ $stats['total'] }} days

My Leave Requests

@forelse($leaves as $leave) @empty @endforelse
Leave Details Period Duration Status Actions
@php $typeIcons = [ 'sick' => 'fas fa-heartbeat text-red-500', 'vacation' => 'fas fa-umbrella-beach text-blue-500', 'personal' => 'fas fa-user text-yellow-500', 'emergency' => 'fas fa-exclamation-triangle text-purple-500' ]; @endphp
{{ ucfirst($leave->type) }} Leave
{{ Str::limit($leave->reason, 80) }}
Submitted: {{ $leave->created_at->format('M d, Y') }}
{{ $leave->start_date->format('M d, Y') }}
{{ $leave->end_date->format('M d, Y') }}
{{ $leave->days }}
days
@php $statusColors = [ 'pending' => 'bg-yellow-100 text-yellow-800', 'approved' => 'bg-green-100 text-green-800', 'rejected' => 'bg-red-100 text-red-800' ]; @endphp {{ ucfirst($leave->status) }} @if($leave->status != 'pending')
{{ $leave->approvedBy->name ?? 'Admin' }}
@if($leave->admin_notes)
{{ Str::limit($leave->admin_notes, 60) }}
@endif
@endif
@if($leave->status == 'pending')
@csrf @method('DELETE')
@endif

No Leave Requests

You haven't submitted any leave requests yet.

Request Leave
@if($leaves->hasPages())
{{ $leaves->links() }}
@endif
@php $upcomingLeaves = auth()->user()->leaveRequests() ->where('status', 'approved') ->where('start_date', '>', now()) ->orderBy('start_date') ->take(3) ->get(); @endphp @if($upcomingLeaves->count() > 0)

Upcoming Approved Leaves

@foreach($upcomingLeaves as $leave)
{{ ucfirst($leave->type) }} Leave
{{ $leave->start_date->format('M d') }} - {{ $leave->end_date->format('M d, Y') }}
{{ $leave->days }} days
In {{ $leave->start_date->diffInDays(now()) }} days
@endforeach
@endif
@endsection