@extends('layouts.dashboard') @section('title', 'Leave Management') @section('content')
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() }}
|
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)
@endif
|
No Leave RequestsNo leave requests found. |
|||||