resolvemos o problema dos ZEE e ZFI
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-07 19:46:35 +02:00
parent 0a086c3fa5
commit bdd766c68a
74 changed files with 6401 additions and 32 deletions
@@ -0,0 +1,39 @@
import { Link } from "@inertiajs/react";
import { useEffect, useState } from "react";
export default function PartnershipSearchResults({ query }: { query: string }) {
const [items, setItems] = useState<{ id: number; title: string }[]>([]);
useEffect(() => {
if (!query.trim()) {
setItems([]);
return;
}
const controller = new AbortController();
fetch("/api/v1/partnerships?q=" + encodeURIComponent(query), {
signal: controller.signal,
headers: { Accept: "application/json" },
})
.then((r) => (r.ok ? r.json() : null))
.then((data) => setItems(data?.data ?? []))
.catch(() => {});
return () => controller.abort();
}, [query]);
if (!items.length) return null;
return (
<section className="my-5 space-y-3 rounded border p-4">
<h2 className="text-xl font-bold">Parcerias nesta pesquisa</h2>
{items.slice(0, 5).map((item) => (
<p key={item.id}>
<Link className="underline" href={"/parcerias/" + item.id}>
{item.title}
</Link>
</p>
))}
<Link
className="underline"
href={"/parcerias?q=" + encodeURIComponent(query)}
>
Ver todas as parcerias correspondentes
</Link>
</section>
);
}
@@ -0,0 +1,52 @@
import { Link } from "@inertiajs/react";
import { useEffect, useState } from "react";
export default function PartnershipSourceLinks({
type,
id,
}: {
type: string;
id: string | number;
}) {
const [data, setData] = useState<{
available: boolean;
items: { id: number; title: string }[];
} | null>(null);
useEffect(() => {
const controller = new AbortController();
fetch(
`/api/v1/partnerships/source/${encodeURIComponent(type)}/${encodeURIComponent(String(id))}`,
{
signal: controller.signal,
headers: { Accept: "application/json" },
},
)
.then((r) => (r.ok ? r.json() : null))
.then(setData)
.catch(() => {});
return () => controller.abort();
}, [type, id]);
if (!data?.available) return null;
return (
<section className="my-5 space-y-3 rounded border p-4">
<h2 className="text-xl font-bold">
Parcerias ligadas a este registo
</h2>
{data.items.map((item) => (
<p key={item.id}>
<Link className="underline" href={"/parcerias/" + item.id}>
{item.title}
</Link>
</p>
))}
{!data.items.length && (
<p>Ainda não há parcerias publicadas com esta origem.</p>
)}
<Link
className="underline"
href={`/parcerias/criar?origin_type=${encodeURIComponent(type)}&origin_id=${encodeURIComponent(String(id))}`}
>
Propor parceria a partir deste registo
</Link>
</section>
);
}
+5 -2
View File
@@ -6,6 +6,7 @@
useRef,
useState,
} from 'react';
import PartnershipSourceLinks from './partnership-source-links';
import {
getAutosaveSnapshot,
partitionSimulationDraft,
@@ -1053,6 +1054,7 @@ export function SimulationForm() {
let cancelled = false;
void (async () => {
let local: SimulationDraft = {};
const requestedDraftId = new URLSearchParams(window.location.search).get('draft');
try {
const stored = sessionStorage.getItem(draftKey);
if (stored) local = JSON.parse(stored) as SimulationDraft;
@@ -1063,7 +1065,7 @@ export function SimulationForm() {
}
try {
const response = await fetch(
'/api/v1/simulation-drafts/current',
requestedDraftId ? `/api/v1/simulation-drafts/${encodeURIComponent(requestedDraftId)}` : '/api/v1/simulation-drafts/current',
{
credentials: 'same-origin',
headers: {
@@ -1110,7 +1112,7 @@ export function SimulationForm() {
setSelectedAccountDraftId(
listPayload.data[0]?.id ?? '',
);
if (previewPayload.data) {
if (previewPayload.data && !requestedDraftId) {
setPendingAnonymousDraft(previewPayload.data);
setShowDraftChoice(true);
setSaveStatus(
@@ -2104,6 +2106,7 @@ export function SimulationForm() {
className="space-y-6 rounded-xl border bg-white p-4 sm:p-6"
aria-labelledby="simulator-step-title"
>
{canSavePersonalData && draftVersionNo && draftIdRef.current && <PartnershipSourceLinks type="simulation" id={draftIdRef.current}/>}
<div className="flex flex-wrap items-start justify-between gap-3">
<div>
<h2
@@ -0,0 +1,43 @@
import { Link } from '@inertiajs/react';
import InteractiveInvestmentMap from './interactive-investment-map';
export type DocumentedLocation = { id: string; name: string; role: string; source_reference?: string; location_type: string;
path: { id: string; name: string; location_type: string }[];
coordinates: { geometry_id: string; source_reference: string; geometry: { coordinates: [number, number] } }[] };
export type StructureGeography = {
locations: DocumentedLocation[];
members: { id: string; dossier_id: string; title: string; code: string; role: string; validation_status: string; source_reference: string; locations: DocumentedLocation[] }[];
clusters: { id: string; dossier_id: string; title: string; role: string; validation_status: string; source_reference: string }[];
chainLinks: { id: string; origin: string; destination: string; link_type: string }[];
chains?: { id: string; code: string; name: string; stage: string }[];
};
const roles: Record<string,string> = { primary: 'Localização principal', secondary: 'Localização secundária', impact: 'Área de impacto', coverage: 'Área de abrangência documentada' };
export function LocationList({ locations }: { locations: DocumentedLocation[] }) {
return <div className="space-y-4">{locations.map((location, index) => <article key={`${location.id}-${location.role}-${index}`} className="rounded-lg border p-4">
<h3 className="font-bold">{roles[location.role] ?? location.role}: {location.name}</h3>
<dl className="grid gap-2 sm:grid-cols-2">{[['province','Província'],['district','Distrito'],['admin_post','Posto administrativo'],['locality','Localidade']].map(([type,label]) => <div key={type}><dt className="font-semibold">{label}</dt><dd>{location.path.find(node => node.location_type===type)?.name ?? 'Não documentado'}</dd></div>)}</dl>
{location.coordinates.map(point => <p key={point.geometry_id}>Coordenadas documentadas ({location.location_type === 'site' ? 'local do projecto' : 'referência territorial; não representa a implantação'}): {point.geometry.coordinates[1]}, {point.geometry.coordinates[0]} · Fonte: {point.source_reference}</p>)}
{!location.coordinates.length && <p>Coordenadas não documentadas.</p>}
<p className="text-sm">Fonte da relação: {location.source_reference ?? 'Não indicada'}</p>
<Link className="underline" href={`/oportunidades?geo_location_id=${location.id}`}>Pesquisar oportunidades neste território</Link>
</article>)}</div>;
}
export default function StructureGeographyPanel({ geography, cluster = false, dossierId }: { geography: StructureGeography; cluster?: boolean; dossierId: string }) {
const items = cluster ? geography.members.flatMap(member=>member.locations.map(location=>({location,title:member.title,url:`/carteira/${member.dossier_id}`}))) : geography.locations.map(location=>({location,title:location.name,url:`/carteira/${dossierId}`}));
const points = items.flatMap(item=>item.location.location_type === 'site' ? item.location.coordinates.map(point=>({geometry:point.geometry,properties:{id:0,title:item.title,location:`${roles[item.location.role] ?? item.location.role} · ${item.location.name}`,url:item.url}})) : []).map((point,index)=>({...point,properties:{...point.properties,id:index+1}}));
return <section className="space-y-4 rounded-xl border p-5" aria-labelledby={`documented-geography-${dossierId}`}>
<h2 id={`documented-geography-${dossierId}`} className="text-xl font-bold">{cluster ? 'Abrangência do cluster e localizações dos membros' : 'Localização documentada do projecto'}</h2>
<LocationList locations={geography.locations} />
{!geography.locations.length && <p>{cluster ? 'A área própria de abrangência do cluster não está documentada em referências territoriais. As localizações dos membros abaixo não definem o seu perímetro.' : 'Sem associação territorial estruturada. Consulte a descrição de localização no dossier; os níveis desconhecidos permanecem não documentados.'}</p>}
{cluster && <p>O mapa apresenta locais documentados dos membros. Não existe um ponto único atribuído ao cluster.</p>}
<InteractiveInvestmentMap points={points} />
{!points.length && <p>Sem coordenadas documentadas dos locais. Nenhum ponto foi estimado.</p>}
{geography.members.map(member=><article key={member.id} className="space-y-3 border-t pt-4"><h3 className="font-bold"><Link className="underline" href={`/carteira/${member.dossier_id}?from=${dossierId}`}>{member.code} · {member.title}</Link></h3>
<p>Papel: {member.role} · Relação {member.validation_status === 'validated' ? 'validada no cadastro' : 'documental de planeamento; validação pendente'} · Fonte: {member.source_reference}</p><LocationList locations={member.locations}/>{!member.locations.length && <p>Localização estruturada do membro não documentada.</p>}</article>)}
{geography.clusters.map(item=><p key={item.id}>Cluster: <Link className="underline" href={`/carteira/${item.dossier_id}?from=${dossierId}`}>{item.title}</Link> · {item.validation_status === 'validated' ? 'validada no cadastro' : 'relação documental de planeamento; validação pendente'} · Fonte: {item.source_reference}</p>)}
{cluster && <div><h3 className="font-bold">Elos da cadeia de valor cadastrados</h3>{geography.chains?.map(chain=><p key={chain.id}>{chain.code} · {chain.name} · {({input:'Insumos',production:'Produção',processing:'Transformação',logistics:'Logística',market:'Mercado'} as Record<string,string>)[chain.stage] ?? chain.stage}</p>)}{!geography.chains?.length && <p>Sem elos estruturados cadastrados. As actividades e lacunas descritas no dossier continuam disponíveis.</p>}</div>}
{!!geography.chainLinks.length && <div><h3 className="font-bold">Relações entre elos da cadeia de valor</h3>{geography.chainLinks.map(link=><p key={link.id}>{link.origin} → {link.destination} · {link.link_type}</p>)}</div>}
</section>;
}
@@ -1,9 +1,10 @@
import { Link } from "@inertiajs/react";
import { Frame, button, card } from "./shared";
import { businessModalities } from "./business-types";
import PartnershipSourceLinks from '@/components/partnership-source-links';
type Business = {
slug: string; title: string; modality: string; objective?: string | null; stage?: string | null; activity_code?: string | null;
id: string; slug: string; title: string; modality: string; objective?: string | null; stage?: string | null; activity_code?: string | null;
amount_min?: string | null; amount_max?: string | null; available_percentage?: string | null; currency?: string | null;
province?: string | null; district?: string | null; locality?: string | null; sector?: { name: string; slug: string } | null;
};
@@ -11,6 +12,7 @@ type Business = {
export default function BusinessOpportunity({ record, returnUrl = "/negocios", interestUrl = `/negocios/${record.slug}/manifestar-interesse` }: { record: Business; returnUrl?: string; interestUrl?: string }) {
return (
<Frame title={record.title}>
<PartnershipSourceLinks type="business" id={record.id}/>
<Link href={returnUrl} className="underline">Voltar às oportunidades</Link>
<section className={`${card} space-y-4`}>
<p>{businessModalities[record.modality] ?? record.modality}</p>
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from "react";
import Map from "@/components/interactive-investment-map";
import { TerritoryLevel, type TerritoryOption } from "@/components/investment-territory";
import { MATURITY_LEVELS } from "@/lib/investment-maturity";
import PartnershipSearchResults from '@/components/partnership-search-results';
import { Frame, Field, input, button, card, money, api, groupLabels } from "./shared";
import type { Opportunity, References } from "./shared";
@@ -189,6 +190,7 @@ export default function Catalogue({
<Frame
title={form.data.education ? "Oportunidades na Educação" : "Catálogo de investimento"}
>
<PartnershipSearchResults query={String(filters.q??'')}/>
<nav aria-label="Dimensões do catálogo" className="grid gap-3 sm:grid-cols-4">
<Link className={card} href={dimensionUrl("cluster")}>
Por Cluster
+8
View File
@@ -1,6 +1,8 @@
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";
export default function Detail({
@@ -8,17 +10,21 @@ export default function Detail({
context: c,
zone_origin,
returnUrl = "/oportunidades",
dossierOrigin,
}: {
record: Opportunity;
context: Context;
zone_origin?: { id: string; name: string } | null;
returnUrl?: string;
dossierOrigin?: { id: string; title: string } | null;
}) {
const { auth } = usePage<{ auth: { user: unknown } }>().props;
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>}
<p>
{r.reference} · {r.sector?.name} · {r.province} {r.district}
</p>
@@ -145,6 +151,7 @@ export default function Detail({
</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>)}
<Link
className="underline"
href={
@@ -167,6 +174,7 @@ 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} />))}
<section className={card}>
<h2 className="text-xl font-bold">
Infraestruturas, competências, educação e apoios
@@ -1,5 +1,6 @@
import { Link, router, useForm } from "@inertiajs/react";
import { Frame, Field, input, button, card } from "./shared";
import PartnershipSourceLinks from '@/components/partnership-source-links';
type RecordData = { version: number; payload: Record<string, string> };
type Company = RecordData & { id: string };
@@ -47,6 +48,7 @@ export default function Profile({
</p>
{companies.map((company) => (
<section key={company.id} className={card}>
<PartnershipSourceLinks type="company" id={company.id}/>
<h3 className="text-xl font-bold">{company.payload.name}</h3>
<Editor
key={company.version}
+2 -1
View File
@@ -1,6 +1,7 @@
import { Head, Link, usePage } from "@inertiajs/react";
import type { ReactNode } from "react";
import { PortalMenu } from "@/layouts/portal-navigation";
import type { StructureGeography } from '@/components/structure-geography';
export type Option = {
id: number;
@@ -11,7 +12,7 @@ export type Option = {
requires_description: boolean;
sort_order: number;
};
export type Entity = { id: string; name: string };
export type Entity = { id: string; name: string; dossiers?: { id: string; title: string; source: string }[]; geography?: StructureGeography | null };
export type References = {
zones?: { id: string; name: string; category: string }[];
options: Option[];
+2
View File
@@ -4,6 +4,7 @@ import InvestmentMapPanel from "@/components/investment-map-panel";
import { TerritoryFields, type TerritoryOption } from "@/components/investment-territory";
import { useState } from "react";
import { Frame, Field, input, button, card, api } from "./shared";
import PartnershipSourceLinks from '@/components/partnership-source-links';
import ZoneRelations from "./zone-relations";
import ZoneMap from "./zone-map";
import ZoneAttachments from "./zone-attachments";
@@ -196,6 +197,7 @@ function Editor({
}
return (
<Frame title={z.name}>
{!management&&<PartnershipSourceLinks type="zone" id={z.id}/>}
<p>
{z.code} · {z.category.toUpperCase()} · {z.validation_status} · {z.province}{" "}
{z.district}
@@ -0,0 +1,445 @@
import { Link, useForm } from "@inertiajs/react";
import { Management } from "./shared";
type Plan = {
target: { database: string; port: number };
locations: {
code: string;
project_id: string;
name: string;
role: string;
source_reference: string;
source_quote: string;
reason: string;
existing: boolean;
}[];
memberships: {
cluster_code: string;
project_code: string;
source_reference: string;
source_quote: string;
action: string;
}[];
prepared_opportunities: {
reference: string;
title: string;
project_code: string | null;
location_text: string;
source_reference: string;
identity_status: string;
unknown: string[];
reason: string;
}[];
pending: { code: string; reason: string; name?: string }[];
};
type Territory = {
row_id: string;
validation_hash: string;
status: "grounded" | "pending" | "contradictory";
applied: boolean;
issues: string[];
warnings: string[];
current: {
id: string;
name: string;
role: string;
path: { name: string; type: string }[];
}[];
proposed: {
name: string;
role: string;
path: { name: string; type: string }[];
};
coordinates: { source: string; coordinates: number[]; srid: number }[];
coordinate_checks: {
territory_id: string;
source: string;
compatible: boolean;
}[];
};
type History = {
id: string;
date: string;
actor_id: number;
actor: string | null;
data: {
sources?: {
row_id: string;
source_reference: string;
reason: string;
}[];
};
};
const roles: Record<string, string> = {
primary: "Principal",
secondary: "Secundária",
impact: "Área de impacto",
};
const levels: Record<string, string> = {
country: "País",
province: "Província",
district: "Distrito",
admin_post: "Posto administrativo",
locality: "Localidade",
site: "Implantação",
};
function pathText(path: { name: string; type: string }[]) {
return (
path
.map((node) => `${levels[node.type] ?? node.type}: ${node.name}`)
.join(" → ") || "Hierarquia não indicada"
);
}
function IndividualAssociation({
hash,
item,
}: {
hash: string;
item: Territory;
}) {
const form = useForm({
hash,
row_id: item.row_id,
validation_hash: item.validation_hash,
});
return (
<form
onSubmit={(event) => {
event.preventDefault();
form.transform(() => ({
hash,
row_id: item.row_id,
validation_hash: item.validation_hash,
}));
form.post("/management/relationship-repair", {
preserveScroll: true,
});
}}
>
<button
className="rounded bg-emerald-800 px-4 py-2 text-white disabled:opacity-50"
disabled={
form.processing ||
item.applied ||
item.status !== "grounded"
}
>
{item.applied
? "Associação aplicada"
: "Aplicar esta associação"}
</button>
{Object.values(form.errors).map((error) => (
<p key={error} role="alert">
{error}
</p>
))}
</form>
);
}
type Unproposed = {
code: string;
current: { name: string; role: string }[];
source: string | null;
location_text: string | null;
reasons: string[];
};
export default function RelationshipRepair({
hash,
plan,
territorial,
history,
unproposed,
}: {
hash: string;
plan: Plan;
territorial: Territory[];
history: History[];
unproposed: Unproposed[];
}) {
const form = useForm({ hash });
return (
<Management title="Associações documentadas de projectos âncora e clusters">
<p>
Pré-visualização para {plan.target.database}:{plan.target.port}.
A execução verifica o backup e o restauro, a versão dos dossiers
e os identificadores. As associações existentes são preservadas.
</p>
<p>
O plano corrige localizações documentadas. As oportunidades
abaixo ficam preparadas para cadastro; não são publicadas nem
ligadas a clusters por pertencerem ao mesmo projecto.
</p>
<form
onSubmit={(event) => {
event.preventDefault();
form.post("/management/relationship-repair");
}}
>
<button
className="rounded bg-emerald-800 px-4 py-3 text-white disabled:opacity-50"
disabled={form.processing}
>
Aplicar associações fundamentadas
</button>
{Object.values(form.errors).map((error) => (
<p key={error} role="alert">
{error}
</p>
))}
</form>
<section className="space-y-4">
<h2 className="text-xl font-bold">
Localizações: {plan.locations.length}
</h2>
<p>
As propostas acrescentam localizações documentadas e
preservam as atuais. Cada projeto pode ter várias
localizações principais, secundárias e de impacto. A
localização não é deduzida de clusters ou da proximidade a
zonas.
</p>
{(["grounded", "pending", "contradictory"] as const).map(
(status) => (
<section
key={status}
className="space-y-4"
aria-label={
status === "grounded"
? "Associações fundamentadas"
: status === "pending"
? "Associações pendentes"
: "Associações contraditórias"
}
>
<h3 className="text-lg font-bold">
{status === "grounded"
? "Fundamentadas"
: status === "pending"
? "Pendentes"
: "Contraditórias"}
:{" "}
{territorial.filter(
(item) => item.status === status,
).length +
(status === "pending"
? unproposed.length
: 0)}
</h3>
{status === "pending" &&
unproposed.map((item) => (
<article
key={item.code}
className="space-y-2 rounded border p-4"
>
<h4 className="font-bold">
{item.code} · Sem associação
territorial individualizada
</h4>
<p>
Localização atual:{" "}
{item.current
.map(
(location) =>
`${location.name} · ${roles[location.role]}`,
)
.join("; ") ||
"Sem localização cadastrada"}
</p>
<p>
Localização documental proposta:{" "}
{item.location_text ??
"Não indicada"}
</p>
<p>
Documento de origem:{" "}
{item.source ?? "Não indicado"}
</p>
{item.reasons.map((reason) => (
<p key={reason}>{reason}</p>
))}
</article>
))}
{territorial.map((validation, index) =>
validation.status !== status ? null : (
<article
key={validation.row_id}
data-row-id={validation.row_id}
className="space-y-3 rounded border p-4"
>
<h4 className="font-bold">
{plan.locations[index].code} →{" "}
{validation.proposed.name} ·{" "}
{roles[validation.proposed.role] ??
validation.proposed.role}
</h4>
<div>
<strong>Localização atual</strong>
{validation.current.length ? (
<ul>
{validation.current.map(
(current, i) => (
<li key={i}>
{current.name} ·{" "}
{roles[
current.role
] ??
current.role}{" "}
—{" "}
{pathText(
current.path,
)}
</li>
),
)}
</ul>
) : (
<p>
Sem localização cadastrada.
</p>
)}
</div>
<p>
<strong>
Localização proposta:
</strong>{" "}
{pathText(validation.proposed.path)}{" "}
· {roles[validation.proposed.role]}
</p>
<p>
Documento de origem:{" "}
{
plan.locations[index]
.source_reference
}
</p>
<blockquote>
{plan.locations[index].source_quote}
</blockquote>
<p>
Motivo:{" "}
{plan.locations[index].reason}
</p>
{validation.coordinates.map(
(point, i) => (
<p key={i}>
Coordenadas (longitude,
latitude):{" "}
{point.coordinates.join(
", ",
)}{" "}
· SRID {point.srid} · Fonte:{" "}
{point.source}
</p>
),
)}
{validation.coordinate_checks.map(
(check, i) => (
<p key={i}>
{check.compatible
? "Coordenadas compatíveis com o limite territorial"
: "Coordenadas incompatíveis com o limite territorial"}{" "}
· Fonte cartográfica:{" "}
{check.source}
</p>
),
)}
{validation.issues.map((issue) => (
<p
key={issue}
className="font-semibold text-red-700"
>
{issue}
</p>
))}
{validation.warnings.map((warning) => (
<p key={warning}>{warning}</p>
))}
<IndividualAssociation
hash={hash}
item={validation}
/>
</article>
),
)}
</section>
),
)}
</section>
<section className="space-y-3">
<h2 className="text-xl font-bold">Histórico de aplicação</h2>
{history.length ? (
history.map((event) => (
<article key={event.id} className="rounded border p-4">
<p>
Autor: {event.actor ?? "Utilizador"} (ID{" "}
{event.actor_id}) · Data: {event.date}
</p>
{event.data.sources?.map((source) => (
<p key={source.row_id}>
Fonte: {source.source_reference} · Motivo:{" "}
{source.reason}
</p>
))}
</article>
))
) : (
<p>Nenhuma associação aplicada por este plano.</p>
)}
</section>
<section className="space-y-4">
<h2 className="text-xl font-bold">
Projectos nos clusters: {plan.memberships.length}
</h2>
{plan.memberships.map((item, index) => (
<article key={index} className="rounded border p-4">
<h3 className="font-bold">
{item.cluster_code} ↔ {item.project_code}
</h3>
<p>
{item.action === "present_existing"
? "Relação existente, agora apresentada como proposta documental pendente"
: "Relação ausente"}
</p>
<p>Fonte: {item.source_reference}</p>
<blockquote>{item.source_quote}</blockquote>
</article>
))}
</section>
<section className="space-y-4">
<h2 className="text-xl font-bold">
Registos de oportunidades preparados:{" "}
{plan.prepared_opportunities.length}
</h2>
{plan.prepared_opportunities.map((item, index) => (
<details key={index} className="rounded border p-4">
<summary>
{item.reference} · {item.title}
</summary>
<p>
Projecto:{" "}
{item.project_code ??
"Identidade em conflito; associação pendente"}
</p>
<p>{item.location_text}</p>
<p>Fonte: {item.source_reference}</p>
<p>{item.reason}</p>
<p>Dados por completar: {item.unknown.join(", ")}.</p>
</details>
))}
</section>
<section>
<h2 className="text-xl font-bold">Pendências concretas</h2>
<ul className="list-disc pl-5">
{plan.pending.map((item, index) => (
<li key={index}>
{item.code}: {item.reason} {item.name}
</li>
))}
</ul>
</section>
<Link href="/carteira" className="underline">
Consultar carteira
</Link>
</Management>
);
}
+2
View File
@@ -53,6 +53,8 @@ export function Management({ title, children }: { title: string; children: React
<Link href="/management/crm/investors">Investidores</Link>
<Link href="/management/projects">Projectos</Link>
<Link href="/management/clusters">Clusters</Link>
<Link href="/management/relationship-repair">Revisão das associações documentadas</Link>
<Link href="/management/partnerships-install">Aplicação da Bolsa de Parcerias</Link>
<Link href="/management/corridors">Corredores</Link>
<Link href="/management/territory-associations">
Localizações dos investimentos
@@ -0,0 +1,179 @@
import { Link, router } from "@inertiajs/react";
import { useState } from "react";
import InteractiveInvestmentMap, {
type InvestmentMapFeature,
} from "@/components/interactive-investment-map";
import {
Frame,
Field,
control,
button,
type Catalogues,
type Partnership,
} from "./shared";
type Result = Pick<
Partnership,
"id" | "title" | "kind" | "partnership_type" | "deadline"
> & { summary: string | null; province: string; sector: string };
export default function Catalogue(
p: Catalogues & {
results: {
data: Result[];
total: number;
prev_page_url: string | null;
next_page_url: string | null;
};
filters: Record<string, string>;
mapPoints: InvestmentMapFeature[];
},
) {
const [filters, setFilters] = useState(p.filters);
const set = (key: string, value: string) =>
setFilters({ ...filters, [key]: value });
return (
<Frame title="Bolsa de Parcerias">
<p className="mb-5">
Explore ofertas e procuras de colaboração. Pode preparar uma
ideia com os dados disponíveis; a publicação passa por
moderação.
</p>
<form
className="grid gap-4 rounded border p-5 md:grid-cols-3"
onSubmit={(e) => {
e.preventDefault();
router.get("/parcerias", filters);
}}
>
<Field label="Pesquisar">
<input
className={control}
value={filters.q ?? ""}
onChange={(e) => set("q", e.target.value)}
/>
</Field>
<Field label="Tipo de parceria">
<select
className={control}
value={filters.partnership_type ?? ""}
onChange={(e) =>
set("partnership_type", e.target.value)
}
>
<option value="">Todos</option>
{Object.entries(p.types).map(([key, label]) => (
<option key={key} value={key}>
{label}
</option>
))}
</select>
</Field>
<Field label="Oferta ou procura">
<select
className={control}
value={filters.kind ?? ""}
onChange={(e) => set("kind", e.target.value)}
>
<option value="">Ambas</option>
<option value="offering">Oferta</option>
<option value="seeking">Procura</option>
</select>
</Field>
<Field label="Setor">
<select
className={control}
value={filters.sector_id ?? ""}
onChange={(e) => set("sector_id", e.target.value)}
>
<option value="">Todos</option>
{p.sectors.map((x) => (
<option key={x.id} value={x.id}>
{x.name}
</option>
))}
</select>
</Field>
<Field label="Território">
<select
className={control}
value={filters.territory_id ?? ""}
onChange={(e) => set("territory_id", e.target.value)}
>
<option value="">Todos</option>
{p.territories.map((x) => (
<option key={x.id} value={x.id}>
{x.name} · {x.location_type}
</option>
))}
</select>
</Field>
<div className="self-end">
<button className={button}>Pesquisar parcerias</button>
</div>
</form>
<p className="my-5">{p.results.total} parcerias publicadas</p>
<div className="grid gap-5 md:grid-cols-2">
{p.results.data.map((item) => (
<article
key={item.id}
className="space-y-3 rounded border p-5"
>
<h2 className="text-xl font-bold">
<Link href={"/parcerias/" + item.id}>
{item.title}
</Link>
</h2>
<p>
{item.partnership_type
? p.types[item.partnership_type]
: "Tipo por completar"}{" "}
· {item.kind === "offering" ? "Oferta" : "Procura"}
</p>
<p>{item.summary}</p>
<p>
{item.sector || "Setor por completar"} ·{" "}
{item.province || "Território na ficha"}
</p>
{item.deadline && <p>Prazo: {item.deadline}</p>}
<Link
href={"/parcerias/" + item.id}
className="underline"
>
Consultar parceria
</Link>
</article>
))}
</div>
{!p.results.data.length && (
<p className="my-8">
Nenhuma parceria corresponde aos filtros.
</p>
)}
<section className="my-6 space-y-3 rounded border p-5">
<h2 className="text-xl font-bold">
Mapa dos resultados desta página
</h2>
<p>
Localizações próprias e contexto documental das origens são
identificados separadamente. Um cluster pode apresentar
vários locais dos membros; estes pontos não confirmam a
implantação da parceria.
</p>
<InteractiveInvestmentMap points={p.mapPoints} />
{!p.mapPoints.length && (
<p>
Sem coordenadas documentadas nos resultados. As fichas e
os filtros territoriais continuam disponíveis.
</p>
)}
</section>
<nav className="mt-6 flex gap-4">
{p.results.prev_page_url && (
<Link href={p.results.prev_page_url}>Anterior</Link>
)}
{p.results.next_page_url && (
<Link href={p.results.next_page_url}>Seguinte</Link>
)}
</nav>
</Frame>
);
}
@@ -0,0 +1,124 @@
import { Link, router } from "@inertiajs/react";
import { Frame, labels, button, type Partnership } from "./shared";
type Props = {
mine: Pick<Partnership, "id" | "title" | "status">[];
interests: {
id: number;
partnership_id: number;
title: string;
status: string;
decision_reason: string | null;
room_id: number | null;
}[];
moderation: Pick<Partnership, "id" | "title" | "status">[];
notifications: {
id: number;
title: string;
href: string;
read_at: string | null;
}[];
};
export default function Dashboard(p: Props) {
return (
<Frame title="O meu painel de parcerias">
<div className="space-y-8">
<section>
<h2 className="mb-4 text-xl font-bold">
Ideias e propostas
</h2>
<Link className={button} href="/parcerias/criar">
Preparar uma parceria
</Link>
{p.mine.map((x) => (
<article className="mt-4 rounded border p-4" key={x.id}>
<Link
className="font-semibold underline"
href={"/parcerias/" + x.id}
>
{x.title || "Ideia sem título"}
</Link>
<p>{labels[x.status] ?? x.status}</p>
<p>
Próxima ação:{" "}
{["draft", "returned", "rejected"].includes(
x.status,
)
? "Completar e pré-visualizar para submissão"
: x.status === "published"
? "Consultar candidatos e esclarecer pendências"
: "Acompanhar a decisão"}
</p>
</article>
))}
</section>
<section>
<h2 className="text-xl font-bold">
As minhas candidaturas
</h2>
{p.interests.map((x) => (
<article className="my-4 rounded border p-4" key={x.id}>
<Link
className="underline"
href={"/parcerias/" + x.partnership_id}
>
{x.title}
</Link>
<p>
{labels[x.status]} · {x.decision_reason}
</p>
{x.room_id && (
<Link
className={button}
href={"/parcerias/salas/" + x.room_id}
>
Abrir conexão privada
</Link>
)}
</article>
))}
</section>
{p.moderation.length > 0 && (
<section>
<h2 className="text-xl font-bold">Fila de moderação</h2>
{p.moderation.map((x) => (
<p key={x.id}>
<Link
className="underline"
href={"/parcerias/" + x.id}
>
{x.title} · {labels[x.status]}
</Link>
</p>
))}
</section>
)}
<section>
<h2 className="text-xl font-bold">
Notificações no portal
</h2>
{p.notifications.map((n) => (
<article className="my-3 rounded border p-3" key={n.id}>
<Link href={n.href} className="underline">
{n.title}
</Link>
{!n.read_at && (
<button
className="ml-4 underline"
onClick={() =>
router.post(
"/parcerias/notificacoes/" +
n.id +
"/ler",
)
}
>
Marcar como lida
</button>
)}
</article>
))}
</section>
</div>
</Frame>
);
}
+628
View File
@@ -0,0 +1,628 @@
import { Link, useForm, usePage } from "@inertiajs/react";
import StructureGeographyPanel, {
type StructureGeography,
} from "@/components/structure-geography";
import {
Frame,
Errors,
Field,
control,
button,
labels,
type Catalogues,
type Interest,
type Partnership,
type Source,
} from "./shared";
type Props = Catalogues & {
record: Partnership;
owner: boolean;
canEdit: boolean;
moderator: boolean;
origins: (Source & { geography: StructureGeography | null })[];
locations: {
id: string;
name: string;
role: string;
source_reference: string;
path: { name: string }[];
}[];
interests: Interest[];
history: {
event_type: string;
actor_id: number;
occurred_at: string;
payload: string;
}[];
};
function Publication({ p }: { p: Props }) {
const form = useForm({ version: p.record.version, action: "", reason: "" });
const action = (value: string) => {
form.transform((data) => ({ ...data, action: value }));
form.post("/parcerias/" + p.record.id + "/estado", {
preserveScroll: true,
});
};
return (
<section className="space-y-4 rounded border p-5">
<h2 className="text-xl font-bold">Pré-visualização e publicação</h2>
<p>
Estado: {labels[p.record.status] ?? p.record.status}.
Verificação da organização, setor e localização permanecem por
confirmar quando não há evidência.
</p>
<Field label="Motivo da ação">
<textarea
className={control}
value={form.data.reason}
onChange={(e) => form.setData("reason", e.target.value)}
/>
</Field>
<Errors errors={form.errors} />
<div className="flex flex-wrap gap-3">
{p.canEdit &&
["draft", "returned", "rejected"].includes(
p.record.status,
) && (
<button
className={button}
disabled={form.processing || !form.data.reason}
onClick={() => action("submit")}
>
Submeter para publicação
</button>
)}
{p.moderator &&
!p.owner &&
["submitted", "pending"].includes(p.record.status) &&
["publish", "return", "reject"].map((value) => (
<button
className={button}
key={value}
disabled={form.processing || !form.data.reason}
onClick={() => action(value)}
>
{
{
publish: "Publicar",
return: "Devolver para correção",
reject: "Rejeitar com fundamento",
}[value]
}
</button>
))}
{p.canEdit &&
["published", "suspended", "archived"].includes(
p.record.status,
) && (
<button
className={button}
disabled={form.processing || !form.data.reason}
onClick={() => action("renew")}
>
Renovar em rascunho
</button>
)}
{p.canEdit &&
["draft", "published", "suspended", "rejected"].includes(
p.record.status,
) && (
<button
className={button}
disabled={form.processing || !form.data.reason}
onClick={() => action("archive")}
>
Arquivar publicação
</button>
)}
{p.canEdit && (
<Link
className="underline"
href={"/parcerias/" + p.record.id + "/editar"}
>
Editar rascunho
</Link>
)}
</div>
</section>
);
}
function InterestForm({
record,
interest,
organizations,
}: {
record: Partnership;
interest?: Interest;
organizations: Catalogues["organizations"];
}) {
const form = useForm({
version: interest?.version ?? null,
organization_id: interest?.organization_id ?? "",
proposal: interest?.proposal ?? "",
payload: {
capacity: interest?.payload.capacity ?? "",
availability: interest?.payload.availability ?? "",
contribution: interest?.payload.contribution ?? "",
conflicts: interest?.payload.conflicts ?? "",
consent: interest?.payload.consent ?? false,
},
});
return (
<form
className="space-y-4 rounded border p-5"
onSubmit={(e) => {
e.preventDefault();
form.post("/parcerias/" + record.id + "/interesses", {
preserveScroll: true,
});
}}
>
<h2 className="text-xl font-bold">
{interest
? "Atualizar manifestação de interesse"
: "Manifestar interesse"}
</h2>
<p>
Declarações são informações comunicadas por si; não atribuem
verificação. Dados desconhecidos podem ser esclarecidos no
processo.
</p>
<Errors errors={form.errors} />
<Field label="Participação">
<select
className={control}
value={form.data.organization_id}
onChange={(e) =>
form.setData("organization_id", e.target.value)
}
>
<option value="">Participação pessoal</option>
{organizations.map((o) => (
<option key={o.id} value={o.id}>
{o.name}
</option>
))}
</select>
</Field>
<Field label="Proposta curta">
<textarea
className={control}
value={form.data.proposal}
onChange={(e) => form.setData("proposal", e.target.value)}
/>
</Field>
{(
[
"capacity",
"availability",
"contribution",
"conflicts",
] as const
).map((key) => (
<Field
key={key}
label={
{
capacity: "Capacidade disponível",
availability: "Disponibilidade",
contribution: "Contribuição proposta",
conflicts: "Conflitos de interesse declarados",
}[key]
}
>
<textarea
className={control}
value={form.data.payload[key]}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
[key]: e.target.value,
})
}
/>
</Field>
))}
<label className="block">
<input
type="checkbox"
checked={form.data.payload.consent}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
consent: e.target.checked,
})
}
/>{" "}
Autorizo a partilha desta candidatura com o responsável pela
parceria.
</label>
<button className={button} disabled={form.processing}>
Guardar interesse
</button>
</form>
);
}
function Candidacy({
interest,
owner,
canEdit,
record,
organizations,
}: {
interest: Interest;
owner: boolean;
canEdit: boolean;
record: Partnership;
organizations: Catalogues["organizations"];
}) {
const assessment = Object.fromEntries(
interest.match.criteria.map((c) => [
c.code,
{
state: interest.assessment[c.code]?.state ?? "unknown",
evidence: interest.assessment[c.code]?.evidence ?? "",
},
]),
);
const form = useForm({
version: interest.version,
action: "",
reason: "",
assessment,
});
const act = (action: string) => {
form.transform((data) => ({
...data,
action,
assessment: action === "assess" ? data.assessment : {},
}));
form.post("/parcerias/candidaturas/" + interest.id, {
preserveScroll: true,
});
};
return (
<article className="space-y-4 rounded border p-5">
<h3 className="text-lg font-bold">
Candidatura {interest.id} · {labels[interest.status]}
</h3>
<p>{interest.proposal}</p>
<p>{interest.payload.capacity}</p>
<p>
Disponibilidade:{" "}
{interest.payload.availability || "Por esclarecer"}
</p>
<p>
Contribuição:{" "}
{interest.payload.contribution || "Por esclarecer"}
</p>
<p>
Conflitos declarados:{" "}
{interest.payload.conflicts || "Sem informação"}
</p>
{interest.decision_reason && (
<p>Última decisão: {interest.decision_reason}</p>
)}
<p>
Correspondência: {interest.match.score_min}–
{interest.match.score_max}% · Elegibilidade:{" "}
{labels[interest.match.eligibility]}. O intervalo distingue
dados desconhecidos de incumprimentos; não é uma aprovação.
</p>
<ul className="space-y-2">
{interest.match.criteria.map((c) => (
<li key={c.code}>
{c.label} · peso {c.weight} · {labels[c.state]}
{c.mandatory ? " · Obrigatório" : ""}
{c.evidence && <> · Evidência: {c.evidence}</>}
<p className="text-sm">{c.explanation}</p>
</li>
))}
</ul>
{interest.room_id && (
<Link
className={button}
href={"/parcerias/salas/" + interest.room_id}
>
Abrir conexão privada
</Link>
)}
{owner &&
canEdit &&
["submitted", "clarification", "shortlisted"].includes(
interest.status,
) && (
<>
<details className="space-y-4">
<summary>Registar avaliação fundamentada</summary>
{interest.match.criteria.map((c) => (
<div
className="my-3 grid gap-3 md:grid-cols-2"
key={c.code}
>
<Field label={c.label}>
<select
className={control}
value={
form.data.assessment[c.code]
.state
}
onChange={(e) =>
form.setData("assessment", {
...form.data.assessment,
[c.code]: {
...form.data.assessment[
c.code
],
state: e.target.value,
},
})
}
>
{["unknown", "met", "unmet"].map(
(state) => (
<option
key={state}
value={state}
>
{labels[state]}
</option>
),
)}
</select>
</Field>
<Field label="Referência da evidência">
<input
className={control}
value={
form.data.assessment[c.code]
.evidence
}
onChange={(e) =>
form.setData("assessment", {
...form.data.assessment,
[c.code]: {
...form.data.assessment[
c.code
],
evidence:
e.target.value,
},
})
}
/>
</Field>
</div>
))}
</details>
<Field label="Motivo da decisão ou pedido de esclarecimento">
<textarea
className={control}
value={form.data.reason}
onChange={(e) =>
form.setData("reason", e.target.value)
}
/>
</Field>
<div className="flex flex-wrap gap-3">
{[
"assess",
"clarify",
"shortlist",
"reject",
...(interest.status === "shortlisted"
? ["connect"]
: []),
].map((action) => (
<button
key={action}
className={button}
disabled={
form.processing || !form.data.reason
}
onClick={() => act(action)}
>
{
{
assess: "Guardar avaliação",
clarify: "Pedir esclarecimento",
shortlist:
"Adicionar à lista curta",
reject: "Não selecionar",
connect: "Abrir negociação",
}[action]
}
</button>
))}
</div>
</>
)}
{!owner &&
["submitted", "clarification", "shortlisted"].includes(
interest.status,
) && (
<>
<Field label="Motivo da retirada">
<textarea
className={control}
value={form.data.reason}
onChange={(e) =>
form.setData("reason", e.target.value)
}
/>
</Field>
<button
className={button}
disabled={form.processing || !form.data.reason}
onClick={() => act("withdraw")}
>
Retirar candidatura
</button>
</>
)}
{!owner &&
["submitted", "clarification", "withdrawn"].includes(
interest.status,
) && (
<InterestForm
record={record}
interest={interest}
organizations={organizations}
/>
)}
<Errors errors={form.errors} />
</article>
);
}
export default function Detail(p: Props) {
const { auth } = usePage<{ auth: { user: unknown } }>().props;
return (
<Frame title={p.record.title || "Pré-visualização da ideia"}>
<div className="space-y-6">
<p>
{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>
<p className="whitespace-pre-wrap">
{p.record.payload.summary}
</p>
<section className="space-y-3 rounded border p-5">
<h2 className="text-xl font-bold">Oferta e procura</h2>
<p className="whitespace-pre-wrap">{p.record.offer}</p>
<p className="whitespace-pre-wrap">{p.record.seeking}</p>
{p.record.offer === null && (
<p>
O conteúdo detalhado está reservado à conexão
privada.
</p>
)}
<p>{p.record.payload.requirements}</p>
<p>Prazo: {p.record.deadline ?? "Por definir"}</p>
</section>
<section className="space-y-3 rounded border p-5">
<h2 className="text-xl font-bold">
Localizações próprias da parceria
</h2>
{p.locations.length ? (
p.locations.map((l, i) => (
<p key={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.
</p>
))
) : (
<p>Localização própria não indicada.</p>
)}
</section>
{p.origins.map((source, i) => (
<section key={i} className="space-y-3 rounded border p-5">
<h2 className="text-xl font-bold">
Origem:{" "}
<Link className="underline" href={source.href}>
{source.title}
</Link>
</h2>
<p>
As localizações do registo de origem são contexto
documental; não confirmam a implantação da parceria.
</p>
{source.geography && (
<StructureGeographyPanel
geography={source.geography}
cluster={source.type === "cluster"}
dossierId={"partnership-source-" + i}
/>
)}
</section>
))}
{(p.owner || p.moderator) && (
<Publication key={p.record.version} p={p} />
)}
{p.owner && p.interests.length > 0 && (
<section className="overflow-x-auto rounded border p-4">
<h2 className="text-xl font-bold">
Comparação de candidatos
</h2>
<table className="w-full text-left">
<thead>
<tr>
<th>Candidatura</th>
<th>Estado</th>
<th>Correspondência</th>
<th>Pendências</th>
</tr>
</thead>
<tbody>
{p.interests.map((i) => (
<tr key={i.id}>
<td>{i.id}</td>
<td>{labels[i.status]}</td>
<td>
{i.match.score_min}–
{i.match.score_max}%
</td>
<td>
{i.match.criteria
.filter(
(c) =>
c.state === "unknown",
)
.map((c) => c.label)
.join(", ")}
</td>
</tr>
))}
</tbody>
</table>
</section>
)}
{p.interests.map((i) => (
<Candidacy
key={i.id + ":" + i.version}
interest={i}
owner={p.owner}
canEdit={p.canEdit}
record={p.record}
organizations={p.organizations}
/>
))}
{!p.owner &&
p.record.status === "published" &&
auth.user &&
!p.interests.length && (
<InterestForm
record={p.record}
organizations={p.organizations}
/>
)}
{!auth.user && p.record.status === "published" && (
<Link className={button} href="/login">
Entrar para manifestar interesse
</Link>
)}
{p.history.length > 0 && (
<details>
<summary>Histórico e decisões</summary>
{p.history.map((h, i) => (
<p key={i}>
{h.occurred_at} · Autor {h.actor_id} ·{" "}
{h.event_type}
</p>
))}
</details>
)}
</div>
</Frame>
);
}
+447
View File
@@ -0,0 +1,447 @@
import { Link, useForm } from "@inertiajs/react";
import { useState } from "react";
import {
Frame,
Field,
Errors,
control,
button,
type Partnership,
type Catalogues,
} from "./shared";
type Location = {
geo_location_id: string;
role: string;
source_reference: string;
};
type Origin = { type: string; target_id: string };
type Props = Catalogues & {
record: Partnership | null;
locations: Location[];
origins: Origin[];
};
function Editor(p: Props) {
const form = useForm({
client_key: crypto.randomUUID(),
version: p.record?.version ?? null,
title: p.record?.title ?? "",
offer: p.record?.offer ?? "",
seeking: p.record?.seeking ?? "",
organization_id: p.record?.organization_id ?? "",
sector_id: p.record?.sector_id?.toString() ?? "",
kind: p.record?.kind ?? "seeking",
partnership_type: p.record?.partnership_type ?? "",
deadline: p.record?.deadline ?? "",
payload: {
summary: p.record?.payload.summary ?? "",
requirements: p.record?.payload.requirements ?? "",
mandatory: p.record?.payload.mandatory ?? ([] as string[]),
confidentiality: p.record?.payload.confidentiality ?? "public",
consent: p.record?.payload.consent ?? false,
},
locations: p.locations.map((x) => ({
geo_location_id: x.geo_location_id,
role: x.role,
source_reference: x.source_reference,
})),
origins: p.origins.map((x) => ({
type: x.type,
target_id: x.target_id,
})),
});
const [place, setPlace] = useState("");
const [role, setRole] = useState("primary");
const [source, setSource] = useState("Declaração do proponente");
const [origin, setOrigin] = useState("");
return (
<Frame title={p.record ? "Editar parceria" : "Preparar parceria"}>
<p className="mb-5">
Guarde uma ideia e retome-a no seu painel. Empresa constituída,
NUIT, documentos e verificação não são exigidos para preparar o
rascunho. As informações desconhecidas ficam pendentes.
</p>
<form
className="space-y-5"
onSubmit={(e) => {
e.preventDefault();
if (p.record) form.put("/parcerias/" + p.record.id);
else form.post("/parcerias/rascunhos");
}}
>
<Errors errors={form.errors} />
<Field label="Título">
<input
className={control}
value={form.data.title}
onChange={(e) => form.setData("title", e.target.value)}
/>
</Field>
<div className="grid gap-5 md:grid-cols-2">
<Field label="Participação">
<select
className={control}
value={form.data.organization_id}
onChange={(e) =>
form.setData("organization_id", e.target.value)
}
>
<option value="">
Ideia pessoal — sem organização indicada
</option>
{p.organizations.map((x) => (
<option key={x.id} value={x.id}>
{x.name}
</option>
))}
</select>
</Field>
<Field label="Oferta ou procura">
<select
className={control}
value={form.data.kind}
onChange={(e) =>
form.setData("kind", e.target.value)
}
>
<option value="seeking">Procura</option>
<option value="offering">Oferta</option>
</select>
</Field>
<Field label="Tipo de parceria">
<select
className={control}
value={form.data.partnership_type}
onChange={(e) =>
form.setData("partnership_type", e.target.value)
}
>
<option value="">Por definir</option>
{Object.entries(p.types).map(([k, v]) => (
<option key={k} value={k}>
{v}
</option>
))}
</select>
</Field>
<Field label="Setor">
<select
className={control}
value={form.data.sector_id}
onChange={(e) =>
form.setData("sector_id", e.target.value)
}
>
<option value="">Por definir</option>
{p.sectors.map((x) => (
<option key={x.id} value={x.id}>
{x.name}
</option>
))}
</select>
</Field>
</div>
<Field label="Resumo público">
<textarea
className={control}
value={form.data.payload.summary}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
summary: e.target.value,
})
}
/>
</Field>
<Field label="O que oferece">
<textarea
className={control}
value={form.data.offer}
onChange={(e) => form.setData("offer", e.target.value)}
/>
</Field>
<Field label="O que procura">
<textarea
className={control}
value={form.data.seeking}
onChange={(e) =>
form.setData("seeking", e.target.value)
}
/>
</Field>
<Field label="Requisitos e critérios desejáveis">
<textarea
className={control}
value={form.data.payload.requirements}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
requirements: e.target.value,
})
}
/>
</Field>
<fieldset className="space-y-2 rounded border p-4">
<legend>
Critérios obrigatórios expressos da proposta
</legend>
<p>
Marque apenas condições necessárias. Critérios
desejáveis servem a pontuação. Informação desconhecida
exige esclarecimento e não constitui incumprimento
comprovado.
</p>
{Object.entries(p.criteria).map(([k, v]) => (
<label className="block" key={k}>
<input
type="checkbox"
checked={form.data.payload.mandatory.includes(
k,
)}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
mandatory: e.target.checked
? [
...form.data.payload
.mandatory,
k,
]
: form.data.payload.mandatory.filter(
(x) => x !== k,
),
})
}
/>{" "}
{v}
</label>
))}
</fieldset>
<div className="grid gap-4 md:grid-cols-2">
<Field label="Prazo para interesses">
<input
type="date"
className={control}
value={form.data.deadline}
onChange={(e) =>
form.setData("deadline", e.target.value)
}
/>
</Field>
<Field label="Visibilidade do conteúdo detalhado">
<select
className={control}
value={form.data.payload.confidentiality}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
confidentiality: e.target.value,
})
}
>
<option value="public">
Público após moderação
</option>
<option value="private">
Resumo público; detalhes privados
</option>
</select>
</Field>
</div>
<section className="space-y-4 rounded border p-5">
<h2 className="font-bold">Localizações e abrangência</h2>
<p>
A localização de uma origem fica como contexto. Só
acrescente uma localização própria com fonte; não se
deduz por proximidade ou pertença a cluster.
</p>
<div className="grid gap-3 md:grid-cols-3">
<Field label="Localização do cadastro">
<select
className={control}
value={place}
onChange={(e) => setPlace(e.target.value)}
>
<option value="">Escolher território</option>
{p.territories.map((x) => (
<option key={x.id} value={x.id}>
{x.name} · {x.location_type}
</option>
))}
</select>
</Field>
<Field label="Papel">
<select
className={control}
value={role}
onChange={(e) => setRole(e.target.value)}
>
<option value="primary">Principal</option>
<option value="operating">
Área de atuação
</option>
<option value="coverage">Abrangência</option>
</select>
</Field>
<Field label="Fonte da localização">
<input
className={control}
value={source}
onChange={(e) => setSource(e.target.value)}
/>
</Field>
</div>
<button
type="button"
className={button}
disabled={!place || !source}
onClick={() => {
if (
!form.data.locations.some(
(x) =>
x.geo_location_id === place &&
x.role === role,
)
)
form.setData("locations", [
...form.data.locations,
{
geo_location_id: place,
role,
source_reference: source,
},
]);
}}
>
Acrescentar localização
</button>
{form.data.locations.map((l, i) => (
<p key={i}>
{
p.territories.find(
(t) => t.id === l.geo_location_id,
)?.name
}{" "}
· {l.role} · {l.source_reference}{" "}
<button
type="button"
className="underline"
onClick={() =>
form.setData(
"locations",
form.data.locations.filter(
(_, j) => j !== i,
),
)
}
>
Remover
</button>
</p>
))}
</section>
<section className="space-y-3 rounded border p-5">
<h2 className="font-bold">Registos de origem</h2>
<Field label="Adicionar origem existente">
<select
className={control}
value={origin}
onChange={(e) => setOrigin(e.target.value)}
>
<option value="">
Escolher empresa, investimento, projeto,
cluster, zona ou ficha
</option>
{p.sources?.map((x) => (
<option
key={x.type + ":" + x.target_id}
value={x.type + ":" + x.target_id}
>
{x.title}
</option>
))}
</select>
</Field>
<button
type="button"
className={button}
disabled={!origin}
onClick={() => {
const [type, target_id] = origin.split(":");
if (
!form.data.origins.some(
(x) =>
x.type === type &&
x.target_id === target_id,
)
)
form.setData("origins", [
...form.data.origins,
{ type, target_id },
]);
}}
>
Ligar origem
</button>
{form.data.origins.map((o, i) => (
<p key={i}>
{p.sources?.find(
(x) =>
x.type === o.type &&
x.target_id === o.target_id,
)?.title ?? "Origem documental ligada"}{" "}
<button
type="button"
className="underline"
onClick={() =>
form.setData(
"origins",
form.data.origins.filter(
(_, j) => j !== i,
),
)
}
>
Remover
</button>
</p>
))}
</section>
<label className="block">
<input
type="checkbox"
checked={form.data.payload.consent}
onChange={(e) =>
form.setData("payload", {
...form.data.payload,
consent: e.target.checked,
})
}
/>{" "}
Autorizo submeter o conteúdo indicado para divulgação no
âmbito escolhido. Não confirma verificação ou certificação.
</label>
<div className="flex flex-wrap gap-4">
<button className={button} disabled={form.processing}>
Guardar rascunho
</button>
{p.record && (
<Link
className="underline"
href={"/parcerias/" + p.record.id}
>
Pré-visualizar e submeter
</Link>
)}
</div>
</form>
</Frame>
);
}
export default function Page(p: Props) {
return (
<Editor
key={`${p.record?.id ?? "new"}:${p.record?.version ?? 0}`}
{...p}
/>
);
}
@@ -0,0 +1,74 @@
import { useForm, Link } from "@inertiajs/react";
import { Management } from "../management/shared";
import { Errors, button, labels } from "./shared";
type Props = {
hash: string;
installed: boolean;
target: { database: string; port: number };
records: { id: number; title: string; user_id: number; status: string }[];
backupVerified: boolean;
qaVerified: boolean;
backupDate: string | null;
changes: string[];
};
export default function Installation(p: Props) {
const form = useForm({ hash: p.hash });
return (
<Management title="Aplicação da Bolsa de Parcerias">
<div className="space-y-5">
<p>
Destino: {p.target.database}:{p.target.port}. Estado:{" "}
{p.installed
? "Instalada"
: "Preparada para aplicação autenticada"}
.
</p>
<p>
Backup e restauro:{" "}
{p.backupVerified ? "Comprovados" : "Pendentes"} ·{" "}
{p.backupDate}. QA desta versão:{" "}
{p.qaVerified ? "Comprovada" : "Pendente"}.
</p>
<ul className="list-disc pl-5">
{p.changes.map((change) => (
<li key={change}>{change}</li>
))}
</ul>
<h2 className="text-xl font-bold">
Propostas antigas a preservar: {p.records.length}
</h2>
{p.records.map((record) => (
<p key={record.id}>
{record.id} · {record.title} · Autor {record.user_id} ·{" "}
{labels[record.status] ?? record.status}
</p>
))}
{!p.installed && (
<form
onSubmit={(e) => {
e.preventDefault();
form.post("/management/partnerships-install");
}}
>
<Errors errors={form.errors} />
<button
className={button}
disabled={
form.processing ||
!p.backupVerified ||
!p.qaVerified
}
>
Aplicar módulo preservando propostas
</button>
</form>
)}
{p.installed && (
<Link href="/parcerias/painel" className="underline">
Abrir painel da Bolsa
</Link>
)}
</div>
</Management>
);
}
+505
View File
@@ -0,0 +1,505 @@
import { useForm, usePage, Link, router } from "@inertiajs/react";
import {
Frame,
Field,
Errors,
control,
button,
labels,
type Partnership,
} from "./shared";
type Room = {
id: number;
status: string;
version: number;
agreement: {
title: string;
terms: string;
confirmations: Record<string, { actor_id: number; date: string }>;
legal_signature_status: string;
} | null;
};
type Milestone = {
id: number;
title: string;
responsible_id: number;
due_date: string | null;
status: string;
evidence: string | null;
version: number;
};
type Props = {
room: Room;
partnership: Partnership & { user_id: number };
interest: { id: number; user_id: number };
canWrite: boolean;
messages: {
id: number;
name: string;
author_id: number;
body: string;
created_at: string;
}[];
documents: {
id: number;
owner_id: number;
file_name: string;
shared: boolean;
status: string;
malware_scan_status: string;
}[];
milestones: Milestone[];
};
function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
const form = useForm({
title: item?.title ?? "",
responsible_id: item?.responsible_id ?? p.partnership.user_id,
due_date: item?.due_date ?? "",
status: item?.status ?? "pending",
evidence: item?.evidence ?? "",
version: item?.version ?? null,
});
return (
<form
className="space-y-3 rounded border p-4"
onSubmit={(e) => {
e.preventDefault();
if (item)
form.put(
`/parcerias/salas/${p.room.id}/marcos/${item.id}`,
{ preserveScroll: true },
);
else
form.post(`/parcerias/salas/${p.room.id}/marcos`, {
preserveScroll: true,
});
}}
>
<h3 className="font-bold">
{item ? "Atualizar marco" : "Acrescentar marco"}
</h3>
<Field label="Entregável">
<input
className={control}
value={form.data.title}
onChange={(e) => form.setData("title", e.target.value)}
/>
</Field>
<Field label="Responsável">
<select
className={control}
value={form.data.responsible_id}
onChange={(e) =>
form.setData("responsible_id", Number(e.target.value))
}
>
<option value={p.partnership.user_id}>Proponente</option>
<option value={p.interest.user_id}>Candidato</option>
</select>
</Field>
<Field label="Data prevista">
<input
className={control}
type="date"
value={form.data.due_date}
onChange={(e) => form.setData("due_date", e.target.value)}
/>
</Field>
<Field label="Estado">
<select
className={control}
value={form.data.status}
onChange={(e) => form.setData("status", e.target.value)}
>
{["pending", "progress", "completed"].map((x) => (
<option key={x} value={x}>
{x === "pending" ? "Pendente" : labels[x]}
</option>
))}
</select>
</Field>
<Field label="Evidência ou referência do resultado">
<textarea
className={control}
value={form.data.evidence}
onChange={(e) => form.setData("evidence", e.target.value)}
/>
</Field>
<Errors errors={form.errors} />
<button className={button} disabled={form.processing}>
Guardar marco
</button>
</form>
);
}
export default function Page(p: Props) {
return <RoomPage key={p.room.id + ":" + p.room.version} {...p} />;
}
function RoomPage(p: Props) {
const { auth } = usePage<{ auth: { user: { id: number } } }>().props;
const message = useForm({ body: "", client_key: crypto.randomUUID() });
const agreement = useForm({
version: p.room.version,
action: "record",
title: p.room.agreement?.title ?? "",
terms: p.room.agreement?.terms ?? "",
reason: "",
});
const upload = useForm<{ file: File | null; shared: boolean }>({
file: null,
shared: false,
});
const act = (action: string) => {
agreement.transform((data) => ({ ...data, action }));
agreement.post(`/parcerias/salas/${p.room.id}/acordo`, {
preserveScroll: true,
});
};
const mutable =
p.canWrite && !["closed", "cancelled"].includes(p.room.status);
return (
<Frame title={"Conexão privada — " + p.partnership.title}>
<div className="space-y-6">
<Link
className="underline"
href={"/parcerias/" + p.partnership.id}
>
Regressar à parceria
</Link>
<p>
Estado da conexão: {labels[p.room.status]}. Esta sala
pertence apenas às partes autorizadas; não encerra outras
candidaturas.
</p>
<section className="space-y-4 rounded border p-5">
<h2 className="text-xl font-bold">
Mensagens e esclarecimentos
</h2>
{p.messages.map((m) => (
<article className="rounded bg-muted p-4" key={m.id}>
<p className="font-semibold">
{m.name} · {m.created_at}
</p>
<p className="whitespace-pre-wrap">{m.body}</p>
</article>
))}
{mutable && (
<form
className="space-y-3"
onSubmit={(e) => {
e.preventDefault();
message.post(
`/parcerias/salas/${p.room.id}/mensagens`,
{
preserveScroll: true,
onSuccess: () => {
message.setData({
body: "",
client_key: crypto.randomUUID(),
});
},
},
);
}}
>
<Field label="Mensagem privada">
<textarea
className={control}
value={message.data.body}
onChange={(e) =>
message.setData("body", e.target.value)
}
/>
</Field>
<Errors errors={message.errors} />
<button
className={button}
disabled={message.processing}
>
Enviar mensagem
</button>
</form>
)}
</section>
<section className="space-y-4 rounded border p-5">
<h2 className="text-xl font-bold">
Documentos autorizados
</h2>
<p>
O original fica no repositório privado. A partilha exige
autorização explícita; o download exige análise
antimalware limpa e hash correspondente. Anexar não
confirma autenticidade nem vigência.
</p>
{p.documents.map((d) => (
<article key={d.id}>
<p>
{d.file_name} ·{" "}
{d.shared
? "Partilhado com a contraparte"
: "Privado do autor"}{" "}
· Análise: {d.malware_scan_status}
</p>
{mutable && d.owner_id === auth.user.id && (
<button
className="underline"
onClick={() =>
router.post(
`/parcerias/salas/${p.room.id}/documentos/${d.id}/partilha`,
{ shared: !d.shared },
{ preserveScroll: true },
)
}
>
{d.shared
? "Retirar autorização de partilha"
: "Autorizar partilha com a contraparte"}
</button>
)}
{d.status === "active" &&
d.malware_scan_status === "clean" && (
<a
className="underline"
href={`/parcerias/salas/${p.room.id}/documentos/${d.id}`}
>
Descarregar documento
</a>
)}
</article>
))}
{mutable && (
<form
className="space-y-3"
onSubmit={(e) => {
e.preventDefault();
upload.post(
`/parcerias/salas/${p.room.id}/documentos`,
{
forceFormData: true,
preserveScroll: true,
},
);
}}
>
<Field label="Anexar PDF ou imagem">
<input
type="file"
className="w-full min-w-0 max-w-full"
accept=".pdf,.jpg,.jpeg,.png"
onChange={(e) =>
upload.setData(
"file",
e.target.files?.[0] ?? null,
)
}
/>
</Field>
<label className="block">
<input
type="checkbox"
checked={upload.data.shared}
onChange={(e) =>
upload.setData(
"shared",
e.target.checked,
)
}
/>{" "}
Autorizo a consulta pela contraparte desta sala.
</label>
<Errors errors={upload.errors} />
<button
className={button}
disabled={
upload.processing || !upload.data.file
}
>
Guardar documento privado
</button>
</form>
)}
</section>
<section className="space-y-4 rounded border p-5">
<h2 className="text-xl font-bold">
Acordo e plano conjunto
</h2>
<p>
Registe o instrumento, objetivos, contribuições,
responsabilidades, indicadores, riscos, dependências e
condições de saída. A confirmação no portal regista a
concordância comunicada pelas partes; não certifica
assinatura jurídica ou due diligence.
</p>
{p.room.agreement && (
<>
<h3 className="font-bold">
{p.room.agreement.title}
</h3>
<p className="whitespace-pre-wrap">
{p.room.agreement.terms}
</p>
<p>
Confirmações:{" "}
{Object.entries(p.room.agreement.confirmations)
.map(
([party, c]) =>
`${party}: autor ${c.actor_id}, ${c.date}`,
)
.join("; ") || "Pendentes"}
</p>
</>
)}
{mutable && (
<>
<Field label="Motivo da ação">
<textarea
className={control}
value={agreement.data.reason}
onChange={(e) =>
agreement.setData(
"reason",
e.target.value,
)
}
/>
</Field>
{["negotiation", "agreement_recorded"].includes(
p.room.status,
) && (
<>
<Field label="Título do instrumento">
<input
className={control}
value={agreement.data.title}
onChange={(e) =>
agreement.setData(
"title",
e.target.value,
)
}
/>
</Field>
<Field label="Condições e plano de valor">
<textarea
className={control}
rows={6}
value={agreement.data.terms}
onChange={(e) =>
agreement.setData(
"terms",
e.target.value,
)
}
/>
</Field>
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("record")}
>
Registar versão do acordo
</button>
</>
)}
<div className="flex flex-wrap gap-3">
{p.room.status === "agreement_recorded" && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("confirm")}
>
Confirmar pela minha parte
</button>
)}
{p.room.status === "agreed" && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("start")}
>
Iniciar acompanhamento
</button>
)}
{p.room.status === "execution" && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("complete")}
>
Concluir após os marcos
</button>
)}
{["agreed", "execution"].includes(
p.room.status,
) && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("renew")}
>
Registar renovação
</button>
)}
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("cancel")}
>
Cancelar conexão com motivo
</button>
</div>
<Errors errors={agreement.errors} />
</>
)}
</section>
<section className="space-y-4">
<h2 className="text-xl font-bold">Marcos e responsáveis</h2>
<p>
Participação atual:{" "}
{auth.user.id === p.partnership.user_id
? "Proponente"
: auth.user.id === p.interest.user_id
? "Candidato"
: "Representante autorizado"}
.
</p>
{p.milestones.map((m) => (
<article
key={m.id + ":" + m.version}
className="space-y-3"
>
<p>
{m.title} · {m.status === "pending" ? "Pendente" : labels[m.status]} · Prazo:{" "}
{m.due_date ?? "Pendente"} · Responsável ID{" "}
{m.responsible_id}
</p>
{mutable && <MilestoneForm p={p} item={m} />}
</article>
))}
{mutable &&
["agreement_recorded", "agreed", "execution"].includes(
p.room.status,
) && <MilestoneForm p={p} />}
</section>
</div>
</Frame>
);
}
+159
View File
@@ -0,0 +1,159 @@
import { Link } from "@inertiajs/react";
import { cloneElement, isValidElement, useId, type ReactNode } from "react";
import { Layout } from "../portfolio/shared";
export type Option = { id: string | number; name: string };
export type Territory = {
id: string;
name: string;
location_type: string;
parent_id: string | null;
};
export type Source = {
type: string;
target_id: string;
title: string;
href: string;
};
export type Catalogues = {
types: Record<string, string>;
criteria: Record<string, string>;
sectors: Option[];
territories: Territory[];
organizations: Option[];
sources?: Source[];
};
export type Partnership = {
id: number;
title: string;
status: string;
version: number;
kind: string;
partnership_type: string | null;
sector_id: number | null;
organization_id?: string | null;
deadline: string | null;
offer: string | null;
seeking: string | null;
payload: {
summary?: string;
requirements?: string;
mandatory?: string[];
confidentiality?: string;
consent?: boolean;
availability?: string;
};
};
export type Match = {
score_min: number | null;
score_max: number | null;
eligibility: string;
criteria: {
code: string;
label: string;
weight: number;
state: string;
mandatory: boolean;
evidence: string | null;
explanation: string;
}[];
};
export type Interest = {
id: number;
user_id: number;
partnership_id: number;
version: number;
proposal: string;
status: string;
decision_reason: string | null;
organization_id: string | null;
payload: {
capacity?: string;
availability?: string;
contribution?: string;
conflicts?: string;
consent?: boolean;
};
assessment: Record<string, { state: string; evidence?: string }>;
match: Match;
room_id: number | null;
};
export const labels: Record<string, string> = {
draft: "Rascunho",
pending: "Submetida — legado",
submitted: "Submetida",
returned: "Devolvida",
rejected: "Rejeitada",
published: "Publicada",
suspended: "Suspensa",
archived: "Arquivada",
withdrawn: "Retirada",
clarification: "Em esclarecimento",
shortlisted: "Lista curta",
negotiation: "Em negociação",
agreement_recorded: "Acordo registado",
agreed: "Confirmado pelas partes",
execution: "Em execução",
closed: "Concluída",
cancelled: "Cancelada",
progress: "Em curso",
completed: "Concluído",
met: "Comprovadamente cumprido",
unmet: "Comprovadamente incumprido",
unknown: "Informação insuficiente",
};
export const control = "w-full rounded border bg-background p-2";
export const button =
"inline-flex rounded bg-emerald-800 px-4 py-2 text-white disabled:opacity-50";
export function Frame({
title,
children,
}: {
title: string;
children: ReactNode;
}) {
return (
<Layout title={title}>
<nav className="mb-6 flex flex-wrap gap-5 underline">
<Link href="/parcerias">Catálogo</Link>
<Link href="/parcerias/painel">O meu painel</Link>
<Link href="/parcerias/criar">Preparar parceria</Link>
<Link href="/como-investir">Como investir</Link>
<Link href="/simulador-fiscal">
Simulador e ficha de projeto
</Link>
</nav>
{children}
</Layout>
);
}
export function Errors({ errors }: { errors: Record<string, string> }) {
return (
<>
{Object.entries(errors).map(([key, message]) => (
<p role="alert" className="text-red-700" key={key}>
{message}
</p>
))}
</>
);
}
export function Field({
label,
children,
}: {
label: string;
children: ReactNode;
}) {
const id = useId();
return (
<label className="block space-y-2">
<span id={id} className="font-medium">
{label}
</span>
{isValidElement<{ "aria-labelledby"?: string }>(children)
? cloneElement(children, { "aria-labelledby": id })
: children}
</label>
);
}
+1 -1
View File
@@ -34,7 +34,7 @@ export const kind = (r: Pick<Dossier, "project_id" | "cluster_id" | "corridor_id
export function Layout({ title, children }: { title: string; children: ReactNode }) {
const { flash } = usePage<{ flash?: { success?: string } }>().props;
return (
<main className="mx-auto max-w-6xl space-y-6 p-4 md:p-8">
<main className="mx-auto w-full min-w-0 max-w-6xl space-y-6 break-words p-4 md:p-8">
<Head title={title} />
<nav className="flex flex-wrap gap-5 text-sm underline" aria-label="Investimento">
<Link href="/">InvestMoz</Link>
+7 -1
View File
@@ -1,6 +1,8 @@
import { Link, useForm, router, usePage } from "@inertiajs/react";
import { useState } from "react";
import InvestmentMapPanel from "@/components/investment-map-panel";
import StructureGeographyPanel, { type StructureGeography } from '@/components/structure-geography';
import PartnershipSourceLinks from '@/components/partnership-source-links';
import { Management } from "../management/shared";
import { Layout, Field, control, button, labels, kind } from "./shared";
import type { Dossier } from "./shared";
@@ -9,6 +11,7 @@ export default function Show(props: Props) {
}
type Props = {
geography: StructureGeography;
existingSubmissions?: { id: string; version: number; updated_at: string }[];
anchorProject?: { code: string; name: string; status: string; budget_amount: string | null; budget_currency: string | null; start_date: string | null; end_date: string | null } | null;
zones?: {
@@ -36,6 +39,7 @@ function Editor({
zones = [],
anchorProject = null,
existingSubmissions = [],
geography,
}: Props) {
const { auth } = usePage<{ auth: { user: unknown } }>().props;
const [creatingManifestation, setCreatingManifestation] = useState(false);
@@ -55,6 +59,8 @@ function Editor({
{kind(record)} · {record.content.code}
</p>
<p className="text-sm">Fonte: {record.source}</p>
{(record.project_id||record.cluster_id)&&<PartnershipSourceLinks type={record.project_id?'project':'cluster'} id={record.project_id??record.cluster_id!}/>}
{(record.project_id || record.cluster_id) && <StructureGeographyPanel geography={geography} cluster={Boolean(record.cluster_id)} dossierId={record.id} />}
{anchorProject && (
<section className="space-y-2 rounded-xl border p-5" aria-labelledby="anchor-project-heading">
<h2 id="anchor-project-heading" className="text-xl font-bold">Referência de projecto âncora</h2>
@@ -148,7 +154,7 @@ function Editor({
<article key={opportunity.id}>
<Link
className="font-semibold underline"
href={`/oportunidades/${opportunity.slug}`}
href={`/oportunidades/${opportunity.slug}?from_dossier=${record.id}`}
>
{opportunity.title}
</Link>