// HR Dashboard — Phase 10.4 G-H3 (S38 2026-05-28). // 4 KPI card aggregate + gender ratio + birthdays + new hires. // File MIRROR SHA256 identical fe-user counterpart. import { useQuery } from '@tanstack/react-query' import { Cake, TrendingUp, UserCheck, Users } from 'lucide-react' import { PageHeader } from '@/components/PageHeader' import { api } from '@/lib/api' import { cn } from '@/lib/cn' import type { HrDashboardDto } from '@/types/workflowApps' const CARDS = [ { key: 'totalEmployees', label: 'Tổng nhân viên', icon: Users, color: 'bg-blue-50 text-blue-700 border-blue-200' }, { key: 'activeEmployees', label: 'Đang làm việc', icon: UserCheck, color: 'bg-emerald-50 text-emerald-700 border-emerald-200' }, { key: 'birthdaysThisWeek', label: 'Sinh nhật 7 ngày tới', icon: Cake, color: 'bg-amber-50 text-amber-700 border-amber-200' }, { key: 'newHiresThisMonth', label: 'Mới vào tháng này', icon: TrendingUp, color: 'bg-violet-50 text-violet-700 border-violet-200' }, ] as const export function HrmDashboardPage() { const data = useQuery({ queryKey: ['hr-dashboard'], queryFn: async () => (await api.get('/hr/dashboard')).data, }) const d = data.data return (
{CARDS.map((card) => { const Icon = card.icon const value = d ? (d as any)[card.key] : '—' return (
{card.label}
{data.isLoading ? '—' : value}
) })}
{d && (

Phân bố giới tính

Nam
{d.maleCount}
Nữ
{d.femaleCount}

Trạng thái nhân sự

Đang làm việc {d.activeEmployees}
Nghỉ phép {d.onLeaveEmployees}
Đã nghỉ việc {d.resignedEmployees}
)}
) }