oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
+56 -53
View File
@@ -1,18 +1,18 @@
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, {
LocationList,
} from '@/components/structure-geography';
import PartnershipSourceLinks from '@/components/partnership-source-links';
import TerritorialSources from '@/components/territorial-source-evidence';
import { Frame, card, button, money, groupLabels } from './shared';
import type { Opportunity, Context } from './shared';
} from "@/components/structure-geography";
import PartnershipSourceLinks from "@/components/partnership-source-links";
import TerritorialSources from "@/components/territorial-source-evidence";
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;
@@ -22,7 +22,7 @@ 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} />
@@ -52,7 +52,7 @@ export default function Detail({
)}
<p className="text-xl">{r.summary}</p>
<TerritorialSources sources={c.source_evidence} />
<section className={card + ' space-y-3'}>
<section className={card + " space-y-3"}>
<h2 className="text-xl font-bold">
Implantação declarada da oportunidade
</h2>
@@ -70,15 +70,18 @@ export default function Detail({
</p>
)}
</section>
<InvestmentMapPanel filters={{ opportunity_id: r.id }} />
<InvestmentMapPanel
filters={{ opportunity_id: r.id }}
territoryId={c.primary_territory_path?.at(-1)?.id}
/>
{c.primary_territory_path &&
c.primary_territory_path.length > 0 && (
<p>
Território principal cadastrado (implantação por
confirmar):{' '}
confirmar):{" "}
{c.primary_territory_path
.map((node) => node.name)
.join(' → ')}
.join(" → ")}
</p>
)}
<div className="flex flex-wrap gap-4">
@@ -86,12 +89,12 @@ export default function Detail({
<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',
intent: "interest",
}
: {}),
})
@@ -115,16 +118,16 @@ export default function Detail({
onClick={() => {
if (!navigator.clipboard) {
setSharing(
'Copie a ligação na barra de endereço do navegador.',
"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.',
"Copie a ligação na barra de endereço do navegador.",
),
);
}}
@@ -145,11 +148,11 @@ 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>
))}
@@ -161,42 +164,42 @@ export default function Detail({
)}
<div className="grid gap-6 lg:grid-cols-3">
<section
className={card + ' whitespace-pre-line lg:col-span-2'}
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'}>
<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'}
{text || "Não indicado"}
</p>
</div>
))}
@@ -209,16 +212,16 @@ export default function Detail({
)}
<section className="grid gap-4 md:grid-cols-4">
{(
['clusters', 'corridors', 'projects', 'locations'] as const
["clusters", "corridors", "projects", "locations"] as const
).map((key, i) => (
<div className={card} key={key}>
<h2 className="font-bold">
{
[
'Clusters',
'Corredores',
'Projectos âncora',
'Territórios',
"Clusters",
"Corredores",
"Projectos âncora",
"Territórios",
][i]
}
</h2>
@@ -238,14 +241,14 @@ export default function Detail({
<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
}
>
@@ -257,7 +260,7 @@ export default function Detail({
</div>
))}
</section>
{(['projects', 'clusters'] as const).flatMap((key) =>
{(["projects", "clusters"] as const).flatMap((key) =>
c[key]
.filter(
(entity) => entity.geography && entity.dossiers?.length,
@@ -266,7 +269,7 @@ export default function Detail({
<StructureGeographyPanel
key={`${key}-${entity.id}`}
geography={entity.geography!}
cluster={key === 'clusters'}
cluster={key === "clusters"}
dossierId={entity.dossiers![0].id}
/>
)),