import { useState } from 'react'; import PartnershipPublication from '@/components/partnership-publication'; import PublicationSummary from '@/components/partnership-publication-summary'; import type { PublicationHistorySummary } from '@/lib/partnership-history'; import { Link, usePage } from '@inertiajs/react'; import PartnershipCandidacies from '@/components/partnership-candidacies'; import { ComplementEntryActions } from '@/components/investment-complements'; import StructureGeographyPanel, { type StructureGeography, } from '@/components/structure-geography'; import { Frame, button, labels, type Catalogues, type Interest, type Partnership, type Source, } from './shared'; type Props = Catalogues & { publicationActions: string[]; publicationCommands: { key: string; action: string; version: number }[]; record: Partnership; owner: boolean; canEdit: boolean; moderator: boolean; acceptingInterests: boolean; canStartInterest: boolean; origins: (Source & { geography: StructureGeography | null })[]; locations: { id: string; name: string; role: string; source_reference: string; path: { name: string }[]; }[]; interests: Interest[]; historySummary: PublicationHistorySummary | null; }; export default function Detail(p: Props) { const { auth } = usePage<{ auth: { user: { id: number } | null } }>().props; const [publicationDirty, setPublicationDirty] = useState(false); return (

{p.record.partnership_type ? p.types[p.record.partnership_type] : 'Tipo por completar'}{' '} · {p.record.kind === 'offering' ? 'Oferta' : 'Procura'} ·{' '} {labels[p.record.status] ?? p.record.status}

{p.record.payload.summary}

Oferta e procura

{p.record.offer}

{p.record.seeking}

{p.record.offer === null && (

O conteúdo detalhado está reservado à conexão privada.

)}

{p.record.payload.requirements}

Prazo: {p.record.deadline ?? 'Por definir'}

Localizações próprias da parceria

{p.locations.length ? ( p.locations.map((l, i) => (

{l.path.map((n) => n.name).join(' → ')} ·{' '} { { primary: 'Principal', operating: 'Área de atuação', coverage: 'Abrangência', }[l.role] }{' '} · Fonte: {l.source_reference}. Validação independente pendente.

)) ) : (

Localização própria não indicada.

)}
{p.origins.map((source, i) => (

Origem:{' '} {source.title}

As localizações do registo de origem são contexto documental; não confirmam a implantação da parceria.

{source.geography && ( )}
))} {auth.user && ( )} {p.owner && p.interests.length > 0 && (

Comparação de candidatos

{p.interests.map((i) => ( ))}
Candidatura Estado Correspondência Pendências
{i.id} {labels[i.status]} {i.match.score_min}– {i.match.score_max}% {i.match.criteria .filter( (c) => c.state === 'unknown', ) .map((c) => c.label) .join(', ')}
)} {!auth.user && p.record.status === 'published' && ( Entrar para manifestar interesse )} {(p.owner || p.moderator) && p.historySummary && ( )}
); }