104 lines
4.2 KiB
TypeScript
104 lines
4.2 KiB
TypeScript
import { Link, useForm } from '@inertiajs/react';
|
|
import { Management } from '../management/shared';
|
|
import type { Paginated } from '../management/shared';
|
|
import { Layout, Field, control, button, Pagination, kind } from './shared';
|
|
import type { Dossier } from './shared';
|
|
export default function Index({
|
|
records,
|
|
management,
|
|
filters,
|
|
}: {
|
|
records: Paginated<Dossier>;
|
|
management: boolean;
|
|
filters: { q?: string; kind?: string };
|
|
}) {
|
|
const form = useForm({ q: filters.q ?? '', kind: filters.kind ?? '' });
|
|
const base = management ? '/management/portfolio' : '/carteira';
|
|
const Frame = management ? Management : Layout;
|
|
return (
|
|
<Frame title="Corredores, clusters e projectos âncora">
|
|
<p>
|
|
Explore o território, identifique os elos da cadeia de valor e
|
|
acompanhe o seu interesse numa única conta.
|
|
</p>
|
|
{management && (
|
|
<p className="rounded border border-amber-500 p-3">
|
|
Matriz documental para revisão. Rascunhos não aparecem no
|
|
portal público. Pontuações não são recomendações
|
|
personalizadas.
|
|
</p>
|
|
)}
|
|
<form
|
|
className="flex flex-wrap items-end gap-3"
|
|
onSubmit={(e) => {
|
|
e.preventDefault();
|
|
form.get(base);
|
|
}}
|
|
>
|
|
<Field label="Pesquisar">
|
|
<input
|
|
className={control}
|
|
value={form.data.q}
|
|
onChange={(e) => form.setData('q', e.target.value)}
|
|
/>
|
|
</Field>
|
|
<Field label="Explorar por">
|
|
<select
|
|
className={control}
|
|
value={form.data.kind}
|
|
onChange={(e) => form.setData('kind', e.target.value)}
|
|
>
|
|
<option value="">Toda a carteira</option>
|
|
<option value="corridor">Corredores</option>
|
|
<option value="cluster">Matriz de clusters</option>
|
|
<option value="project">Projectos âncora</option>
|
|
</select>
|
|
</Field>
|
|
<button className={button}>Pesquisar</button>
|
|
</form>
|
|
<div className="grid gap-4 md:grid-cols-2">
|
|
{records.data.map((r) => (
|
|
<article
|
|
key={r.id}
|
|
className="space-y-3 rounded-xl border p-5"
|
|
>
|
|
<p className="text-sm">
|
|
{kind(r)} · {r.content.code}
|
|
{management &&
|
|
` · ${r.publication_status === 'published' ? 'Publicado' : 'Rascunho'}`}
|
|
</p>
|
|
<h2 className="text-xl font-semibold">
|
|
<Link
|
|
className="underline"
|
|
href={`${base}/${r.id}`}
|
|
>
|
|
{r.title}
|
|
</Link>
|
|
</h2>
|
|
<p>
|
|
{r.content.description ??
|
|
r.content.focus ??
|
|
r.content.anchors}
|
|
</p>
|
|
{r.content.priority && (
|
|
<p>
|
|
{r.content.priority}{' '}
|
|
<span className="text-sm">
|
|
(proposta documental)
|
|
</span>
|
|
</p>
|
|
)}
|
|
<Link className="underline" href={`${base}/${r.id}`}>
|
|
Explorar relações e próximos passos
|
|
</Link>
|
|
</article>
|
|
))}
|
|
</div>
|
|
{!records.data.length && (
|
|
<p>Ainda não existem fichas publicadas para esta pesquisa.</p>
|
|
)}
|
|
<Pagination page={records} />
|
|
</Frame>
|
|
);
|
|
}
|