72 lines
2.6 KiB
TypeScript
72 lines
2.6 KiB
TypeScript
import { Head, Link } from '@inertiajs/react';
|
|
|
|
export default function OfferPreparations({
|
|
records,
|
|
canCreate,
|
|
}: {
|
|
records: {
|
|
data: {
|
|
id: number;
|
|
title: string | null;
|
|
reference: string;
|
|
state: string;
|
|
}[];
|
|
prev_page_url: string | null;
|
|
next_page_url: string | null;
|
|
};
|
|
canCreate: boolean;
|
|
}) {
|
|
return (
|
|
<main className="mx-auto w-full max-w-5xl space-y-6 p-4 md:p-8">
|
|
<Head title="As minhas ofertas" />
|
|
<header className="flex flex-wrap items-center justify-between gap-4">
|
|
<div>
|
|
<h1 className="text-2xl font-semibold">
|
|
As minhas ofertas
|
|
</h1>
|
|
<p className="text-muted-foreground mt-2">
|
|
Prepare e guarde as suas ofertas num espaço privado.
|
|
</p>
|
|
</div>
|
|
{canCreate && (
|
|
<Link
|
|
className="bg-primary text-primary-foreground rounded-md px-4 py-2"
|
|
href="/minhas-oportunidades/ofertas/criar"
|
|
>
|
|
Preparar oferta
|
|
</Link>
|
|
)}
|
|
</header>
|
|
{!records.data.length && (
|
|
<p>Ainda não existem ofertas neste âmbito.</p>
|
|
)}
|
|
<ul className="space-y-3">
|
|
{records.data.map((record) => (
|
|
<li key={record.id} className="rounded-lg border p-4">
|
|
<Link
|
|
className="font-medium underline"
|
|
href={`/minhas-oportunidades/ofertas/${record.id}`}
|
|
>
|
|
{record.title || 'Oferta por completar'}
|
|
</Link>
|
|
<p className="text-muted-foreground mt-1 text-sm">
|
|
{record.reference} ·{' '}
|
|
{record.state === 'submitted'
|
|
? 'Submissão privada registada'
|
|
: 'Rascunho privado'}
|
|
</p>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
<nav aria-label="Páginas das ofertas" className="flex gap-4">
|
|
{records.prev_page_url && (
|
|
<Link href={records.prev_page_url}>Anterior</Link>
|
|
)}
|
|
{records.next_page_url && (
|
|
<Link href={records.next_page_url}>Seguinte</Link>
|
|
)}
|
|
</nav>
|
|
</main>
|
|
);
|
|
}
|