import { Head, Link, usePage } from '@inertiajs/react'; import { ArrowRight, CheckCheck, ClipboardList, Clock3, Plus, Wallet, } from 'lucide-react'; import { PageTitle, Panel, RequisitionTable } from '@/components/procurement'; import { Button } from '@/components/ui/button'; import { money } from '@/types/procurement'; import type { Company, Requisition } from '@/types/procurement'; type Props = { company: Company | null; stats: { total: number; pending: number; approved: number; approvedMinor: number; awaitingMe: number; }; recent: Requisition[]; approvals: Requisition[]; }; export default function Dashboard({ company, stats, recent, approvals, }: Props) { const canRequest = usePage().props.canRequest === true; const publicNavigation = !!usePage().props.publicNavigation; const cards = [ { label: 'Requisições', value: stats.total, icon: ClipboardList, detail: 'Total de pedidos visíveis', }, { label: 'Em aprovação', value: stats.pending, icon: Clock3, detail: `${stats.awaitingMe} aguardam a sua decisão`, }, { label: 'Aprovadas', value: stats.approved, icon: CheckCheck, detail: 'Todas as etapas concluídas', }, { label: 'Valor aprovado', value: money(Number(stats.approvedMinor)), icon: Wallet, detail: 'Estimativa em MZN, com IVA', }, ]; return ( <>
{company ? 'Nova requisição' : 'Configurar empresa'} ) } /> {!company && !publicNavigation ? ( ) : ( <>
{cards.map((card) => (
{card.label}

{card.value}

{card.detail}

))}
{company?.rules_provisional && (
Ambiente de desenvolvimento · regras provisórias. {' '} Escalões de {money(company.first_limit_minor)} e{' '} {money(company.second_limit_minor)}, calculados{' '} {company.approval_includes_tax ? 'com' : 'sem'}{' '} IVA. Os parâmetros precisam de validação antes de compras reais.
)} {approvals.length > 0 && (
{approvals.map((r) => (

{r.number}

{r.justification}

{money(r.total_minor)} ))}
)}
Ver todas as requisições{' '}
)}
); } Dashboard.layout = { breadcrumbs: [ { title: 'Visão geral', href: '/dashboard', }, ], };