import { Link, useForm } from '@inertiajs/react'; import { Management, Pagination, button, control, states, type Paginated, } from './shared'; type Entry = { id: number; reference: string; title: string | null; status: string; opportunity_category: string | null; updated_at: string; deleted_at: string | null; }; export default function Opportunities({ records, filters, counts, categories, sectors, geographyReviewCount, }: { records: Paginated; filters: { q?: string; status?: string; category?: string; deleted?: boolean; sector_id?: string; geography_scope?: string; }; counts: Record; categories: string[]; sectors: { id: number; name: string }[]; geographyReviewCount: number; }) { const form = useForm({ q: filters.q ?? '', status: filters.status ?? '', category: filters.category ?? '', deleted: Boolean(filters.deleted), sector_id: String(filters.sector_id ?? ''), geography_scope: filters.geography_scope ?? '', }); return ( Nova oportunidade

{geographyReviewCount} registos com âmbito por indicar; referências existentes permanecem aceites.

{[ 'draft', 'submitted', 'returned', 'approved', 'published', 'suspended', 'archived', ].map((s) => ( {states[s] ?? s}: {counts[s] ?? 0} ))}
{ e.preventDefault(); form.get('/management/opportunities'); }} > form.setData('q', e.target.value)} />
{records.data.map((r) => (

{r.title ?? 'Rascunho sem título'}

ID {r.id} · {r.reference} ·{' '} {r.opportunity_category ?? 'Categoria por indicar'}{' '} ·{' '} {r.deleted_at ? 'Eliminado logicamente' : (states[r.status] ?? r.status)}

Atualizado: {r.updated_at}

Ver {r.deleted_at || r.status === 'archived' ? 'Restaurar' : r.status === 'draft' ? 'Continuar preenchimento' : 'Editar nova versão'}
))}
{!records.data.length &&

Nenhum registo encontrado.

}
); }