@php $titles = ['dashboard' => 'Dashboard', 'requests' => 'PTO Requests', 'approvals' => 'Approvals', 'history' => 'History']; $title = $titles[$section]; $statusLabels = ['pending'=>'Pending review','immediate_approved'=>'First review complete','final_approved'=>'Approved','pending_admin'=>'Awaiting admin','admin_approved'=>'Approved','rejected'=>'Rejected']; @endphp @extends('layouts.app') @section('content')

{{ $section === 'dashboard' ? 'Dashboard' : $title }}

New PTO Request
@if (! $available)
PTO records are not yet available for this company. Your administrator can enable the existing Timesheet PTO schema.
@endif @if ($section === 'dashboard')
@foreach ([['Personal Time Off','pto','Available hours','balance'],['Sick Leave','sick','Available hours','sick'],['Pending Requests','pending','In the review process','pending'],['Approved Requests','approved','Completed approvals','approved']] as [$label,$key,$detail,$style])

{{ $label }}

{{ $summary ? (in_array($key,['pto','sick']) ? number_format($summary[$key],2) : $summary[$key]) : '-' }}@if(in_array($key,['pto','sick']))hrs@endif

{{ $detail }}

@endforeach
@endif

{{ $section === 'dashboard' ? 'Recent requests' : ($section === 'approvals' ? 'Your review queue' : $title) }}

{{ $section === 'dashboard' ? '' : '' }}

@if($section !== 'dashboard'){{ $section === 'history' ? 'All requests' : 'History' }}@endif @if($section === 'dashboard')View all @endif
@if ($section !== 'dashboard')
@if($search || $status)Clear@endif
@endif
@forelse ($requests ?? [] as $item) @empty@endforelse
{{ $section === 'approvals' ? 'Employee / Leave Type' : 'Leave Type' }}DatesHoursStatusAction
{{ $section === 'approvals' ? $item->employee_name : ($item->type_label ?? 'Time off') }}{{ $section === 'approvals' ? ($item->type_label ?? 'Time off') : ($item->department ?: 'PTO request') }}{{ $item->date_from ? \Illuminate\Support\Carbon::parse($item->date_from)->format('M j, Y') : ($item->date ? \Illuminate\Support\Carbon::parse($item->date)->format('M j, Y') : 'Not set') }}@if($item->date_to && $item->date_to !== $item->date_from)to {{ \Illuminate\Support\Carbon::parse($item->date_to)->format('M j, Y') }}@endif{{ number_format((float)($item->total_hours ?? $item->hours ?? 0),2) }} hrsin_array($item->status,['final_approved','admin_approved']), 'status-rejected'=>$item->status==='rejected', 'status-pending'=>!in_array($item->status,['final_approved','admin_approved','rejected'])])>{{ $statusLabels[$item->status] ?? \Illuminate\Support\Str::headline($item->status) }}{{ $section === 'approvals' ? 'Review' : 'View' }}

{{ $available ? 'No requests to show' : 'Your workspace is almost ready' }}

{{ $available ? 'Your time-off requests will appear here.' : 'PTO data will appear when the company setup is complete.' }}

@if ($requests && $requests->hasPages())@endif
@endsection