@php $employees = $employees ?? collect(); $pendingLeaveByStaff = $pendingLeaveByStaff ?? collect(); $pendingVisitByStaff = $pendingVisitByStaff ?? collect(); $surroundStats = $surroundStats ?? (object) []; $todayStatusByStaff = $todayStatusByStaff ?? collect(); $filters = $filters ?? ['q' => '', 'status' => '', 'department_id' => '', 'warehouse_id' => '']; $filterOptions = $filterOptions ?? ['departments' => collect(), 'warehouses' => collect(), 'statuses' => []]; $routePrefix = $routePrefix ?? 'admin.surrounding.employees'; $approvalCenterRoute = $approvalCenterRoute ?? null; $approvalCenterUrl = $approvalCenterRoute && \Illuminate\Support\Facades\Route::has($approvalCenterRoute) ? route($approvalCenterRoute) : null; $hasActiveFilter = ($filters['q'] ?? '') !== '' || ($filters['status'] ?? '') !== '' || ($filters['department_id'] ?? '') !== '' || ($filters['warehouse_id'] ?? '') !== ''; @endphp

{{ __('Subordinate employee list') }}

{{ __('Open attendance, leave, or visit for each subordinate. Data loads only on that page.') }}

@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{ (int) ($surroundStats->subordinates ?? 0) }}
{{ __('Subordinates') }}
{{ (int) ($surroundStats->filtered ?? $employees->count()) }}
{{ __('Showing') }}
{{ (int) ($surroundStats->pending_leave ?? 0) }}
{{ __('Pending leave') }}
{{ (int) ($surroundStats->pending_visit ?? 0) }}
{{ __('Pending visit') }}
@if (((int) ($surroundStats->pending_leave ?? 0) + (int) ($surroundStats->pending_visit ?? 0)) > 0)
{{ __('Pending subordinate notifications') }}
{{ __('Leave') }}: {{ (int) ($surroundStats->pending_leave ?? 0) }} {{ __('Visit / Movement') }}: {{ (int) ($surroundStats->pending_visit ?? 0) }}
@if($approvalCenterUrl) {{ __('Open Approval Center') }} @endif
@endif
@if($hasActiveFilter) {{ __('Reset') }} @endif
@if($employees->isEmpty())
@if($hasActiveFilter)
{{ __('No subordinates match these filters') }}
{{ __('Try clearing filters or choosing another status.') }}
{{ __('Reset filters') }} @else
{{ __('No subordinates found') }}
{{ __('You do not have any active subordinates assigned under your supervision.') }}
@endif
@else
@foreach($employees as $row) @php $pendingLeave = (int) ($pendingLeaveByStaff[$row->id] ?? 0); $pendingVisit = (int) ($pendingVisitByStaff[$row->id] ?? 0); $today = $todayStatusByStaff[$row->id] ?? ['key' => 'no_record', 'label' => __('No attendance'), 'detail' => null]; @endphp @endforeach
{{ __('Employee') }} {{ __('Department') }} {{ __('Designation') }} {{ __('Branch') }} {{ __('Today') }} {{ __('Actions') }}
{{ optional($row->user)->name ?? __('Unknown') }}
#{{ optional($row->user)->id }}
{{ optional($row->department)->name ?? '—' }} {{ optional($row->designation)->name ?? '—' }} {{ optional($row->warehouse)->name ?? '—' }}
@if($today['key'] === 'leave') @elseif($today['key'] === 'leave_pending') @elseif($today['key'] === 'movement') @elseif($today['key'] === 'movement_pending') @elseif($today['key'] === 'in_office') @elseif($today['key'] === 'absent') @else @endif {{ $today['label'] }} @if(!empty($today['detail'])) {{ $today['detail'] }} @endif
@endif