import { Link, router, usePage } from "@inertiajs/react";
import { useState } from "react";
import InvestmentMapPanel from "@/components/investment-map-panel";
import { Frame, card, button, money, groupLabels } from "./shared";
import type { Opportunity, Context } from "./shared";
export default function Detail({
record: r,
context: c,
zone_origin,
}: {
record: Opportunity;
context: Context;
zone_origin?: { id: string; name: string } | null;
}) {
const { auth } = usePage<{ auth: { user: unknown } }>().props;
const [sharing, setSharing] = useState("");
return (
{r.reference} · {r.sector?.name} · {r.province} {r.district}
{r.summary}
{c.primary_territory_path && c.primary_territory_path.length > 0 && (
Localização: {c.primary_territory_path.map((node) => node.name).join(" → ")}
)}
{auth.user ? (
) : (
Entrar para preparar manifestação
)}
Contacto rápido sem rascunho
{sharing && {sharing}
}
{!!c.zones?.length && (
ZEE, ZFI e parques associados
{c.zones.map((z) => (
{z.name}
{" "}
·{" "}
{z.association_type === "official"
? "Associação documental validada"
: "Relação " + z.association_type}{" "}
· Fonte: {z.source_reference}
))}
A associação não atribui automaticamente benefícios ou licenças.
)}
O investimento
{r.description || "Descrição por completar."}
{[
["Promotor", r.promoter_name],
["Investimento", money(r)],
["Maturidade", r.maturity_label],
["Parceria", r.financing_modality],
["Impacto", r.expected_impact],
["Calendário", c.profile?.target_date],
].map(([key, value]) => (
- {key}
- {value || "Não indicado"}
))}
{c.profile && (
Viabilidade e preparação
{[
["Modelo de negócio", c.profile.business_model],
["Requisitos", c.profile.requirements],
["Riscos", c.profile.risks],
["Fonte", c.profile.source_reference],
].map(([label, text]) => (
{label}
{text || "Não indicado"}
))}
{c.profile.is_education && (
Explorar oportunidades na educação
)}
)}
{(["clusters", "corridors", "projects", "locations"] as const).map((key, i) => (
{["Clusters", "Corredores", "Projectos âncora", "Territórios"][i]}
{c[key].map((entity) => (
{entity.name}
))}
{!c[key].length &&
Sem relação publicada.
}
))}
Infraestruturas, competências, educação e apoios
{c.facets.map((f) => (
{groupLabels[f.group] ?? f.group}: {f.label}
))}
{!c.facets.length && (
Sem características estruturadas publicadas. Pode declarar as suas
necessidades na manifestação de interesse.
)}
);
}