import { Head, Link, usePage } from '@inertiajs/react'; import { ArrowUpRight, Building2, FolderKanban, Inbox, Layers, Users, } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; import { portfolio, yearRange } from '@/data/projects'; import { formatDate, sectorLabels, statusBadgeClasses, statusLabels, } from '@/lib/admin-labels'; import { about, clients, contact, dashboard, home, services } from '@/routes'; import { index as consultationsIndex } from '@/routes/admin/consultations'; import { index as projectsIndex } from '@/routes/admin/projects'; import type { Consultation, Project, ProjectSector } from '@/types'; type DashboardProps = { projects: Project[]; newConsultations: number; latestConsultations: Pick< Consultation, 'id' | 'name' | 'company' | 'service' | 'status' | 'created_at' >[]; }; const sitePages = [ { title: 'Beranda', href: home() }, { title: 'Tentang Kami', href: about() }, { title: 'Jasa', href: services() }, { title: 'Klien & Portofolio', href: clients() }, { title: 'Kontak', href: contact() }, ]; function StatCard({ icon: Icon, label, value, note, }: { icon: LucideIcon; label: string; value: string | number; note: string; }) { return (
{label}
{value} {note}
); } export default function Dashboard({ projects, newConsultations, latestConsultations, }: DashboardProps) { const { auth } = usePage().props; const { clientCount, clientsInSector, projectsBySector, projectsInProgram, } = portfolio(projects); const sectors: ProjectSector[] = ['government', 'private', 'soe']; const erpProjects = projectsInProgram('erp'); const latest = projects.slice(0, 5); return ( <>
Admin Panel · PT Probindo Artika Jaya

Selamat datang, {auth.user?.name}

Ringkasan permintaan konsultasi dan rekam jejak proyek yang ditampilkan di website.

Konsultasi Terbaru

Buka inbox
{latestConsultations.length === 0 ? (

Belum ada permintaan konsultasi.

) : (
    {latestConsultations.map((item) => (
  • {item.name} {item.company && ` · ${item.company}`} {formatDate( item.created_at, )} {item.service && ` · ${item.service}`}
    {statusLabels[item.status]}
  • ))}
)}

Proyek Terbaru

Kelola portofolio
    {latest.map((project) => (
  • {project.year}
    {project.title} {project.client} ·{' '} {sectorLabels[project.sector]}
  • ))}

Proyek per Sektor

{sectors.map((sector) => { const count = projectsBySector(sector).length; const percent = projects.length ? Math.round( (count / projects.length) * 100, ) : 0; return (
{sectorLabels[sector]} {count} proyek ·{' '} { clientsInSector(sector) .length }{' '} klien
); })}

Halaman Website

{sitePages.map((page) => ( {page.title} ))}
); } Dashboard.layout = { breadcrumbs: [ { title: 'Dashboard', href: dashboard(), }, ], };