@extends('layouts.app') @section('title','HR Dashboard') @section('page-title',auth()->user()->isDeptHead() ? 'Department Overview' : 'HR Dashboard') @push('styles') @endpush @section('content') {{-- Stat cards --}}
{{ $total_employees }}
Active Staff
{{ $pending_leaves }}
{{ auth()->user()->isDeptHead() ? 'Pending (Your Dept)' : 'Pending HR Review' }}
{{ $discipline_open }}
Open Cases
{{ $evaluations_pending }}
Evals Pending
@if(isset($pending_timesheets) && $pending_timesheets > 0)
{{ $pending_timesheets }}
Timesheets Pending
@endif
{{-- Shortlisted count banner (always visible) --}} @php $shortlistedCount = isset($shortlisted) ? $shortlisted->count() : 0; @endphp
@if($shortlistedCount) {{ $shortlistedCount }} Applicant{{ $shortlistedCount != 1 ? 's' : '' }} Shortlisted @else No Shortlisted Applicants @endif
@if($shortlistedCount) Awaiting final interview and outcome. See the table below. @elseif(auth()->user()->isDeptHead()) No candidates have been shortlisted for your department's open positions yet. @else Once you shortlist candidates from a job posting, they will appear here. @endif
{{ auth()->user()->isDeptHead() ? 'View Recruitment' : 'Manage Recruitment' }}
{{-- Pending approvals --}}
{{ auth()->user()->isDeptHead() ? 'Leaves Awaiting Your Approval' : 'Leaves Awaiting HR Approval' }} View All
@forelse($pending_approvals as $leave)
{{ strtoupper(substr($leave->employee->first_name,0,1)) }}
{{ $leave->employee->full_name }}
{{ $leave->leaveType->name }} · {{ $leave->total_days }} days
@if(auth()->user()->isDeptHead())
@csrf
@else
@csrf
@endif
@empty
No pending approvals
@endforelse
{{-- New hires this month --}}
New Hires — {{ now()->format('F Y') }} @if(auth()->user()->isHrOrAdmin()) + Add @endif
@forelse($new_employees as $emp)
{{ strtoupper(substr($emp->first_name,0,1).substr($emp->last_name,0,1)) }}
{{ $emp->full_name }}
{{ $emp->position }} · {{ $emp->department->name ?? '' }} · {{ $emp->date_of_employment?->format('M j') }}
@empty
No new hires this month
@endforelse
{{-- Department overview table --}} @if($dept_summary->count())
Department Overview
@foreach($dept_summary as $dept) @endforeach
Department Active On Leave Pending Leaves Open Cases
{{ $dept->name }} {{ $dept->active_count ?? 0 }} {{ $dept->on_leave_count ?? 0 }} {{ $dept->pending_leaves ?? 0 }} {{ $dept->open_cases ?? 0 }}
@endif {{-- ── Shortlisted Applicants Widget ──────────────────────────────── --}}
Shortlisted Applicants @if(isset($shortlisted) && $shortlisted->count()) {{ $shortlisted->count() }} @endif View Recruitment
@if(isset($shortlisted) && $shortlisted->count())
@foreach($shortlisted as $app) @endforeach
Applicant Position Department Interview Date Shortlisted Action
{{ $app->applicant->full_name }}
{{ $app->applicant->applicant_number }}
{{ $app->jobPosting->title }}
Shortlisted
{{ $app->jobPosting->department?->name ?? '—' }} @if($app->interview_date) {{ \Carbon\Carbon::parse($app->interview_date)->format('d M Y') }} @else Not set @endif {{ $app->decision_date ? \Carbon\Carbon::parse($app->decision_date)->diffForHumans() : '—' }}
@else
No shortlisted candidates yet
@if(auth()->user()->isDeptHead()) Candidates shortlisted for positions in your department will appear here. @else Open a job posting, score applicants, then use the Shortlist button to add candidates to this list. @endif
@endif
@endsection @push('scripts') @endpush