first commit
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-09-28 10:01:09 +02:00
commit 250ac35fd1
481 changed files with 92144 additions and 0 deletions
+103
View File
@@ -0,0 +1,103 @@
import { Link, useForm } from '@inertiajs/react';
import { Management } from '../management/shared';
import type { Paginated } from '../management/shared';
import { Layout, Field, control, button, Pagination, kind } from './shared';
import type { Dossier } from './shared';
export default function Index({
records,
management,
filters,
}: {
records: Paginated<Dossier>;
management: boolean;
filters: { q?: string; kind?: string };
}) {
const form = useForm({ q: filters.q ?? '', kind: filters.kind ?? '' });
const base = management ? '/management/portfolio' : '/carteira';
const Frame = management ? Management : Layout;
return (
<Frame title="Corredores, clusters e projectos âncora">
<p>
Explore o território, identifique os elos da cadeia de valor e
acompanhe o seu interesse numa única conta.
</p>
{management && (
<p className="rounded border border-amber-500 p-3">
Matriz documental para revisão. Rascunhos não aparecem no
portal público. Pontuações não são recomendações
personalizadas.
</p>
)}
<form
className="flex flex-wrap items-end gap-3"
onSubmit={(e) => {
e.preventDefault();
form.get(base);
}}
>
<Field label="Pesquisar">
<input
className={control}
value={form.data.q}
onChange={(e) => form.setData('q', e.target.value)}
/>
</Field>
<Field label="Explorar por">
<select
className={control}
value={form.data.kind}
onChange={(e) => form.setData('kind', e.target.value)}
>
<option value="">Toda a carteira</option>
<option value="corridor">Corredores</option>
<option value="cluster">Matriz de clusters</option>
<option value="project">Projectos âncora</option>
</select>
</Field>
<button className={button}>Pesquisar</button>
</form>
<div className="grid gap-4 md:grid-cols-2">
{records.data.map((r) => (
<article
key={r.id}
className="space-y-3 rounded-xl border p-5"
>
<p className="text-sm">
{kind(r)} · {r.content.code}
{management &&
` · ${r.publication_status === 'published' ? 'Publicado' : 'Rascunho'}`}
</p>
<h2 className="text-xl font-semibold">
<Link
className="underline"
href={`${base}/${r.id}`}
>
{r.title}
</Link>
</h2>
<p>
{r.content.description ??
r.content.focus ??
r.content.anchors}
</p>
{r.content.priority && (
<p>
{r.content.priority}{' '}
<span className="text-sm">
(proposta documental)
</span>
</p>
)}
<Link className="underline" href={`${base}/${r.id}`}>
Explorar relações e próximos passos
</Link>
</article>
))}
</div>
{!records.data.length && (
<p>Ainda não existem fichas publicadas para esta pesquisa.</p>
)}
<Pagination page={records} />
</Frame>
);
}
+55
View File
@@ -0,0 +1,55 @@
import { Head, Link, usePage } from "@inertiajs/react";
import type { ReactNode } from "react";
export { button, control, Field, Pagination } from "../management/shared";
export type Dossier = {
id: string;
title: string;
source: string;
content: Record<string, string>;
project_id: string | null;
cluster_id: string | null;
corridor_id: string | null;
publication_status: string;
version_no?: number;
};
export const labels: Record<string, string> = {
description: "Visão e proposta de valor",
location: "Território",
region: "Região",
sector: "Sector",
promotion: "Promoção",
facts: "Dados indicativos da fonte",
partners: "Investidores e parceiros",
cta: "Próxima acção",
anchors: "Projectos âncora e oportunidades",
gaps: "Lacunas da cadeia de valor",
priority: "Prioridade proposta na matriz",
clusters: "Clusters associados",
focus: "Investimentos complementares",
notice: "Estado de validação",
code: "Código",
};
export const kind = (r: Pick<Dossier, "project_id" | "cluster_id" | "corridor_id">) =>
r.corridor_id ? "Corredor" : r.cluster_id ? "Cluster" : "Projecto âncora";
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">
<Head title={title} />
<nav className="flex flex-wrap gap-5 text-sm underline" aria-label="Investimento">
<Link href="/">InvestMoz</Link>
<Link href="/carteira?kind=corridor">Corredores</Link>
<Link href="/carteira?kind=cluster">Clusters</Link>
<Link href="/carteira?kind=project">Projectos âncora</Link>
<Link href="/investidor">O meu painel</Link>
</nav>
<h1 className="text-3xl font-semibold">{title}</h1>
{flash?.success && (
<p role="status" className="rounded border p-3">
{flash.success}
</p>
)}
{children}
</main>
);
}
+263
View File
@@ -0,0 +1,263 @@
import { Link, useForm, router } from "@inertiajs/react";
import { Management } from "../management/shared";
import { Layout, Field, control, button, labels, kind } from "./shared";
import type { Dossier } from "./shared";
export default function Show(props: Props) {
return <Editor key={`${props.record.id}:${props.record.version_no ?? 0}`} {...props} />;
}
type Props = {
zones?: {
id: string;
name: string;
category: string;
association_type: string;
source_reference: string;
}[];
record: Dossier;
related: Dossier[];
management: boolean;
origin: { id: string; title: string } | null;
opportunities?: { id: number; title: string; slug: string; summary: string }[];
chains?: { id: string; name: string; stage: string }[];
};
function Editor({
record,
related,
management,
origin,
opportunities = [],
chains = [],
zones = [],
}: Props) {
const form = useForm({
title: record.title,
source: record.source,
content: record.content,
version_no: record.version_no,
});
const approval = useForm({ approval_evidence: "", version_no: record.version_no });
const save = useForm({ origin_id: origin?.id ?? null });
const Frame = management ? Management : Layout;
const base = management ? "/management/portfolio" : "/carteira";
return (
<Frame title={record.title}>
<p>
{kind(record)} · {record.content.code}
</p>
<p className="text-sm">Fonte: {record.source}</p>
{zones.length > 0 && (
<section>
<h2 className="text-xl font-bold">ZEE, ZFI e parques relacionados</h2>
{zones.map((z) => (
<p key={z.id}>
<Link className="underline" href={`/zonas/${z.id}`}>
{z.name}
</Link>{" "}
· {z.association_type} · Fonte: {z.source_reference}
</p>
))}
</section>
)}
{origin && <p>Exploração iniciada em: {origin.title}</p>}
{!management && (
<button
type="button"
className={button}
onClick={() =>
router.post("/investidor/manifestacoes", { dossier_id: record.id })
}
>
Preparar manifestação com necessidades e anexos
</button>
)}
{chains.length > 0 && (
<section>
<h2 className="text-xl font-bold">Cadeia de valor</h2>
{chains.map((chain) => (
<p key={chain.id}>
{chain.name} —{" "}
{(
{
input: "Insumos",
production: "Produção",
processing: "Transformação",
logistics: "Logística",
market: "Mercado",
} as Record<string, string>
)[chain.stage] ?? chain.stage}
</p>
))}
</section>
)}
<section className="space-y-3">
<h2 className="text-xl font-bold">Oportunidades relacionadas</h2>
{opportunities.map((opportunity) => (
<article key={opportunity.id}>
<Link
className="font-semibold underline"
href={`/oportunidades/${opportunity.slug}`}
>
{opportunity.title}
</Link>
<p>{opportunity.summary}</p>
</article>
))}
{!opportunities.length && (
<p>Sem oportunidades publicadas associadas a esta ficha.</p>
)}
</section>
{management ? (
<>
<p>
Versão editorial: {record.version_no}. Guarde as alterações antes de
publicar.
</p>
<form
className="space-y-4"
onSubmit={(e) => {
e.preventDefault();
form.put(`${base}/${record.id}`);
}}
>
<Field label="Título">
<input
className={control}
value={form.data.title}
onChange={(e) => form.setData("title", e.target.value)}
/>
</Field>
<Field label="Fonte e versão">
<input
className={control}
value={form.data.source}
onChange={(e) => form.setData("source", e.target.value)}
/>
</Field>
{Object.entries(form.data.content).map(([key, value]) => (
<Field key={key} label={labels[key] ?? key}>
<textarea
className={control}
value={value ?? ""}
onChange={(e) =>
form.setData("content", {
...form.data.content,
[key]: e.target.value,
})
}
/>
</Field>
))}
{Object.entries(form.errors).map(([k, v]) => (
<p role="alert" key={k}>
{v}
</p>
))}
<button disabled={form.processing} className={button}>
Guardar rascunho
</button>
</form>
<form
className="space-y-3 rounded border p-4"
onSubmit={(e) => {
e.preventDefault();
approval.post(`${base}/${record.id}/publish`);
}}
>
<p>
O gestor autorizado pode aprovar e publicar esta ficha. Registe a
referência da sua decisão.
</p>
<Field label="Referência da autorização e revisão">
<textarea
className={control}
required
minLength={15}
value={approval.data.approval_evidence}
onChange={(e) =>
approval.setData("approval_evidence", e.target.value)
}
/>
</Field>
{approval.errors.approval_evidence && (
<p role="alert">{approval.errors.approval_evidence}</p>
)}
<button className={button} disabled={approval.processing || form.isDirty}>
Validar e publicar
</button>
</form>
</>
) : (
<>
<dl className="space-y-5">
{Object.entries(record.content)
.filter(([k]) => k !== "name" && k !== "code")
.map(([key, value]) => (
<div key={key}>
<dt className="font-semibold">{labels[key] ?? key}</dt>
<dd className="mt-1 whitespace-pre-line">{value}</dd>
</div>
))}
</dl>
<form
onSubmit={(e) => {
e.preventDefault();
save.post(`/investidor/guardar/${record.id}`);
}}
>
<button className={button} disabled={save.processing}>
Guardar no painel e preparar interesse
</button>
<p className="mt-2 text-sm">Acesso com conta e email verificado.</p>
</form>
</>
)}
<section className="space-y-3">
<h2 className="text-xl font-semibold">Percurso de execução</h2>
<ol className="list-decimal space-y-2 pl-6">
<li>Explore as relações entre corredor, cluster e projecto âncora.</li>
<li>
Consulte as componentes, parceiros e oportunidades de participação da ficha.
</li>
<li>
Guarde a ficha no painel do investidor e manifeste interesse com o papel e
prazo pretendidos.
</li>
<li>A equipa acompanha o pedido no CRM, com responsável e próxima acção.</li>
</ol>
{management && (
<div className="flex flex-wrap gap-4 underline">
{record.project_id && (
<Link href={`/management/projects/${record.project_id}/edit`}>
Gerir projecto
</Link>
)}
{record.cluster_id && (
<Link href={`/management/clusters/${record.cluster_id}/edit`}>
Gerir cadeias e lacunas do cluster
</Link>
)}
<Link href="/management/interests">Acompanhar pedidos</Link>
{record.publication_status === "published" && (
<Link href={`/carteira/${record.id}`}>Abrir ficha pública</Link>
)}
</div>
)}
<h2 className="text-xl font-semibold">Relações na carteira</h2>
{related.map((r) => (
<p key={r.id}>
{kind(r)}:{" "}
<Link
className="underline"
href={`${base}/${r.id}${management ? "" : `?from=${record.id}`}`}
>
{r.title}
</Link>
</p>
))}
{!related.length && <p>Sem relações disponíveis para consulta.</p>}
</section>
</Frame>
);
}
+174
View File
@@ -0,0 +1,174 @@
import { Link, useForm } from '@inertiajs/react';
import { Layout, Field, control, button } from './shared';
type Journey = {
id: string;
dossier_id: string | null;
title: string;
status: string;
reference: string | null;
request_status: string | null;
};
function JourneyCard({ journey }: { journey: Journey }) {
const form = useForm({
message: '',
country: 'Moçambique',
role: 'investir',
horizon: '',
privacy_consent: false,
});
return (
<article className="space-y-4 rounded-xl border p-5">
<h2 className="text-xl font-semibold">
{journey.dossier_id ? (
<Link
className="underline"
href={`/carteira/${journey.dossier_id}`}
>
{journey.title}
</Link>
) : (
journey.title
)}
</h2>
<p className="text-sm break-all">Jornada: {journey.id}</p>
{journey.reference ? (
<>
<p>
Protocolo: <strong>{journey.reference}</strong>
</p>
<p>
Estado:{' '}
{(
{
received: 'Recebido',
in_review: 'Em análise',
contacted: 'Contactado',
closed: 'Encerrado',
} as Record<string, string>
)[journey.request_status ?? ''] ?? 'Em acompanhamento'}
</p>
<p>
Próximo passo: aguardar contacto da equipa de
acompanhamento.
</p>
</>
) : journey.dossier_id ? (
<form
className="space-y-3"
onSubmit={(e) => {
e.preventDefault();
form.post(`/investidor/${journey.id}/interesse`);
}}
>
<p>
Os seus nome e email verificados acompanham o pedido.
Indique o objectivo para orientar o atendimento.
</p>
<Field label="País">
<input
className={control}
value={form.data.country}
onChange={(e) =>
form.setData('country', e.target.value)
}
required
/>
</Field>
<Field label="Papel pretendido">
<select
className={control}
value={form.data.role}
onChange={(e) =>
form.setData('role', e.target.value)
}
>
{[
'investir',
'financiar',
'fornecer',
'operar',
'parceria',
].map((r) => (
<option key={r} value={r}>
{r}
</option>
))}
</select>
</Field>
<Field label="Horizonte de investimento">
<input
className={control}
placeholder="Ex.: nos próximos 12 meses"
value={form.data.horizon}
onChange={(e) =>
form.setData('horizon', e.target.value)
}
required
/>
</Field>
<Field label="Objectivo e capacidade de participação">
<textarea
className={control}
minLength={20}
value={form.data.message}
onChange={(e) =>
form.setData('message', e.target.value)
}
required
/>
</Field>
<label className="flex items-start gap-2">
<input
type="checkbox"
checked={form.data.privacy_consent}
onChange={(e) =>
form.setData(
'privacy_consent',
e.target.checked,
)
}
required
/>
Autorizo a reutilização do meu nome e email e o
tratamento destes dados pela equipa do portal para
acompanhar este interesse.
</label>
{Object.entries(form.errors).map(([k, v]) => (
<p key={k} role="alert">
{v}
</p>
))}
<button disabled={form.processing} className={button}>
Manifestar interesse
</button>
</form>
) : (
<p>Aguarde a republicação da ficha para iniciar um pedido.</p>
)}
</article>
);
}
export default function Workspace({ journeys }: { journeys: Journey[] }) {
return (
<Layout title="O meu painel de investimento">
<p>
Oportunidades guardadas, contexto e protocolos das suas
manifestações.
</p>
<Link className={button} href="/carteira">
Explorar a carteira
</Link>
<div className="space-y-5">
{journeys.map((j) => (
<JourneyCard key={j.id} journey={j} />
))}
</div>
{!journeys.length && (
<p>
Guarde um corredor, cluster ou projecto para preparar o seu
interesse.
</p>
)}
</Layout>
);
}