vrsao 2
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-08 14:02:01 +02:00
parent bdd766c68a
commit 1106509116
354 changed files with 48275 additions and 24635 deletions
+130 -56
View File
@@ -1,15 +1,15 @@
import { Link, router, usePage } from "@inertiajs/react";
import { useState } from "react";
import InvestmentMapPanel from "@/components/investment-map-panel";
import { Link, router, usePage } from '@inertiajs/react';
import { useState } from 'react';
import InvestmentMapPanel from '@/components/investment-map-panel';
import StructureGeographyPanel from '@/components/structure-geography';
import PartnershipSourceLinks from '@/components/partnership-source-links';
import { Frame, card, button, money, groupLabels } from "./shared";
import type { Opportunity, Context } from "./shared";
import { Frame, card, button, money, groupLabels } from './shared';
import type { Opportunity, Context } from './shared';
export default function Detail({
record: r,
context: c,
zone_origin,
returnUrl = "/oportunidades",
returnUrl = '/oportunidades',
dossierOrigin,
}: {
record: Opportunity;
@@ -19,34 +19,57 @@ export default function Detail({
dossierOrigin?: { id: string; title: string } | null;
}) {
const { auth } = usePage<{ auth: { user: unknown } }>().props;
const [sharing, setSharing] = useState("");
const [sharing, setSharing] = useState('');
return (
<Frame title={r.title}>
<PartnershipSourceLinks type="investment" id={r.id}/>
<Link href={returnUrl} className="underline">Voltar à pesquisa</Link>
{dossierOrigin && <p><Link className="underline" href={`/carteira/${dossierOrigin.id}`}>Voltar ao dossier: {dossierOrigin.title}</Link></p>}
<PartnershipSourceLinks type="investment" id={r.id} />
<Link href={returnUrl} className="underline">
Voltar à pesquisa
</Link>
{dossierOrigin && (
<p>
<Link
className="underline"
href={`/carteira/${dossierOrigin.id}`}
>
Voltar ao dossier: {dossierOrigin.title}
</Link>
</p>
)}
<p>
{r.reference} · {r.sector?.name} · {r.province} {r.district}
</p>
{!r.last_validated_at && (
<p className="rounded border border-amber-700 bg-amber-50 p-4">
Esta ficha não regista data de validação documental. Confirme a origem e as condições antes de agir. Preparar uma manifestação expressa interesse; não confirma a oferta nem representa aprovação.
Esta ficha não regista data de validação documental.
Confirme a origem e as condições antes de agir. Preparar uma
manifestação expressa interesse; não confirma a oferta nem
representa aprovação.
</p>
)}
<p className="text-xl">{r.summary}</p>
<InvestmentMapPanel filters={{ opportunity_id: r.id }} />
{c.primary_territory_path && c.primary_territory_path.length > 0 && (
<p>Localização: {c.primary_territory_path.map((node) => node.name).join(" → ")}</p>
)}
{c.primary_territory_path &&
c.primary_territory_path.length > 0 && (
<p>
Localização:{' '}
{c.primary_territory_path
.map((node) => node.name)
.join(' → ')}
</p>
)}
<div className="flex flex-wrap gap-4">
{auth.user ? (
<button
className={button}
onClick={() =>
router.post("/investidor/manifestacoes", {
router.post('/investidor/manifestacoes', {
opportunity_id: r.id,
...(zone_origin
? { zone_id: zone_origin.id, intent: "interest" }
? {
zone_id: zone_origin.id,
intent: 'interest',
}
: {}),
})
}
@@ -58,21 +81,28 @@ export default function Detail({
Entrar para preparar manifestação
</Link>
)}
<Link className="underline" href={`/manifestar-interesse/${r.slug}`}>
<Link
className="underline"
href={`/manifestar-interesse/${r.slug}`}
>
Contacto rápido sem rascunho
</Link>
<button
className="underline"
onClick={() => {
if (!navigator.clipboard) {
setSharing("Copie a ligação na barra de endereço do navegador.");
setSharing(
'Copie a ligação na barra de endereço do navegador.',
);
return;
}
navigator.clipboard
.writeText(window.location.href)
.then(() => setSharing("Ligação copiada."))
.then(() => setSharing('Ligação copiada.'))
.catch(() =>
setSharing("Copie a ligação na barra de endereço do navegador."),
setSharing(
'Copie a ligação na barra de endereço do navegador.',
),
);
}}
>
@@ -82,7 +112,9 @@ export default function Detail({
{sharing && <p role="status">{sharing}</p>}
{!!c.zones?.length && (
<section className={card}>
<h2 className="text-xl font-bold">ZEE, ZFI e parques associados</h2>
<h2 className="text-xl font-bold">
ZEE, ZFI e parques associados
</h2>
{c.zones.map((z) => (
<p key={z.id}>
<Link
@@ -90,50 +122,59 @@ export default function Detail({
href={`/zonas?category=${z.category}&q=${encodeURIComponent(z.name)}`}
>
{z.name}
</Link>{" "}
·{" "}
{z.association_type === "official"
? "Associação documental validada"
: "Relação " + z.association_type}{" "}
</Link>{' '}
·{' '}
{z.association_type === 'official'
? 'Associação documental validada'
: 'Relação ' + z.association_type}{' '}
· Fonte: {z.source_reference}
</p>
))}
<p>A associação não atribui automaticamente benefícios ou licenças.</p>
<p>
A associação não atribui automaticamente benefícios ou
licenças.
</p>
</section>
)}
<div className="grid gap-6 lg:grid-cols-3">
<section className={card + " whitespace-pre-line lg:col-span-2"}>
<section
className={card + ' whitespace-pre-line lg:col-span-2'}
>
<h2 className="mb-3 text-xl font-bold">O investimento</h2>
{r.description || "Descrição por completar."}
{r.description || 'Descrição por completar.'}
</section>
<dl className={card + " space-y-4"}>
<dl className={card + ' space-y-4'}>
{[
["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],
['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]) => (
<div key={key}>
<dt className="font-bold">{key}</dt>
<dd>{value || "Não indicado"}</dd>
<dd>{value || 'Não indicado'}</dd>
</div>
))}
</dl>
</div>
{c.profile && (
<section className={card + " space-y-4"}>
<h2 className="text-xl font-bold">Viabilidade e preparação</h2>
<section className={card + ' space-y-4'}>
<h2 className="text-xl font-bold">
Viabilidade e preparação
</h2>
{[
["Modelo de negócio", c.profile.business_model],
["Requisitos", c.profile.requirements],
["Riscos", c.profile.risks],
["Fonte", c.profile.source_reference],
['Modelo de negócio', c.profile.business_model],
['Requisitos', c.profile.requirements],
['Riscos', c.profile.risks],
['Fonte', c.profile.source_reference],
].map(([label, text]) => (
<div key={label}>
<h3 className="font-bold">{label}</h3>
<p className="whitespace-pre-line">{text || "Não indicado"}</p>
<p className="whitespace-pre-line">
{text || 'Não indicado'}
</p>
</div>
))}
{c.profile.is_education && (
@@ -144,25 +185,44 @@ export default function Detail({
</section>
)}
<section className="grid gap-4 md:grid-cols-4">
{(["clusters", "corridors", "projects", "locations"] as const).map((key, i) => (
{(
['clusters', 'corridors', 'projects', 'locations'] as const
).map((key, i) => (
<div className={card} key={key}>
<h2 className="font-bold">
{["Clusters", "Corredores", "Projectos âncora", "Territórios"][i]}
{
[
'Clusters',
'Corredores',
'Projectos âncora',
'Territórios',
][i]
}
</h2>
{c[key].map((entity) => (
<p key={entity.id}>
{entity.dossiers?.map(dossier => <span key={dossier.id}><Link className="underline" href={`/carteira/${dossier.id}`}>Consultar dossier: {dossier.title}</Link><br /></span>)}
{entity.dossiers?.map((dossier) => (
<span key={dossier.id}>
<Link
className="underline"
href={`/carteira/${dossier.id}`}
>
Consultar dossier: {dossier.title}
</Link>
<br />
</span>
))}
<Link
className="underline"
href={
"/oportunidades?" +
'/oportunidades?' +
[
"cluster_id",
"corridor_id",
"project_id",
"geo_location_id",
'cluster_id',
'corridor_id',
'project_id',
'geo_location_id',
][i] +
"=" +
'=' +
entity.id
}
>
@@ -174,7 +234,20 @@ export default function Detail({
</div>
))}
</section>
{(['projects','clusters'] as const).flatMap(key => c[key].filter(entity => entity.geography && entity.dossiers?.length).map(entity => <StructureGeographyPanel key={`${key}-${entity.id}`} geography={entity.geography!} cluster={key === 'clusters'} dossierId={entity.dossiers![0].id} />))}
{(['projects', 'clusters'] as const).flatMap((key) =>
c[key]
.filter(
(entity) => entity.geography && entity.dossiers?.length,
)
.map((entity) => (
<StructureGeographyPanel
key={`${key}-${entity.id}`}
geography={entity.geography!}
cluster={key === 'clusters'}
dossierId={entity.dossiers![0].id}
/>
)),
)}
<section className={card}>
<h2 className="text-xl font-bold">
Infraestruturas, competências, educação e apoios
@@ -186,8 +259,9 @@ export default function Detail({
))}
{!c.facets.length && (
<p>
Sem características estruturadas publicadas. Pode declarar as suas
necessidades na manifestação de interesse.
Sem características estruturadas publicadas. Pode
declarar as suas necessidades na manifestação de
interesse.
</p>
)}
</section>