Files
compras/resources/js/components/order-document-links.tsx
T
nala 448948a487
tests / ci (push) Waiting to run
commit compras1 2911
2026-11-29 05:28:30 +02:00

61 lines
2.0 KiB
TypeScript

import { Link } from '@inertiajs/react';
export type RelatedProcess = { id: number; number: string; href: string };
/** Links supplied by the native page; the server retains authority over every destination. */
export function OrderDocumentLinks({
receiptsHref = null,
financialDocumentsHref = null,
relatedProcesses = [],
}: {
receiptsHref?: string | null;
financialDocumentsHref?: string | null;
relatedProcesses?: RelatedProcess[];
}) {
if (
!receiptsHref &&
!financialDocumentsHref &&
relatedProcesses.length === 0
)
return null;
return (
<nav
aria-label="Documentos relacionados da ordem"
className="rounded-xl border bg-card p-4"
>
<ul className="flex flex-wrap gap-x-6 gap-y-3 text-sm font-medium">
{relatedProcesses.map((process) => (
<li key={process.id}>
<Link
className="underline underline-offset-4"
href={process.href}
>
Processo {process.number}
</Link>
</li>
))}
{receiptsHref && (
<li>
<Link
className="underline underline-offset-4"
href={receiptsHref}
>
Recepções, qualidade e quantidades pendentes
</Link>
</li>
)}
{financialDocumentsHref && (
<li>
<Link
className="underline underline-offset-4"
href={financialDocumentsHref}
>
Facturas e pagamentos desta ordem
</Link>
</li>
)}
</ul>
</nav>
);
}