@extends('layouts.app')
@section('page_title','My HR Dashboard')
@section('page_subtitle','Your profile, attendance, leave, payroll and HR support overview.')
@section('content')
<div class="grid grid-4">
    <div class="stat"><span class="muted">Staff ID</span><strong class="mono">{{ $user->staff_id }}</strong></div>
    <div class="stat"><span class="muted">Department</span><strong>{{ $user->department?->name ?? '-' }}</strong></div>
    <div class="stat"><span class="muted">Pending Leave</span><strong>{{ $pendingLeaves }}</strong></div>
    <div class="stat"><span class="muted">Open Tickets</span><strong>{{ $openTickets }}</strong></div>
</div>
<div class="grid grid-2">
    <div class="card"><h3>Today Attendance</h3>@if($todayAttendance)<p>Clock in: <strong>{{ $todayAttendance->clock_in_at?->format('h:i A') ?? '-' }}</strong></p><p>Clock out: <strong>{{ $todayAttendance->clock_out_at?->format('h:i A') ?? '-' }}</strong></p>@else<p class="muted">No clock-in yet today.</p>@endif<div class="actions"><a class="btn" href="{{ route('user.attendance') }}">Open Attendance</a><a class="btn secondary" href="{{ route('user.leaves') }}">Request Leave</a></div></div>
    <div class="card"><h3>Latest Payslip</h3>@if($latestPayroll)<p>{{ $latestPayroll->pay_period_start?->format('d M Y') }} - {{ $latestPayroll->pay_period_end?->format('d M Y') }}</p><h2>C${{ number_format($latestPayroll->net_pay,2) }}</h2><span class="badge {{ $latestPayroll->status==='paid'?'green':'yellow' }}">{{ ucfirst($latestPayroll->status) }}</span>@else<p class="muted">No payroll has been published yet.</p>@endif</div>
</div>
<div class="card"><h3>Announcements</h3>@forelse($announcements as $announcement)<div style="border-bottom:1px solid var(--line);padding:12px 0"><strong>{{ $announcement->title }}</strong><p class="muted">{{ $announcement->body }}</p></div>@empty<div class="empty">No announcements.</div>@endforelse</div>
@endsection
