@extends('layouts.dashboard') @section('title', 'Leave Management') @section('content')

Leave Management

Manage employee leave requests and approvals

Pending

{{ \App\Models\LeaveRequest::where('status', 'pending')->count() }}

Approved

{{ \App\Models\LeaveRequest::where('status', 'approved')->count() }}

Rejected

{{ \App\Models\LeaveRequest::where('status', 'rejected')->count() }}

This Month

{{ \App\Models\LeaveRequest::whereMonth('created_at', now()->month)->count() }}

@forelse($leaves as $leave) @empty @endforelse
Employee
Leave Period
Type & Reason
Duration
Status
Actions
{{ $leave->employee->name }}
{{ $leave->employee->employee_id }}
Dept: {{ $leave->employee->department->name ?? 'N/A' }}
{{ $leave->start_date->format('M d, Y') }}
{{ $leave->end_date->format('M d, Y') }}
@php $typeColors = [ 'sick' => 'bg-red-100 text-red-800', 'vacation' => 'bg-blue-100 text-blue-800', 'personal' => 'bg-yellow-100 text-yellow-800', 'emergency' => 'bg-purple-100 text-purple-800' ]; @endphp {{ ucfirst($leave->type) }} Leave
{{ Str::limit($leave->reason, 100) }}
{{ $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->approved_by)
By: {{ $leave->approvedBy->name ?? 'Admin' }}
@endif
@if($leave->status == 'pending') @can('approve', $leave) @endcan @endif @if($leave->status == 'pending' && auth()->user()->id == $leave->employee_id)
@csrf @method('DELETE')
@endif

No Leave Requests

No leave requests found.

@if($leaves->hasPages())
{{ $leaves->links() }}
@endif
@endsection