@extends('layouts.dashboard.superadminapp') @section('title', 'Employee Leave Requests') @section('styles') @endsection @section('content')

UEPL | Employee Leave Requests

day, 00 month 0000
@if(session('success')) @endif @if(session('error')) @endif @if($errors->any()) @endif
Leave Requests List
@foreach($leaves as $leave) @php $empId = $leave->employee_id; $leaveYear = \Carbon\Carbon::parse($leave->leave_from)->year ?? now()->year; $leaveMonth = \Carbon\Carbon::parse($leave->leave_from)->month ?? now()->month; $usedClYear = \App\Models\EmployeeLeave::where('employee_id', $empId) ->where('leave_type', 'CL') ->where('status', 'Approved') ->whereYear('leave_from', $leaveYear) ->sum('number_of_days'); $usedClMonth = \App\Models\EmployeeLeave::where('employee_id', $empId) ->where('leave_type', 'CL') ->where('status', 'Approved') ->whereYear('leave_from', $leaveYear) ->whereMonth('leave_from', $leaveMonth) ->sum('number_of_days'); $clAvailableYear = max(0, 12 - $usedClYear); $clAvailableMonth = max(0, 1 - $usedClMonth); @endphp @endforeach
Employee ID Employee Name Department Leave Type Leave From Leave To No. of Days Duration Type Status CL Bal (Year) CL Bal (Month) Reason Requested On Approved By Approval Date Actions
{{ $leave->employee->employee_id ?? '-' }} {{ $leave->employee_name ?: ($leave->employee->name ?? '-') }} {{ $leave->department ?? '-' }} @switch($leave->leave_type) @case('CL') CL @break @case('SL') SL @break @case('PL') PL @break @case('LOP') LOP @break @default {{ $leave->leave_type }} @endswitch {{ $leave->leave_from ? \Carbon\Carbon::parse($leave->leave_from)->format('d-m-Y') : '-' }} {{ $leave->leave_to ? \Carbon\Carbon::parse($leave->leave_to)->format('d-m-Y') : '-' }} {{ $leave->number_of_days }} {{ $leave->duration_type }} @if(strtolower($leave->status) == 'approved') Approved @elseif(strtolower($leave->status) == 'pending') Pending @elseif(strtolower($leave->status) == 'rejected') Rejected @else {{ $leave->status }} @endif {{ $clAvailableYear }} {{ $clAvailableMonth }} {{ Str::limit($leave->reason, 20) }} {{ $leave->requested_on ? \Carbon\Carbon::parse($leave->requested_on)->format('d-m-Y') : '-' }} {{ $leave->approved_by ?? '-' }} {{ $leave->approval_date ? \Carbon\Carbon::parse($leave->approval_date)->format('d-m-Y') : '-' }}
@if($leave->status == 'Pending') @endif
@endsection @section('scripts') @endsection