import { Link, router, useForm } from '@inertiajs/react'; import InvestmentTerritory, { TerritoryFields, } from '@/components/investment-territory'; import { Management, Field, button, control } from '../management/shared'; import { titles, statuses, stages, roles } from './types'; import type { Structure, StructureRecord, Chain } from './types'; import ValueNetwork from './value-network'; import Competitiveness from './competitiveness'; import type { CompetitivenessState } from './competitiveness'; import type { ChainLink, Gap } from './value-network'; function ChainForm({ clusterId, chain }: { clusterId: string; chain?: Chain }) { const form = useForm({ code: chain?.code ?? '', name: chain?.name ?? '', stage: chain?.stage ?? 'input', }); return (
); } export default function Editor({ structure, record, projects, viewerId, chains, memberships, chainLinks, gaps, competitiveness, }: { structure: Structure; record: StructureRecord | null; projects: { id: string; name: string; code: string }[]; viewerId: number; chains: Chain[]; chainLinks: ChainLink[]; gaps: Gap[]; competitiveness?: CompetitivenessState | null; memberships: { id: string; project_id: string; name: string; role: string; association_type: string; source_reference: string | null; evidence_reference: string | null; valid_from: string | null; valid_until: string | null; validation_status: string; version_no: number; editor_id: number | null; }[]; }) { const isProject = structure === 'projects'; const isCluster = structure === 'clusters'; const isCorridor = structure === 'corridors'; const singular = isProject ? 'projecto' : isCluster ? 'cluster' : 'corredor'; const form = useForm({ code: record?.code ?? '', name: record?.name ?? '', status: record?.status ?? (isProject ? 'draft' : isCluster ? 'planned' : 'proposed'), sector: record?.sector ?? '', description: record?.description ?? '', budget_amount: record?.budget_amount ?? '', budget_currency: record?.budget_currency ?? '', start_date: record?.start_date?.slice(0, 10) ?? '', end_date: record?.end_date?.slice(0, 10) ?? '', province_id: '', district_id: '', admin_post_id: '', locality_id: '', }); const association = useForm({ project_id: '', version_no: 0, role: 'complementary', association_type: 'potential', source_reference: '', evidence_reference: '', valid_from: '', valid_until: '', }); return (Registo interno de gestão. O estado activo não publica este conteúdo no portal.
{!record && ({member.name} {' '} · {roles[member.role]}
))} {memberships.map((member) => (Ainda não existem projectos associados.
)}