File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,457 @@
|
||||
import { Link, router, useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Management, Field, control, button } from "../management/shared";
|
||||
import { capabilities, purposes, states } from "./labels";
|
||||
|
||||
type Source = {
|
||||
id: string;
|
||||
title: string;
|
||||
language: string;
|
||||
status: string;
|
||||
nature: string;
|
||||
valid_until: string;
|
||||
};
|
||||
type Props = {
|
||||
controls: { capability: string; suspended: boolean }[];
|
||||
sources: Source[];
|
||||
documents: { id: string; file_name: string }[];
|
||||
runs: {
|
||||
id: string;
|
||||
capability: string;
|
||||
review_status: string;
|
||||
review_requested: boolean;
|
||||
created_at: string;
|
||||
}[];
|
||||
today: string;
|
||||
};
|
||||
export default function Index({ controls, sources, documents, runs, today }: Props) {
|
||||
const [language, setLanguage] = useState<"pt" | "en">("pt");
|
||||
const t = (pt: string, en: string) => (language === "pt" ? pt : en);
|
||||
const query = useForm({
|
||||
capability: "assistant",
|
||||
language: "pt",
|
||||
purpose: "investment_information",
|
||||
query: "",
|
||||
source_id: "",
|
||||
interest_id: "",
|
||||
province: "",
|
||||
maturity_level: "",
|
||||
});
|
||||
const upload = useForm<{ file: File | null; authorised: boolean }>({
|
||||
file: null,
|
||||
authorised: false,
|
||||
});
|
||||
const source = useForm({
|
||||
document_id: "",
|
||||
title: "",
|
||||
language: "pt",
|
||||
nature: "pending",
|
||||
source_url: "",
|
||||
source_owner: "",
|
||||
evidence_reference: "",
|
||||
source_date: today,
|
||||
valid_until: "",
|
||||
authorised: false,
|
||||
});
|
||||
const [actionError, setActionError] = useState("");
|
||||
const post = (url: string, data: Record<string, string | boolean>) => {
|
||||
setActionError("");
|
||||
router.post(url, data, {
|
||||
onError: (errors) => setActionError(Object.values(errors).join(" ")),
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Management title={t("Assistência, fontes e revisão", "Assistance, sources and review")}>
|
||||
<Field label="Idioma / Language">
|
||||
<select
|
||||
className={control}
|
||||
value={language}
|
||||
onChange={(e) => setLanguage(e.target.value as "pt" | "en")}
|
||||
>
|
||||
<option value="pt">Português</option>
|
||||
<option value="en">English</option>
|
||||
</select>
|
||||
</Field>
|
||||
<p className="rounded border p-4">
|
||||
{t(
|
||||
"Ferramentas assistivas com fontes e regras. Não há modelo generativo activo. Os resultados não são decisões oficiais nem garantias de retorno ou aprovação.",
|
||||
"Assistive tools using sources and rules. No generative model is active. Results are not official decisions or guarantees of return or approval.",
|
||||
)}
|
||||
</p>
|
||||
<form
|
||||
className="grid gap-4 md:grid-cols-2"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
query.transform((data) => ({
|
||||
...data,
|
||||
language,
|
||||
purpose: purposes[data.capability] ?? "investment_information",
|
||||
}));
|
||||
query.post("/management/ai/runs");
|
||||
}}
|
||||
>
|
||||
<Field label={t("Capacidade", "Capability")}>
|
||||
<select
|
||||
className={control}
|
||||
value={query.data.capability}
|
||||
onChange={(e) => query.setData("capability", e.target.value)}
|
||||
>
|
||||
{controls.map((c) => (
|
||||
<option key={c.capability} value={c.capability} disabled={c.suspended}>
|
||||
{capabilities[c.capability]?.[language === "pt" ? 0 : 1]}
|
||||
{c.suspended ? t(" (suspensa)", " (suspended)") : ""}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{["assistant", "search"].includes(query.data.capability) && (
|
||||
<Field label={t("Pergunta ou termos de pesquisa", "Question or search terms")}>
|
||||
<textarea
|
||||
required
|
||||
maxLength={1000}
|
||||
minLength={3}
|
||||
className={control}
|
||||
value={query.data.query}
|
||||
onChange={(e) => query.setData("query", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{["assistant", "search", "summary"].includes(query.data.capability) && (
|
||||
<Field label={t("Fonte autorizada", "Authorised source")}>
|
||||
<select
|
||||
required={query.data.capability === "summary"}
|
||||
className={control}
|
||||
value={query.data.source_id}
|
||||
onChange={(e) => query.setData("source_id", e.target.value)}
|
||||
>
|
||||
<option value="">
|
||||
{t("Todas as fontes elegíveis", "All eligible sources")}
|
||||
</option>
|
||||
{sources
|
||||
.filter((s) => s.status === "approved")
|
||||
.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
)}
|
||||
{query.data.capability === "classify" && (
|
||||
<Field
|
||||
label={t(
|
||||
"Número interno do pedido (requer consentimento específico)",
|
||||
"Internal request number (specific consent required)",
|
||||
)}
|
||||
>
|
||||
<input
|
||||
required
|
||||
type="number"
|
||||
min={1}
|
||||
className={control}
|
||||
value={query.data.interest_id}
|
||||
onChange={(e) => query.setData("interest_id", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{query.data.capability === "recommend" && (
|
||||
<>
|
||||
<Field label={t("Província declarada", "Declared province")}>
|
||||
<input
|
||||
className={control}
|
||||
value={query.data.province}
|
||||
onChange={(e) => query.setData("province", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={t("Maturidade pretendida", "Desired maturity")}>
|
||||
<select
|
||||
className={control}
|
||||
value={query.data.maturity_level}
|
||||
onChange={(e) => query.setData("maturity_level", e.target.value)}
|
||||
>
|
||||
<option value="">{t("Não indicada", "Not specified")}</option>
|
||||
{[1, 2, 3, 4, 5, 6].map((n) => (
|
||||
<option key={n}>{n}</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
<div>
|
||||
{Object.entries(query.errors).map(([k, v]) => (
|
||||
<p role="alert" key={k}>
|
||||
{v}
|
||||
</p>
|
||||
))}
|
||||
<button
|
||||
disabled={
|
||||
query.processing ||
|
||||
controls.find((c) => c.capability === query.data.capability)?.suspended
|
||||
}
|
||||
className={button}
|
||||
>
|
||||
{t("Consultar", "Run assistance")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Suspensão imediata", "Immediate suspension")}
|
||||
</h2>
|
||||
{actionError && <p role="alert">{actionError}</p>}
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{controls.map((c) => (
|
||||
<button
|
||||
className={button}
|
||||
key={c.capability}
|
||||
onClick={() =>
|
||||
post(`/management/ai/controls/${c.capability}`, {
|
||||
suspended: !c.suspended,
|
||||
})
|
||||
}
|
||||
>
|
||||
{t(
|
||||
c.suspended ? "Retomar" : "Suspender",
|
||||
c.suspended ? "Resume" : "Suspend",
|
||||
)}{" "}
|
||||
· {capabilities[c.capability]?.[language === "pt" ? 0 : 1]}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Resultados recentes e revisão humana", "Recent results and human review")}
|
||||
</h2>
|
||||
{runs.length === 0 && <p>{t("Ainda sem consultas.", "No runs yet.")}</p>}
|
||||
{runs.map((r) => (
|
||||
<p key={r.id}>
|
||||
<Link className="underline" href={`/management/ai/runs/${r.id}`}>
|
||||
{capabilities[r.capability]?.[language === "pt" ? 0 : 1]} ·{" "}
|
||||
{r.created_at}
|
||||
</Link>{" "}
|
||||
— {language === "pt" ? states[r.review_status] : r.review_status}
|
||||
{r.review_requested && t(" · revisão solicitada", " · review requested")}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Fontes documentais", "Document sources")}
|
||||
</h2>
|
||||
<p>
|
||||
{t(
|
||||
"Apenas ficheiros de texto UTF-8 do cadastro documental privado, activos e não confidenciais. A autorização de uso deve ser confirmada por outra pessoa.",
|
||||
"Only active, non-confidential UTF-8 text files from the private document registry. Another person must confirm permission to use the source.",
|
||||
)}
|
||||
</p>
|
||||
{sources.map((s) => (
|
||||
<article className="space-y-2 rounded border p-3" key={s.id}>
|
||||
<p>
|
||||
{s.title} · {s.language.toUpperCase()} ·{" "}
|
||||
{language === "pt" ? states[s.status] : s.status} · {s.valid_until}
|
||||
</p>
|
||||
<p>{language === "pt" ? states[s.nature] : s.nature}</p>
|
||||
<div className="flex gap-3">
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
post(`/management/ai/sources/${s.id}/review`, {
|
||||
status: "approved",
|
||||
expected_status: s.status,
|
||||
})
|
||||
}
|
||||
>
|
||||
{t("Confirmar autorização", "Confirm authorisation")}
|
||||
</button>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
post(`/management/ai/sources/${s.id}/review`, {
|
||||
status: "revoked",
|
||||
expected_status: s.status,
|
||||
})
|
||||
}
|
||||
>
|
||||
{t("Revogar", "Revoke")}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
<details className="rounded border p-4">
|
||||
<summary>
|
||||
{t(
|
||||
"Adicionar documento de texto autorizado",
|
||||
"Add an authorised text document",
|
||||
)}
|
||||
</summary>
|
||||
<form
|
||||
className="mt-4 space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
upload.post("/management/ai/documents", {
|
||||
forceFormData: true,
|
||||
onSuccess: () => upload.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
label={t(
|
||||
"Ficheiro .txt UTF-8 (até 195 KiB)",
|
||||
"UTF-8 .txt file (up to 195 KiB)",
|
||||
)}
|
||||
>
|
||||
<input
|
||||
required
|
||||
type="file"
|
||||
accept=".txt,text/plain"
|
||||
className={control}
|
||||
onChange={(e) => upload.setData("file", e.target.files?.[0] ?? null)}
|
||||
/>
|
||||
</Field>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
required
|
||||
type="checkbox"
|
||||
checked={upload.data.authorised}
|
||||
onChange={(e) => upload.setData("authorised", e.target.checked)}
|
||||
/>
|
||||
{t(
|
||||
"Tenho autorização e confirmei a ausência de dados confidenciais ou pessoais desnecessários.",
|
||||
"I am authorised and have confirmed there is no confidential or unnecessary personal data.",
|
||||
)}
|
||||
</label>
|
||||
{Object.entries(upload.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={upload.processing}>
|
||||
{t("Guardar documento", "Save document")}
|
||||
</button>
|
||||
</form>
|
||||
</details>
|
||||
<details className="rounded border p-4">
|
||||
<summary>
|
||||
{t(
|
||||
"Registar fonte existente para revisão",
|
||||
"Register an existing source for review",
|
||||
)}
|
||||
</summary>
|
||||
<form
|
||||
className="mt-4 grid gap-4 md:grid-cols-2"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
source.post("/management/ai/sources", { onSuccess: () => source.reset() });
|
||||
}}
|
||||
>
|
||||
<Field label={t("Documento", "Document")}>
|
||||
<select
|
||||
required
|
||||
className={control}
|
||||
value={source.data.document_id}
|
||||
onChange={(e) => source.setData("document_id", e.target.value)}
|
||||
>
|
||||
<option value="">{t("Seleccionar", "Select")}</option>
|
||||
{documents.map((d) => (
|
||||
<option key={d.id} value={d.id}>
|
||||
{d.file_name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
"title",
|
||||
"source_url",
|
||||
"source_owner",
|
||||
"evidence_reference",
|
||||
"source_date",
|
||||
"valid_until",
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
title: t("Título", "Title"),
|
||||
source_url: t("Fonte HTTPS", "HTTPS source"),
|
||||
source_owner: t("Entidade proprietária", "Source owner"),
|
||||
evidence_reference: t(
|
||||
"Referência da evidência e autorização",
|
||||
"Evidence and authorisation reference",
|
||||
),
|
||||
source_date: t("Data da fonte", "Source date"),
|
||||
valid_until: t("Válida até", "Valid until"),
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<input
|
||||
required
|
||||
type={
|
||||
["source_date", "valid_until"].includes(key)
|
||||
? "date"
|
||||
: key === "source_url"
|
||||
? "url"
|
||||
: "text"
|
||||
}
|
||||
className={control}
|
||||
value={source.data[key]}
|
||||
onChange={(e) => source.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label={t("Idioma da fonte", "Source language")}>
|
||||
<select
|
||||
className={control}
|
||||
value={source.data.language}
|
||||
onChange={(e) => source.setData("language", e.target.value)}
|
||||
>
|
||||
<option value="pt">Português</option>
|
||||
<option value="en">English</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label={t("Natureza declarada", "Declared nature")}>
|
||||
<select
|
||||
className={control}
|
||||
value={source.data.nature}
|
||||
onChange={(e) => source.setData("nature", e.target.value)}
|
||||
>
|
||||
{["pending", "official", "historical", "illustrative"].map((n) => (
|
||||
<option key={n} value={n}>
|
||||
{language === "pt" ? states[n] : n}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<label className="flex items-start gap-2">
|
||||
<input
|
||||
required
|
||||
type="checkbox"
|
||||
checked={source.data.authorised}
|
||||
onChange={(e) => source.setData("authorised", e.target.checked)}
|
||||
/>
|
||||
{t(
|
||||
"Confirmo autorização para consulta interna e ausência de dados confidenciais ou pessoais desnecessários.",
|
||||
"I confirm authorisation for internal use and the absence of confidential or unnecessary personal data.",
|
||||
)}
|
||||
</label>
|
||||
<div>
|
||||
{Object.entries(source.errors).map(([k, v]) => (
|
||||
<p role="alert" key={k}>
|
||||
{v}
|
||||
</p>
|
||||
))}
|
||||
<button
|
||||
disabled={source.processing || documents.length === 0}
|
||||
className={button}
|
||||
>
|
||||
{t("Submeter fonte", "Submit source")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
export const capabilities: Record<string, [string, string]> = {
|
||||
assistant: ["Assistente com fontes", "Evidence assistant"],
|
||||
search: ["Pesquisa documental", "Document search"],
|
||||
recommend: ["Correspondência de oportunidades", "Opportunity matching"],
|
||||
classify: ["Triagem de pedidos", "Interest triage"],
|
||||
quality: ["Qualidade dos dados", "Data quality"],
|
||||
sla: ["Prazos e tarefas", "Deadlines and tasks"],
|
||||
summary: ["Excertos de documentos", "Document excerpts"],
|
||||
};
|
||||
export const purposes: Record<string, string> = {
|
||||
classify: "interest_triage",
|
||||
quality: "data_quality",
|
||||
sla: "execution_monitoring",
|
||||
};
|
||||
export const states: Record<string, string> = {
|
||||
pending: "Pendente",
|
||||
approved: "Autorizada para consulta interna",
|
||||
revoked: "Revogada",
|
||||
accepted: "Aceite na revisão interna",
|
||||
rejected: "Rejeitado",
|
||||
official: "Oficial — natureza declarada da fonte",
|
||||
historical: "Histórica",
|
||||
illustrative: "Ilustrativa",
|
||||
};
|
||||
@@ -0,0 +1,279 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, control, button } from "../management/shared";
|
||||
import { capabilities, states } from "./labels";
|
||||
type Item = {
|
||||
[key: string]: unknown;
|
||||
content?: string;
|
||||
title?: string;
|
||||
source_url?: string;
|
||||
source_date?: string;
|
||||
nature?: string;
|
||||
record_id?: string | number;
|
||||
rule?: string;
|
||||
score?: number;
|
||||
score_max?: number;
|
||||
favourable_factors?: string[];
|
||||
missing_data?: string[];
|
||||
};
|
||||
type Result = {
|
||||
items: Item[];
|
||||
mode: string;
|
||||
language: string;
|
||||
computed_at: string;
|
||||
status: string;
|
||||
};
|
||||
type Props = {
|
||||
run: {
|
||||
id: string;
|
||||
capability: string;
|
||||
mode: string;
|
||||
rules_version: string;
|
||||
prompt_version: string;
|
||||
latency_ms: number;
|
||||
version_no: number;
|
||||
review_status: string;
|
||||
};
|
||||
result: Result | null;
|
||||
unavailable: boolean;
|
||||
};
|
||||
const safeLink = (value: string) => /^https:\/\//i.test(value) || /^\/(?!\/)/.test(value);
|
||||
export default function ResultPage({ run, result, unavailable }: Props) {
|
||||
const en = result?.language === "en";
|
||||
const t = (pt: string, english: string) => (en ? english : pt);
|
||||
const feedback = useForm({ rating: "helpful", review_requested: true });
|
||||
const review = useForm({ status: "accepted", version_no: run.version_no });
|
||||
return (
|
||||
<Management
|
||||
title={
|
||||
capabilities[run.capability]?.[en ? 1 : 0] ??
|
||||
t("Resultado assistivo", "Assistive result")
|
||||
}
|
||||
>
|
||||
<Link className="underline" href="/management/ai">
|
||||
{t("Voltar às consultas e fontes", "Back to assistance and sources")}
|
||||
</Link>
|
||||
<p>
|
||||
{t(
|
||||
"Resultado assistivo, sujeito a revisão. Não constitui decisão oficial ou garantia de retorno ou aprovação.",
|
||||
"Assistive result requiring review. Not an official decision or a guarantee of return or approval.",
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{t(
|
||||
"Confiança não calibrada. Não foram produzidas previsões ou afirmações por um modelo generativo.",
|
||||
"Confidence is not calibrated. No forecasts or claims were generated by a generative model.",
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{t("Estado da revisão", "Review status")}:{" "}
|
||||
{en ? run.review_status : states[run.review_status]}
|
||||
</p>
|
||||
{unavailable ? (
|
||||
<p role="alert">
|
||||
{t(
|
||||
"Conteúdo indisponível: capacidade suspensa, fonte alterada, expirada, revogada ou sem consentimento vigente.",
|
||||
"Content unavailable: suspended capability, changed, expired or revoked source, or withdrawn consent.",
|
||||
)}
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
{result?.items.length === 0 && (
|
||||
<p className="rounded border p-4">
|
||||
{t(
|
||||
"Não há evidência ou correspondências suficientes nesta consulta. Não é possível formular uma conclusão. Pode solicitar revisão humana abaixo.",
|
||||
"No sufficient evidence or matches for this query. A conclusion cannot be provided. You may request human review below.",
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{run.mode === "extractive_preview" && (
|
||||
<p>
|
||||
{t(
|
||||
"Pré-visualização dos primeiros excertos; não é um resumo completo do documento.",
|
||||
"Preview of the first excerpts; not a complete document summary.",
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{result?.items.map((item, index) => (
|
||||
<article className="space-y-3 rounded border p-4" key={index}>
|
||||
<h2 className="text-lg font-semibold">
|
||||
{item.title ??
|
||||
item.rule?.replaceAll("_", " ") ??
|
||||
`${t("Resultado", "Result")} ${index + 1}`}
|
||||
</h2>
|
||||
{item.content && (
|
||||
<blockquote className="whitespace-pre-wrap border-l-4 pl-4">
|
||||
{item.content}
|
||||
</blockquote>
|
||||
)}
|
||||
{item.source_url && safeLink(item.source_url) && (
|
||||
<a className="underline" href={item.source_url} rel="noreferrer">
|
||||
{t(
|
||||
"Consultar fonte / registo original",
|
||||
"View source / original record",
|
||||
)}
|
||||
</a>
|
||||
)}
|
||||
{item.source_date && (
|
||||
<p>
|
||||
{t("Data da fonte", "Source date")}: {item.source_date}
|
||||
</p>
|
||||
)}
|
||||
{item.nature && (
|
||||
<p>
|
||||
{t("Natureza declarada", "Declared nature")}:{" "}
|
||||
{en ? item.nature : states[item.nature]}
|
||||
</p>
|
||||
)}
|
||||
{item.score !== undefined && (
|
||||
<p>
|
||||
{t(
|
||||
"Filtros declarados correspondentes",
|
||||
"Matching declared filters",
|
||||
)}
|
||||
: {item.score}/{item.score_max}.{" "}
|
||||
{t(
|
||||
"Esta pontuação não mede rentabilidade ou probabilidade de aprovação.",
|
||||
"This score does not measure profitability or likelihood of approval.",
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{item.favourable_factors && (
|
||||
<p>
|
||||
{t("Factores correspondentes", "Matching factors")}:{" "}
|
||||
{item.favourable_factors.join(", ")}
|
||||
</p>
|
||||
)}
|
||||
{item.missing_data && (
|
||||
<p>
|
||||
{t("Dados ainda necessários", "Missing information")}:{" "}
|
||||
{item.missing_data.join(", ")}
|
||||
</p>
|
||||
)}
|
||||
{!item.content && (
|
||||
<dl className="grid gap-2 md:grid-cols-2">
|
||||
{Object.entries(item)
|
||||
.filter(
|
||||
([key]) =>
|
||||
![
|
||||
"title",
|
||||
"source_url",
|
||||
"source_date",
|
||||
"score",
|
||||
"score_max",
|
||||
"score_meaning",
|
||||
"favourable_factors",
|
||||
"missing_data",
|
||||
"semantic_similarity",
|
||||
].includes(key),
|
||||
)
|
||||
.map(([key, value]) => (
|
||||
<div key={key}>
|
||||
<dt className="font-medium">
|
||||
{key.replaceAll("_", " ")}
|
||||
</dt>
|
||||
<dd>
|
||||
{Array.isArray(value)
|
||||
? value.join(", ")
|
||||
: value === null
|
||||
? t("Não determinado", "Undetermined")
|
||||
: String(value)}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
</article>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
<p>
|
||||
{t("Regras", "Rules")}: {run.rules_version} · {t("Calculado em", "Computed at")}:{" "}
|
||||
{result?.computed_at ?? "—"} · {run.latency_ms} ms
|
||||
</p>
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
feedback.post(`/management/ai/runs/${run.id}/feedback`);
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Feedback e atendimento humano", "Feedback and human review")}
|
||||
</h2>
|
||||
<Field label={t("Avaliação", "Rating")}>
|
||||
<select
|
||||
className={control}
|
||||
value={feedback.data.rating}
|
||||
onChange={(e) => feedback.setData("rating", e.target.value)}
|
||||
>
|
||||
<option value="helpful">{t("Útil", "Helpful")}</option>
|
||||
<option value="unhelpful">{t("Pouco útil", "Unhelpful")}</option>
|
||||
<option value="unsafe">
|
||||
{t(
|
||||
"Risco detectado — suspender capacidade",
|
||||
"Risk detected — suspend capability",
|
||||
)}
|
||||
</option>
|
||||
</select>
|
||||
</Field>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={feedback.data.review_requested}
|
||||
onChange={(e) => feedback.setData("review_requested", e.target.checked)}
|
||||
/>
|
||||
{t(
|
||||
"Solicitar revisão por uma pessoa autorizada",
|
||||
"Request review by an authorised person",
|
||||
)}
|
||||
</label>
|
||||
{Object.entries(feedback.errors).map(([k, v]) => (
|
||||
<p role="alert" key={k}>
|
||||
{v}
|
||||
</p>
|
||||
))}
|
||||
<button disabled={feedback.processing} className={button}>
|
||||
{t("Enviar feedback", "Submit feedback")}
|
||||
</button>
|
||||
</form>
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
review.transform((data) => ({ ...data, version_no: run.version_no }));
|
||||
review.post(`/management/ai/runs/${run.id}/review`);
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Revisão independente", "Independent review")}
|
||||
</h2>
|
||||
<p>
|
||||
{t(
|
||||
"Uma pessoa diferente deve rever o resultado. Aceitar não altera registos oficiais nem envia conteúdo ao CRM.",
|
||||
"A different person must review the result. Acceptance does not change official records or send content to CRM.",
|
||||
)}
|
||||
</p>
|
||||
<Field label={t("Parecer interno", "Internal review")}>
|
||||
<select
|
||||
className={control}
|
||||
value={review.data.status}
|
||||
onChange={(e) => review.setData("status", e.target.value)}
|
||||
>
|
||||
<option value="accepted">
|
||||
{t("Aceitar para análise interna", "Accept for internal analysis")}
|
||||
</option>
|
||||
<option value="rejected">{t("Rejeitar", "Reject")}</option>
|
||||
</select>
|
||||
</Field>
|
||||
{Object.entries(review.errors).map(([k, v]) => (
|
||||
<p role="alert" key={k}>
|
||||
{v}
|
||||
</p>
|
||||
))}
|
||||
<button disabled={review.processing} className={button}>
|
||||
{t("Registar revisão", "Record review")}
|
||||
</button>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { store } from '@/routes/password/confirm';
|
||||
/* @chisel-passkeys */
|
||||
import {
|
||||
index as confirmOptions,
|
||||
store as confirmStore,
|
||||
} from '@/actions/Laravel/Passkeys/Http/Controllers/PasskeyConfirmationController';
|
||||
import PasskeyVerify from '@/components/passkey-verify';
|
||||
/* @end-chisel-passkeys */
|
||||
|
||||
export default function ConfirmPassword() {
|
||||
return (
|
||||
<>
|
||||
<Head title="Confirm password" />
|
||||
|
||||
{/* @chisel-passkeys */}
|
||||
<PasskeyVerify
|
||||
routes={{
|
||||
options: confirmOptions(),
|
||||
submit: confirmStore(),
|
||||
}}
|
||||
label="Confirm with passkey"
|
||||
loadingLabel="Confirming..."
|
||||
separator="Or confirm with password"
|
||||
/>
|
||||
{/* @end-chisel-passkeys */}
|
||||
|
||||
<Form {...store.form()} resetOnSuccess={['password']}>
|
||||
{({ processing, errors }) => (
|
||||
<div className="space-y-6">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
autoComplete="current-password"
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div className="flex items-center">
|
||||
<Button
|
||||
className="w-full"
|
||||
disabled={processing}
|
||||
data-test="confirm-password-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Confirm password
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
ConfirmPassword.layout = {
|
||||
title: 'Confirm password',
|
||||
description:
|
||||
'This is a secure area of the application. Please confirm your password before continuing.',
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
// Components
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import { LoaderCircle } from 'lucide-react';
|
||||
import InputError from '@/components/input-error';
|
||||
import TextLink from '@/components/text-link';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { login } from '@/routes';
|
||||
import { email } from '@/routes/password';
|
||||
|
||||
export default function ForgotPassword({ status }: { status?: string }) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Forgot password" />
|
||||
|
||||
{status && (
|
||||
<div className="mb-4 text-center text-sm font-medium text-green-600">
|
||||
{status}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-6">
|
||||
<Form {...email.form()}>
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
autoComplete="off"
|
||||
autoFocus
|
||||
placeholder="email@example.com"
|
||||
/>
|
||||
|
||||
<InputError message={errors.email} />
|
||||
</div>
|
||||
|
||||
<div className="my-6 flex items-center justify-start">
|
||||
<Button
|
||||
className="w-full"
|
||||
disabled={processing}
|
||||
data-test="email-password-reset-link-button"
|
||||
>
|
||||
{processing && (
|
||||
<LoaderCircle className="h-4 w-4 animate-spin" />
|
||||
)}
|
||||
Email password reset link
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
|
||||
<div className="text-muted-foreground space-x-1 text-center text-sm">
|
||||
<span>Or, return to</span>
|
||||
<TextLink href={login()}>log in</TextLink>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
ForgotPassword.layout = {
|
||||
title: 'Forgot password',
|
||||
description: 'Enter your email to receive a password reset link',
|
||||
};
|
||||
@@ -0,0 +1,125 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import TextLink from '@/components/text-link';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
/* @chisel-registration */
|
||||
import { register } from '@/routes';
|
||||
/* @end-chisel-registration */
|
||||
import { store } from '@/routes/login';
|
||||
import { request } from '@/routes/password';
|
||||
/* @chisel-passkeys */
|
||||
import PasskeyVerify from '@/components/passkey-verify';
|
||||
/* @end-chisel-passkeys */
|
||||
|
||||
type Props = {
|
||||
status?: string;
|
||||
canResetPassword: boolean;
|
||||
};
|
||||
|
||||
export default function Login({ status, canResetPassword }: Props) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Log in" />
|
||||
|
||||
{/* @chisel-passkeys */}
|
||||
<PasskeyVerify />
|
||||
{/* @end-chisel-passkeys */}
|
||||
|
||||
<Form
|
||||
{...store.form()}
|
||||
resetOnSuccess={['password']}
|
||||
className="flex flex-col gap-6"
|
||||
>
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
required
|
||||
autoFocus
|
||||
tabIndex={1}
|
||||
autoComplete="email"
|
||||
placeholder="email@example.com"
|
||||
/>
|
||||
<InputError message={errors.email} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
{canResetPassword && (
|
||||
<TextLink
|
||||
href={request()}
|
||||
className="ml-auto text-sm"
|
||||
tabIndex={5}
|
||||
>
|
||||
Forgot your password?
|
||||
</TextLink>
|
||||
)}
|
||||
</div>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
required
|
||||
tabIndex={2}
|
||||
autoComplete="current-password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div className="flex items-center space-x-3">
|
||||
<Checkbox
|
||||
id="remember"
|
||||
name="remember"
|
||||
tabIndex={3}
|
||||
/>
|
||||
<Label htmlFor="remember">Remember me</Label>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="mt-4 w-full"
|
||||
tabIndex={4}
|
||||
disabled={processing}
|
||||
data-test="login-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Log in
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* @chisel-registration */}
|
||||
<div className="text-muted-foreground text-center text-sm">
|
||||
Don't have an account?{' '}
|
||||
<TextLink href={register()} tabIndex={5}>
|
||||
Sign up
|
||||
</TextLink>
|
||||
</div>
|
||||
{/* @end-chisel-registration */}
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
|
||||
{status && (
|
||||
<div className="mb-4 text-center text-sm font-medium text-green-600">
|
||||
{status}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Login.layout = {
|
||||
title: 'Log in to your account',
|
||||
description: 'Enter your email and password below to log in',
|
||||
};
|
||||
@@ -0,0 +1,120 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import TextLink from '@/components/text-link';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { login } from '@/routes';
|
||||
import { store } from '@/routes/register';
|
||||
|
||||
type Props = {
|
||||
passwordRules: string;
|
||||
};
|
||||
|
||||
export default function Register({ passwordRules }: Props) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Register" />
|
||||
<Form
|
||||
{...store.form()}
|
||||
resetOnSuccess={['password', 'password_confirmation']}
|
||||
disableWhileProcessing
|
||||
className="flex flex-col gap-6"
|
||||
>
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Input
|
||||
id="name"
|
||||
type="text"
|
||||
required
|
||||
autoFocus
|
||||
tabIndex={1}
|
||||
autoComplete="name"
|
||||
name="name"
|
||||
placeholder="Full name"
|
||||
/>
|
||||
<InputError
|
||||
message={errors.name}
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
required
|
||||
tabIndex={2}
|
||||
autoComplete="email"
|
||||
name="email"
|
||||
placeholder="email@example.com"
|
||||
/>
|
||||
<InputError message={errors.email} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
required
|
||||
tabIndex={3}
|
||||
autoComplete="new-password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password_confirmation">
|
||||
Confirm password
|
||||
</Label>
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
required
|
||||
tabIndex={4}
|
||||
autoComplete="new-password"
|
||||
name="password_confirmation"
|
||||
placeholder="Confirm password"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError
|
||||
message={errors.password_confirmation}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="mt-2 w-full"
|
||||
tabIndex={5}
|
||||
data-test="register-user-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Create account
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="text-muted-foreground text-center text-sm">
|
||||
Already have an account?{' '}
|
||||
<TextLink href={login()} tabIndex={6}>
|
||||
Log in
|
||||
</TextLink>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Register.layout = {
|
||||
title: 'Create an account',
|
||||
description: 'Enter your details below to create your account',
|
||||
};
|
||||
@@ -0,0 +1,96 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { update } from '@/routes/password';
|
||||
|
||||
type Props = {
|
||||
token: string;
|
||||
email: string;
|
||||
passwordRules: string;
|
||||
};
|
||||
|
||||
export default function ResetPassword({ token, email, passwordRules }: Props) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Reset password" />
|
||||
|
||||
<Form
|
||||
{...update.form()}
|
||||
transform={(data) => ({ ...data, token, email })}
|
||||
resetOnSuccess={['password', 'password_confirmation']}
|
||||
>
|
||||
{({ processing, errors }) => (
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
autoComplete="email"
|
||||
value={email}
|
||||
className="mt-1 block w-full"
|
||||
readOnly
|
||||
/>
|
||||
<InputError
|
||||
message={errors.email}
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
autoComplete="new-password"
|
||||
className="mt-1 block w-full"
|
||||
autoFocus
|
||||
placeholder="Password"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password_confirmation">
|
||||
Confirm password
|
||||
</Label>
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
name="password_confirmation"
|
||||
autoComplete="new-password"
|
||||
className="mt-1 block w-full"
|
||||
placeholder="Confirm password"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError
|
||||
message={errors.password_confirmation}
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="mt-4 w-full"
|
||||
disabled={processing}
|
||||
data-test="reset-password-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Reset password
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
ResetPassword.layout = {
|
||||
title: 'Reset password',
|
||||
description: 'Please enter your new password below',
|
||||
};
|
||||
@@ -0,0 +1,133 @@
|
||||
import { Form, Head, setLayoutProps } from '@inertiajs/react';
|
||||
import { REGEXP_ONLY_DIGITS } from 'input-otp';
|
||||
import { useMemo, useState } from 'react';
|
||||
import InputError from '@/components/input-error';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import {
|
||||
InputOTP,
|
||||
InputOTPGroup,
|
||||
InputOTPSlot,
|
||||
} from '@/components/ui/input-otp';
|
||||
import { OTP_MAX_LENGTH } from '@/hooks/use-two-factor-auth';
|
||||
import { store } from '@/routes/two-factor/login';
|
||||
|
||||
export default function TwoFactorChallenge() {
|
||||
const [showRecoveryInput, setShowRecoveryInput] = useState<boolean>(false);
|
||||
const [code, setCode] = useState<string>('');
|
||||
|
||||
const authConfigContent = useMemo<{
|
||||
title: string;
|
||||
description: string;
|
||||
toggleText: string;
|
||||
}>(() => {
|
||||
if (showRecoveryInput) {
|
||||
return {
|
||||
title: 'Recovery code',
|
||||
description:
|
||||
'Please confirm access to your account by entering one of your emergency recovery codes.',
|
||||
toggleText: 'login using an authentication code',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: 'Authentication code',
|
||||
description:
|
||||
'Enter the authentication code provided by your authenticator application.',
|
||||
toggleText: 'login using a recovery code',
|
||||
};
|
||||
}, [showRecoveryInput]);
|
||||
|
||||
setLayoutProps({
|
||||
title: authConfigContent.title,
|
||||
description: authConfigContent.description,
|
||||
});
|
||||
|
||||
const toggleRecoveryMode = (clearErrors: () => void): void => {
|
||||
setShowRecoveryInput(!showRecoveryInput);
|
||||
clearErrors();
|
||||
setCode('');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Two-factor authentication" />
|
||||
|
||||
<div className="space-y-6">
|
||||
<Form
|
||||
{...store.form()}
|
||||
className="space-y-4"
|
||||
resetOnError
|
||||
resetOnSuccess={!showRecoveryInput}
|
||||
>
|
||||
{({ errors, processing, clearErrors }) => (
|
||||
<>
|
||||
{showRecoveryInput ? (
|
||||
<>
|
||||
<Input
|
||||
name="recovery_code"
|
||||
type="text"
|
||||
placeholder="Enter recovery code"
|
||||
autoFocus={showRecoveryInput}
|
||||
required
|
||||
/>
|
||||
<InputError
|
||||
message={errors.recovery_code}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center space-y-3 text-center">
|
||||
<div className="flex w-full items-center justify-center">
|
||||
<InputOTP
|
||||
name="code"
|
||||
maxLength={OTP_MAX_LENGTH}
|
||||
value={code}
|
||||
onChange={(value) => setCode(value)}
|
||||
disabled={processing}
|
||||
pattern={REGEXP_ONLY_DIGITS}
|
||||
autoFocus
|
||||
>
|
||||
<InputOTPGroup>
|
||||
{Array.from(
|
||||
{ length: OTP_MAX_LENGTH },
|
||||
(_, index) => (
|
||||
<InputOTPSlot
|
||||
key={index}
|
||||
index={index}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</InputOTPGroup>
|
||||
</InputOTP>
|
||||
</div>
|
||||
<InputError message={errors.code} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full"
|
||||
disabled={processing}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
|
||||
<div className="text-muted-foreground text-center text-sm">
|
||||
<span>or you can </span>
|
||||
<button
|
||||
type="button"
|
||||
className="text-foreground cursor-pointer underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500"
|
||||
onClick={() =>
|
||||
toggleRecoveryMode(clearErrors)
|
||||
}
|
||||
>
|
||||
{authConfigContent.toggleText}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Components
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import TextLink from '@/components/text-link';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { logout } from '@/routes';
|
||||
import { send } from '@/routes/verification';
|
||||
|
||||
export default function VerifyEmail({ status }: { status?: string }) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Email verification" />
|
||||
|
||||
{status === 'verification-link-sent' && (
|
||||
<div className="mb-4 text-center text-sm font-medium text-green-600">
|
||||
A new verification link has been sent to the email address
|
||||
you provided during registration.
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Form {...send.form()} className="space-y-6 text-center">
|
||||
{({ processing }) => (
|
||||
<>
|
||||
<Button disabled={processing} variant="secondary">
|
||||
{processing && <Spinner />}
|
||||
Resend verification email
|
||||
</Button>
|
||||
|
||||
<TextLink
|
||||
href={logout()}
|
||||
className="mx-auto block text-sm"
|
||||
>
|
||||
Log out
|
||||
</TextLink>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
VerifyEmail.layout = {
|
||||
title: 'Email verification',
|
||||
description:
|
||||
'Please verify your email address by clicking on the link we just emailed to you.',
|
||||
};
|
||||
@@ -0,0 +1,183 @@
|
||||
import { useForm } from '@inertiajs/react';
|
||||
import { Management, Field, button, control } from '../management/shared';
|
||||
import type { Owner } from './types';
|
||||
|
||||
export default function Convert({
|
||||
interest,
|
||||
investors,
|
||||
owners,
|
||||
journeyInvestorId,
|
||||
}: {
|
||||
interest: {
|
||||
id: number;
|
||||
reference: string;
|
||||
full_name: string;
|
||||
sector_interest: string;
|
||||
};
|
||||
investors: { id: string; legal_name: string }[];
|
||||
owners: Owner[];
|
||||
journeyInvestorId?: string | null;
|
||||
}) {
|
||||
const form = useForm({
|
||||
investor_id: journeyInvestorId ?? '',
|
||||
legal_name: '',
|
||||
investor_type: '',
|
||||
owner_user_id: '',
|
||||
title: `${interest.reference} — ${interest.sector_interest}`,
|
||||
next_action: '',
|
||||
due_at: '',
|
||||
});
|
||||
return (
|
||||
<Management title="Converter pedido em lead">
|
||||
{journeyInvestorId && (
|
||||
<p>
|
||||
O investidor da jornada original está seleccionado. A
|
||||
conversão preserva essa identidade.
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
{interest.reference} · Contacto: {interest.full_name}
|
||||
</p>
|
||||
<p>
|
||||
Seleccione um investidor existente ou identifique explicitamente
|
||||
o novo investidor. O nome do contacto não é assumido como
|
||||
denominação de uma empresa.
|
||||
</p>
|
||||
<form
|
||||
className="max-w-2xl space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
due_at: data.due_at
|
||||
? new Date(data.due_at).toISOString()
|
||||
: '',
|
||||
}));
|
||||
form.post(`/management/crm/convert/${interest.id}`);
|
||||
}}
|
||||
>
|
||||
<fieldset disabled={form.processing} className="space-y-4">
|
||||
<Field
|
||||
label="Investidor existente"
|
||||
error={form.errors.investor_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.investor_id}
|
||||
onChange={(e) =>
|
||||
form.setData('investor_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Criar novo investidor</option>
|
||||
{investors.map((investor) => (
|
||||
<option key={investor.id} value={investor.id}>
|
||||
{investor.legal_name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{!form.data.investor_id && (
|
||||
<>
|
||||
<Field
|
||||
label="Nome legal do investidor"
|
||||
error={form.errors.legal_name}
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.legal_name}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'legal_name',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Tipo de investidor"
|
||||
error={form.errors.investor_type}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.investor_type}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'investor_type',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
<option value="domestic">Nacional</option>
|
||||
<option value="foreign">Estrangeiro</option>
|
||||
<option value="institutional">
|
||||
Institucional
|
||||
</option>
|
||||
<option value="individual">
|
||||
Individual
|
||||
</option>
|
||||
</select>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
<Field
|
||||
label="Responsável"
|
||||
error={form.errors.owner_user_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.owner_user_id}
|
||||
onChange={(e) =>
|
||||
form.setData('owner_user_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{owners.map((owner) => (
|
||||
<option key={owner.id} value={owner.id}>
|
||||
{owner.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Título do lead" error={form.errors.title}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.title}
|
||||
onChange={(e) =>
|
||||
form.setData('title', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Próxima acção"
|
||||
error={form.errors.next_action}
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.next_action}
|
||||
onChange={(e) =>
|
||||
form.setData('next_action', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Prazo (hora local)"
|
||||
error={form.errors.due_at}
|
||||
>
|
||||
<input
|
||||
type="datetime-local"
|
||||
className={control}
|
||||
value={form.data.due_at}
|
||||
onChange={(e) =>
|
||||
form.setData('due_at', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
{form.processing ? 'A converter…' : 'Converter em lead'}
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Field, control, button } from '../management/shared';
|
||||
import { leadStates } from './types';
|
||||
|
||||
type Contact = {
|
||||
id: string;
|
||||
full_name: string;
|
||||
email: string | null;
|
||||
phone: string | null;
|
||||
};
|
||||
function ContactForm({
|
||||
contact,
|
||||
investorId,
|
||||
}: {
|
||||
contact: Contact;
|
||||
investorId: string;
|
||||
}) {
|
||||
const form = useForm({
|
||||
full_name: contact.full_name,
|
||||
email: contact.email ?? '',
|
||||
phone: contact.phone ?? '',
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.patch(
|
||||
`/management/crm/investors/${investorId}/contacts/${contact.id}`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field label="Nome do contacto" error={form.errors.full_name}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.full_name}
|
||||
onChange={(e) => form.setData('full_name', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Email" error={form.errors.email}>
|
||||
<input
|
||||
className={control}
|
||||
type="email"
|
||||
value={form.data.email}
|
||||
onChange={(e) => form.setData('email', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Telefone" error={form.errors.phone}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.phone}
|
||||
onChange={(e) => form.setData('phone', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar contacto
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
export default function InvestorDetail({
|
||||
investor,
|
||||
contacts,
|
||||
leads,
|
||||
}: {
|
||||
investor: {
|
||||
id: string;
|
||||
legal_name: string;
|
||||
investor_type: string;
|
||||
status: string;
|
||||
};
|
||||
contacts: Contact[];
|
||||
leads: { id: string; title: string; status: string }[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
legal_name: investor.legal_name,
|
||||
investor_type: investor.investor_type,
|
||||
status: investor.status,
|
||||
});
|
||||
return (
|
||||
<Management title={investor.legal_name}>
|
||||
<form
|
||||
className="max-w-xl space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.patch(`/management/crm/investors/${investor.id}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Nome legal" error={form.errors.legal_name}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.legal_name}
|
||||
onChange={(e) =>
|
||||
form.setData('legal_name', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Tipo de investidor"
|
||||
error={form.errors.investor_type}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.investor_type}
|
||||
onChange={(e) =>
|
||||
form.setData('investor_type', e.target.value)
|
||||
}
|
||||
>
|
||||
{Object.entries({
|
||||
domestic: 'Nacional',
|
||||
foreign: 'Estrangeiro',
|
||||
institutional: 'Institucional',
|
||||
individual: 'Individual',
|
||||
}).map(([key, label]) => (
|
||||
<option key={key} value={key}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Estado" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
{Object.entries({
|
||||
prospect: 'Potencial investidor',
|
||||
active: 'Activo',
|
||||
inactive: 'Inactivo',
|
||||
}).map(([key, label]) => (
|
||||
<option key={key} value={key}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar investidor
|
||||
</button>
|
||||
</form>
|
||||
<section className="max-w-xl space-y-4">
|
||||
<h2 className="text-lg font-semibold">Contactos</h2>
|
||||
<p>
|
||||
Um contacto pode representar vários investidores. Alterações
|
||||
ao contacto são partilhadas entre essas relações.
|
||||
</p>
|
||||
{contacts.map((contact) => (
|
||||
<ContactForm
|
||||
key={contact.id}
|
||||
contact={contact}
|
||||
investorId={investor.id}
|
||||
/>
|
||||
))}
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-lg font-semibold">Leads associados</h2>
|
||||
{leads.map((lead) => (
|
||||
<p key={lead.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/crm/leads/${lead.id}`}
|
||||
>
|
||||
{lead.title}
|
||||
</Link>{' '}
|
||||
· {leadStates[lead.status]}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Pagination, control, button } from '../management/shared';
|
||||
import type { Paginated } from '../management/shared';
|
||||
|
||||
export default function Investors({
|
||||
investors,
|
||||
filters,
|
||||
}: {
|
||||
investors: Paginated<{ id: string; legal_name: string; status: string }>;
|
||||
filters: { q?: string };
|
||||
}) {
|
||||
const form = useForm({ q: filters.q ?? '' });
|
||||
return (
|
||||
<Management title="CRM — Investidores">
|
||||
<form
|
||||
className="flex gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.get('/management/crm/investors', {
|
||||
preserveState: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<input
|
||||
aria-label="Pesquisar investidores"
|
||||
className={control}
|
||||
value={form.data.q}
|
||||
onChange={(e) => form.setData('q', e.target.value)}
|
||||
/>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Pesquisar
|
||||
</button>
|
||||
</form>
|
||||
<p>
|
||||
Os novos investidores são registados ao converter um pedido em
|
||||
lead, com revisão do contacto e da identidade.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
{investors.data.map((investor) => (
|
||||
<article key={investor.id} className="rounded border p-4">
|
||||
<Link
|
||||
className="font-semibold underline"
|
||||
href={`/management/crm/investors/${investor.id}`}
|
||||
>
|
||||
{investor.legal_name}
|
||||
</Link>
|
||||
<p>
|
||||
{{
|
||||
prospect: 'Potencial investidor',
|
||||
active: 'Activo',
|
||||
inactive: 'Inactivo',
|
||||
}[investor.status] ?? investor.status}
|
||||
</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!investors.data.length && <p>Nenhum investidor encontrado.</p>}
|
||||
<Pagination page={investors} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Field, button, control } from '../management/shared';
|
||||
import { leadStates, taskStates } from './types';
|
||||
import type { Lead, Owner, Task } from './types';
|
||||
|
||||
function TaskRow({ task, leadId }: { task: Task; leadId: string }) {
|
||||
const form = useForm({ status: task.status });
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.patch(`/management/crm/leads/${leadId}/tasks/${task.id}`);
|
||||
}}
|
||||
>
|
||||
<h3 className="font-semibold">{task.title}</h3>
|
||||
<p>
|
||||
{task.due_at
|
||||
? new Intl.DateTimeFormat('pt-MZ', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
timeZone: 'Africa/Maputo',
|
||||
}).format(new Date(task.due_at)) + ' (Maputo)'
|
||||
: 'Sem prazo'}{' '}
|
||||
· Responsável #{task.assignee_user_id}
|
||||
</p>
|
||||
<Field
|
||||
label={`Estado da tarefa: ${task.title}`}
|
||||
error={form.errors.status}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
{Object.entries(taskStates).map(([key, label]) => (
|
||||
<option key={key} value={key}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Actualizar tarefa
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
export default function LeadDetail({
|
||||
lead,
|
||||
contacts,
|
||||
owners,
|
||||
}: {
|
||||
lead: Lead;
|
||||
contacts: {
|
||||
id: string;
|
||||
full_name: string;
|
||||
email: string | null;
|
||||
phone: string | null;
|
||||
}[];
|
||||
owners: Owner[];
|
||||
}) {
|
||||
const review = useForm({
|
||||
status: lead.status,
|
||||
owner_user_id: String(lead.owner_user_id ?? ''),
|
||||
qualification_reason: '',
|
||||
});
|
||||
const task = useForm({
|
||||
title: '',
|
||||
due_at: '',
|
||||
assignee_user_id: String(lead.owner_user_id ?? ''),
|
||||
});
|
||||
return (
|
||||
<Management title={lead.title}>
|
||||
<Link className="underline" href="/management/crm/leads">
|
||||
Voltar aos leads
|
||||
</Link>
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{lead.investor && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/crm/investors/${lead.investor.id}`}
|
||||
>
|
||||
{lead.investor.legal_name}
|
||||
</Link>
|
||||
)}
|
||||
</h2>
|
||||
<p>
|
||||
{leadStates[lead.status]} ·{' '}
|
||||
{lead.owner?.name ?? 'Sem responsável'}
|
||||
</p>
|
||||
<p>Origem inicial: {lead.first_source ?? 'Não registada'}</p>
|
||||
{lead.interest_request_id && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/interests/${lead.interest_request_id}`}
|
||||
>
|
||||
Consultar pedido de origem
|
||||
</Link>
|
||||
)}
|
||||
<div className="space-y-2">
|
||||
{contacts.map((contact) => (
|
||||
<p key={contact.id}>
|
||||
{contact.full_name} · {contact.email ?? '—'} ·{' '}
|
||||
{contact.phone ?? '—'}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<form
|
||||
className="max-w-xl space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
review.patch(`/management/crm/leads/${lead.id}`);
|
||||
}}
|
||||
>
|
||||
<h2 className="text-lg font-semibold">
|
||||
Qualificação e atribuição
|
||||
</h2>
|
||||
<Field label="Estado do lead" error={review.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={review.data.status}
|
||||
onChange={(e) =>
|
||||
review.setData('status', e.target.value)
|
||||
}
|
||||
>
|
||||
{Object.entries(leadStates)
|
||||
.filter(([key]) => key !== 'converted')
|
||||
.map(([key, label]) => (
|
||||
<option key={key} value={key}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Responsável" error={review.errors.owner_user_id}>
|
||||
<select
|
||||
className={control}
|
||||
value={review.data.owner_user_id}
|
||||
onChange={(e) =>
|
||||
review.setData('owner_user_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{owners.map((owner) => (
|
||||
<option key={owner.id} value={owner.id}>
|
||||
{owner.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Fundamento da alteração"
|
||||
error={review.errors.qualification_reason}
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
value={review.data.qualification_reason}
|
||||
onChange={(e) =>
|
||||
review.setData(
|
||||
'qualification_reason',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{lead.qualification_reason && (
|
||||
<p className="text-sm whitespace-pre-wrap">
|
||||
Último fundamento: {lead.qualification_reason}
|
||||
</p>
|
||||
)}
|
||||
<button
|
||||
className={button}
|
||||
disabled={review.processing || lead.status === 'converted'}
|
||||
>
|
||||
Guardar lead
|
||||
</button>
|
||||
</form>
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-lg font-semibold">Tarefas</h2>
|
||||
{lead.tasks.map((item) => (
|
||||
<TaskRow key={item.id} task={item} leadId={lead.id} />
|
||||
))}
|
||||
{!lead.tasks.length && <p>Não existem tarefas.</p>}
|
||||
</section>
|
||||
<form
|
||||
className="max-w-xl space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
task.transform((data) => ({
|
||||
...data,
|
||||
due_at: data.due_at
|
||||
? new Date(data.due_at).toISOString()
|
||||
: '',
|
||||
}));
|
||||
task.post(`/management/crm/leads/${lead.id}/tasks`, {
|
||||
onSuccess: () => task.reset('title', 'due_at'),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h2 className="text-lg font-semibold">
|
||||
Registar próxima acção
|
||||
</h2>
|
||||
<Field label="Tarefa" error={task.errors.title}>
|
||||
<input
|
||||
className={control}
|
||||
value={task.data.title}
|
||||
onChange={(e) => task.setData('title', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Prazo (hora local)" error={task.errors.due_at}>
|
||||
<input
|
||||
type="datetime-local"
|
||||
className={control}
|
||||
value={task.data.due_at}
|
||||
onChange={(e) => task.setData('due_at', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Responsável pela tarefa"
|
||||
error={task.errors.assignee_user_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={task.data.assignee_user_id}
|
||||
onChange={(e) =>
|
||||
task.setData('assignee_user_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{owners.map((owner) => (
|
||||
<option key={owner.id} value={owner.id}>
|
||||
{owner.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={task.processing}>
|
||||
Criar tarefa
|
||||
</button>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Pagination, button, control } from '../management/shared';
|
||||
import type { Paginated } from '../management/shared';
|
||||
import { leadStates } from './types';
|
||||
import type { Lead, Owner } from './types';
|
||||
|
||||
export default function Leads({
|
||||
leads,
|
||||
filters,
|
||||
owners,
|
||||
}: {
|
||||
leads: Paginated<Lead>;
|
||||
filters: { q?: string; status?: string; owner_user_id?: number };
|
||||
owners: Owner[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
q: filters.q ?? '',
|
||||
status: filters.status ?? '',
|
||||
owner_user_id: String(filters.owner_user_id ?? ''),
|
||||
});
|
||||
return (
|
||||
<Management title="CRM — Leads">
|
||||
<p>
|
||||
Encaminhe uma manifestação de interesse para iniciar o
|
||||
acompanhamento comercial.
|
||||
</p>
|
||||
<Link className="underline" href="/management/interests">
|
||||
Consultar pedidos recebidos
|
||||
</Link>
|
||||
<form
|
||||
className="flex flex-wrap gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.get('/management/crm/leads', { preserveState: false });
|
||||
}}
|
||||
>
|
||||
<input
|
||||
aria-label="Pesquisar leads"
|
||||
placeholder="Título ou investidor"
|
||||
className={`${control} max-w-sm`}
|
||||
value={form.data.q}
|
||||
onChange={(e) => form.setData('q', e.target.value)}
|
||||
/>
|
||||
<select
|
||||
aria-label="Estado"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
<option value="">Todos os estados</option>
|
||||
{Object.entries(leadStates).map(([key, label]) => (
|
||||
<option key={key} value={key}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select
|
||||
aria-label="Responsável"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.owner_user_id}
|
||||
onChange={(e) =>
|
||||
form.setData('owner_user_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos os responsáveis</option>
|
||||
{owners.map((owner) => (
|
||||
<option key={owner.id} value={owner.id}>
|
||||
{owner.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Pesquisar
|
||||
</button>
|
||||
</form>
|
||||
<div className="space-y-3">
|
||||
{leads.data.map((lead) => (
|
||||
<article
|
||||
key={lead.id}
|
||||
className="space-y-2 rounded border p-4"
|
||||
>
|
||||
<Link
|
||||
className="font-semibold underline"
|
||||
href={`/management/crm/leads/${lead.id}`}
|
||||
>
|
||||
{lead.title}
|
||||
</Link>
|
||||
<p>
|
||||
{lead.investor?.legal_name ?? 'Sem investidor'} ·{' '}
|
||||
{leadStates[lead.status]}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
Responsável: {lead.owner?.name ?? 'Por atribuir'}
|
||||
{Boolean(lead.overdue_tasks_count) && (
|
||||
<span className="ml-3 text-red-600">
|
||||
{lead.overdue_tasks_count} tarefa(s) em
|
||||
atraso
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!leads.data.length && <p>Nenhum lead encontrado.</p>}
|
||||
<Pagination page={leads} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
export type Owner = { id: number; name: string };
|
||||
export type Task = {
|
||||
id: string;
|
||||
title: string;
|
||||
status: string;
|
||||
due_at: string | null;
|
||||
assignee_user_id: number | null;
|
||||
};
|
||||
export type Lead = {
|
||||
id: string;
|
||||
title: string;
|
||||
status: string;
|
||||
owner_user_id: number | null;
|
||||
investor: { id: string; legal_name: string } | null;
|
||||
owner: Owner | null;
|
||||
tasks: Task[];
|
||||
overdue_tasks_count?: number;
|
||||
first_source: string | null;
|
||||
last_source: string | null;
|
||||
qualification_reason: string | null;
|
||||
interest_request_id: number | null;
|
||||
};
|
||||
export const leadStates: Record<string, string> = {
|
||||
new: 'Novo',
|
||||
qualified: 'Qualificado',
|
||||
disqualified: 'Desqualificado',
|
||||
converted: 'Convertido',
|
||||
};
|
||||
export const taskStates: Record<string, string> = {
|
||||
open: 'Aberta',
|
||||
in_progress: 'Em curso',
|
||||
done: 'Concluída',
|
||||
cancelled: 'Cancelada',
|
||||
};
|
||||
@@ -0,0 +1,183 @@
|
||||
import { Head, Link } from '@inertiajs/react';
|
||||
import { dashboard } from '@/routes';
|
||||
|
||||
type Summary = {
|
||||
requestsByStatus: Record<string, number>;
|
||||
publishedOpportunities: number;
|
||||
draftOpportunities: number;
|
||||
activeSectors: number;
|
||||
recentRequests: {
|
||||
id: number;
|
||||
reference: string;
|
||||
sector_interest: string;
|
||||
status: string;
|
||||
created_at: string;
|
||||
}[];
|
||||
};
|
||||
const states: Record<string, string> = {
|
||||
received: 'Recebidos',
|
||||
in_review: 'Em análise',
|
||||
contacted: 'Contactados',
|
||||
closed: 'Encerrados',
|
||||
};
|
||||
const card =
|
||||
'rounded-xl border p-5 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary';
|
||||
|
||||
export default function Dashboard({ summary }: { summary: Summary | null }) {
|
||||
return (
|
||||
<main className="space-y-8 p-4 md:p-8">
|
||||
<Head title="Painel" />
|
||||
<h1 className="text-2xl font-semibold">Painel do portal</h1>
|
||||
{summary ? (
|
||||
<>
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Manifestações de interesse
|
||||
</h2>
|
||||
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
{Object.entries(states).map(([status, label]) => (
|
||||
<Link
|
||||
key={status}
|
||||
href={`/management/interests?status=${status}`}
|
||||
className={card}
|
||||
>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{label}
|
||||
</p>
|
||||
<p className="mt-2 text-3xl font-semibold">
|
||||
{summary.requestsByStatus[status] ?? 0}
|
||||
</p>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-lg font-semibold">Catálogo</h2>
|
||||
<div className="grid gap-4 sm:grid-cols-3">
|
||||
{[
|
||||
{
|
||||
label: 'Oportunidades publicadas',
|
||||
value: summary.publishedOpportunities,
|
||||
href: '/management/opportunities?status=published',
|
||||
},
|
||||
{
|
||||
label: 'Oportunidades em rascunho',
|
||||
value: summary.draftOpportunities,
|
||||
href: '/management/opportunities?status=draft',
|
||||
},
|
||||
{
|
||||
label: 'Sectores activos',
|
||||
value: summary.activeSectors,
|
||||
href: '/management/sectors?status=active',
|
||||
},
|
||||
].map((item) => (
|
||||
<Link
|
||||
key={item.label}
|
||||
href={item.href}
|
||||
className={card}
|
||||
>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{item.label}
|
||||
</p>
|
||||
<p className="mt-2 text-3xl font-semibold">
|
||||
{item.value}
|
||||
</p>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="space-y-4">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Pedidos mais recentes
|
||||
</h2>
|
||||
<Link
|
||||
href="/management/interests"
|
||||
className="underline"
|
||||
>
|
||||
Ver todos
|
||||
</Link>
|
||||
</div>
|
||||
{summary.recentRequests.length ? (
|
||||
<ul className="divide-y rounded-xl border">
|
||||
{summary.recentRequests.map((item) => (
|
||||
<li
|
||||
key={item.id}
|
||||
className="flex flex-wrap items-center justify-between gap-3 p-4"
|
||||
>
|
||||
<div className="min-w-0">
|
||||
<Link
|
||||
href={`/management/interests/${item.id}`}
|
||||
className="font-medium break-all underline"
|
||||
>
|
||||
{item.reference}
|
||||
</Link>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{item.sector_interest} ·{' '}
|
||||
{states[item.status] ??
|
||||
item.status}
|
||||
</p>
|
||||
</div>
|
||||
<time
|
||||
dateTime={item.created_at}
|
||||
className="text-muted-foreground text-sm"
|
||||
>
|
||||
{new Intl.DateTimeFormat('pt-MZ', {
|
||||
dateStyle: 'medium',
|
||||
timeZone: 'Africa/Maputo',
|
||||
}).format(
|
||||
new Date(item.created_at),
|
||||
)}
|
||||
</time>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="text-muted-foreground rounded-xl border p-6">
|
||||
Ainda não existem manifestações de interesse.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
<nav
|
||||
aria-label="Acções rápidas"
|
||||
className="flex flex-wrap gap-4"
|
||||
>
|
||||
<Link
|
||||
className="underline"
|
||||
href="/management/opportunities/create"
|
||||
>
|
||||
Criar oportunidade
|
||||
</Link>
|
||||
<Link
|
||||
className="underline"
|
||||
href="/management/sectors/create"
|
||||
>
|
||||
Criar sector
|
||||
</Link>
|
||||
</nav>
|
||||
</>
|
||||
) : (
|
||||
<section className="max-w-2xl space-y-4 rounded-xl border p-6">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Configure o acesso quando estiver pronto
|
||||
</h2>
|
||||
<p>
|
||||
A gestão está disponível para contas autorizadas. Pode
|
||||
consultar os passos de configuração ou continuar a
|
||||
explorar as oportunidades públicas.
|
||||
</p>
|
||||
<Link
|
||||
href="/acesso-gestao"
|
||||
className="bg-primary text-primary-foreground inline-block rounded-lg px-4 py-2"
|
||||
>
|
||||
Consultar o meu acesso
|
||||
</Link>
|
||||
</section>
|
||||
)}
|
||||
<Link href="/" className="inline-block underline">
|
||||
Voltar ao portal público
|
||||
</Link>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Dashboard.layout = { breadcrumbs: [{ title: 'Painel', href: dashboard() }] };
|
||||
@@ -0,0 +1,206 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, control, button } from "../management/shared";
|
||||
export default function Analysis({
|
||||
demand,
|
||||
candidates,
|
||||
eligible,
|
||||
gap,
|
||||
proposal,
|
||||
sectors,
|
||||
}: {
|
||||
demand: { id: string; version_no: number; quantity: number; qualification: string };
|
||||
candidates: {
|
||||
id: string;
|
||||
quantity: number;
|
||||
period_start: string;
|
||||
period_end: string;
|
||||
source: string;
|
||||
}[];
|
||||
eligible: boolean;
|
||||
gap: { state: string; people: number | null };
|
||||
proposal: {
|
||||
opportunity_id: number;
|
||||
demand_version: number;
|
||||
intervention: string;
|
||||
equipment_needs: string | null;
|
||||
trainer_needs: string | null;
|
||||
funding_plan: string | null;
|
||||
risks: string;
|
||||
source: string;
|
||||
} | null;
|
||||
sectors: { id: number; name: string }[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
demand_version: demand.version_no,
|
||||
sector_id: "",
|
||||
title: "",
|
||||
intervention: "",
|
||||
equipment_needs: "",
|
||||
trainer_needs: "",
|
||||
funding_plan: "",
|
||||
risks: "",
|
||||
source: "",
|
||||
currency: "MZN",
|
||||
});
|
||||
return (
|
||||
<Management title="Análise assistida de competências">
|
||||
<p>
|
||||
Procura: {demand.quantity} trabalhadores · {demand.qualification}
|
||||
</p>
|
||||
<p className="rounded border p-4">
|
||||
{gap.state === "expired"
|
||||
? "Fonte expirada. Actualize a declaração antes de analisar."
|
||||
: !eligible
|
||||
? "A procura exige revisão independente antes da análise."
|
||||
: "Lacuna quantitativa não determinada: falta evidência de trabalhadores qualificados e disponíveis. Vagas em cursos não são trabalhadores disponíveis."}
|
||||
</p>
|
||||
<h2 className="text-xl font-semibold">Oferta potencialmente compatível</h2>
|
||||
<p>
|
||||
Critérios: mesma ocupação, competência principal, território e texto de
|
||||
qualificação; fonte vigente e revisão interna; conclusão até ao início da
|
||||
necessidade. Esta correspondência não comprova equivalência curricular, acreditação,
|
||||
conclusão ou contratação.
|
||||
</p>
|
||||
{candidates.map((c) => (
|
||||
<article className="rounded border p-4" key={c.id}>
|
||||
<p>
|
||||
{c.quantity} vagas · {c.period_start} a {c.period_end}
|
||||
</p>
|
||||
<p>Fonte: {c.source}</p>
|
||||
</article>
|
||||
))}
|
||||
{!candidates.length && (
|
||||
<p>
|
||||
Não há oferta que satisfaça estes critérios. Isto não prova ausência de
|
||||
instituições no território.
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
As capacidades não são somadas nem alocadas: podem partilhar formadores, instalações
|
||||
ou equipamentos.
|
||||
</p>
|
||||
<section className="space-y-4 rounded border p-4">
|
||||
<h2 className="text-xl font-semibold">Preparação do investimento educativo</h2>
|
||||
<p>
|
||||
A ficha permanece em rascunho até à validação institucional da lacuna e da
|
||||
resposta formativa. Não garante emprego ou financiamento.
|
||||
</p>
|
||||
{proposal ? (
|
||||
<>
|
||||
{proposal.demand_version !== demand.version_no && (
|
||||
<p role="alert">
|
||||
A procura foi alterada desde a criação da ficha. É necessária
|
||||
reconciliação.
|
||||
</p>
|
||||
)}
|
||||
<p>{proposal.intervention}</p>
|
||||
<p>
|
||||
Equipamentos: {proposal.equipment_needs || "Pendente de levantamento"}
|
||||
</p>
|
||||
<p>Formadores: {proposal.trainer_needs || "Pendente de levantamento"}</p>
|
||||
<p>Financiamento: {proposal.funding_plan || "Pendente de levantamento"}</p>
|
||||
<p>Riscos: {proposal.risks}</p>
|
||||
<p>Fonte: {proposal.source}</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/opportunities/${proposal.opportunity_id}/edit`}
|
||||
>
|
||||
Consultar rascunho no catálogo de oportunidades
|
||||
</Link>
|
||||
</>
|
||||
) : eligible ? (
|
||||
<form
|
||||
className="grid gap-4 md:grid-cols-2"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
demand_version: demand.version_no,
|
||||
}));
|
||||
form.post(`/management/education/demands/${demand.id}/investment`);
|
||||
}}
|
||||
>
|
||||
<Field label="Sector">
|
||||
<select
|
||||
required
|
||||
className={control}
|
||||
value={form.data.sector_id}
|
||||
onChange={(e) => form.setData("sector_id", e.target.value)}
|
||||
>
|
||||
<option value="">Seleccionar sector</option>
|
||||
{sectors.map((s) => (
|
||||
<option value={s.id} key={s.id}>
|
||||
{s.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Título">
|
||||
<input
|
||||
required
|
||||
maxLength={200}
|
||||
className={control}
|
||||
value={form.data.title}
|
||||
onChange={(e) => form.setData("title", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
"intervention",
|
||||
"equipment_needs",
|
||||
"trainer_needs",
|
||||
"funding_plan",
|
||||
"risks",
|
||||
"source",
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
intervention: "Resposta formativa proposta",
|
||||
equipment_needs: "Necessidades de equipamentos (opcional)",
|
||||
trainer_needs: "Necessidades de formadores (opcional)",
|
||||
funding_plan: "Financiamento e sustentabilidade (opcional)",
|
||||
risks: "Riscos e limitações",
|
||||
source: "Fonte e responsável pela proposta",
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<textarea
|
||||
required={["intervention", "risks", "source"].includes(key)}
|
||||
className={control}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Moeda de referência (montante ainda não estimado)">
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.currency}
|
||||
onChange={(e) => form.setData("currency", e.target.value)}
|
||||
>
|
||||
{["MZN", "USD", "EUR", "ZAR"].map((c) => (
|
||||
<option key={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<div>
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar ficha em rascunho
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<p>Reveja a procura e a validade da fonte antes de preparar a ficha.</p>
|
||||
)}
|
||||
</section>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, control, button, Pagination } from "../management/shared";
|
||||
import type { Paginated } from "../management/shared";
|
||||
type Option = { id: string; name?: string; title?: string; code?: string };
|
||||
type RecordRow = {
|
||||
id: string;
|
||||
qualification: string;
|
||||
quantity: number;
|
||||
status: string;
|
||||
version_no: number;
|
||||
valid_until: string;
|
||||
period_start: string;
|
||||
period_end: string;
|
||||
source: string;
|
||||
};
|
||||
type Props = {
|
||||
demands: Paginated<RecordRow>;
|
||||
capacities: Paginated<RecordRow>;
|
||||
skills: Option[];
|
||||
occupations: Option[];
|
||||
providers: Option[];
|
||||
courses: Option[];
|
||||
projects: Option[];
|
||||
territories: Option[];
|
||||
today: string;
|
||||
filters: { q?: string; status?: string; geo_location_id?: string };
|
||||
indicators: {
|
||||
demand_records: number;
|
||||
capacity_records: number;
|
||||
expired_demands: number;
|
||||
pending_demands: number;
|
||||
};
|
||||
};
|
||||
function Errors({ errors }: { errors: Record<string, string> }) {
|
||||
return (
|
||||
<>
|
||||
{Object.entries(errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
function Select({
|
||||
label,
|
||||
value,
|
||||
options,
|
||||
onChange,
|
||||
}: {
|
||||
label: string;
|
||||
value: string;
|
||||
options: Option[];
|
||||
onChange: (value: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<Field label={label}>
|
||||
<select
|
||||
className={control}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{options.map((o) => (
|
||||
<option key={o.id} value={o.id}>
|
||||
{o.code ? `${o.code} — ` : ""}
|
||||
{o.name ?? o.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
);
|
||||
}
|
||||
function Catalog({ kind, title, providers }: { kind: string; title: string; providers: Option[] }) {
|
||||
const form = useForm({ name: "", title: "", code: "", provider_id: "" });
|
||||
return (
|
||||
<details className="rounded border p-4">
|
||||
<summary className="cursor-pointer font-semibold">{title}</summary>
|
||||
<form
|
||||
className="mt-4 space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(`/management/education/catalog/${kind}`, {
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Field label="Designação">
|
||||
<input
|
||||
className={control}
|
||||
required
|
||||
value={kind === "courses" ? form.data.title : form.data.name}
|
||||
onChange={(e) =>
|
||||
form.setData(kind === "courses" ? "title" : "name", e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{kind !== "providers" && (
|
||||
<Field label="Código">
|
||||
<input
|
||||
className={control}
|
||||
required
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData("code", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{kind === "courses" && (
|
||||
<Select
|
||||
label="Instituição"
|
||||
value={form.data.provider_id}
|
||||
options={providers}
|
||||
onChange={(v) => form.setData("provider_id", v)}
|
||||
/>
|
||||
)}
|
||||
<Errors errors={form.errors} />
|
||||
<button className={button} disabled={form.processing}>
|
||||
Criar cadastro interno
|
||||
</button>
|
||||
</form>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props }) {
|
||||
const demand = kind === "demands";
|
||||
const form = useForm({
|
||||
project_id: "",
|
||||
course_id: "",
|
||||
occupation_id: "",
|
||||
skill_id: "",
|
||||
geo_location_id: "",
|
||||
employer: "",
|
||||
qualification: "",
|
||||
quantity: "",
|
||||
period_start: "",
|
||||
period_end: "",
|
||||
source: "",
|
||||
reference_date: props.today,
|
||||
valid_until: "",
|
||||
});
|
||||
return (
|
||||
<details className="rounded border p-4">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
{demand ? "Declarar procura de trabalhadores" : "Declarar vagas de formação"}
|
||||
</summary>
|
||||
<form
|
||||
className="mt-4 grid gap-4 md:grid-cols-2"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(`/management/education/${kind}`, {
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Select
|
||||
label={demand ? "Projecto" : "Curso"}
|
||||
options={demand ? props.projects : props.courses}
|
||||
value={demand ? form.data.project_id : form.data.course_id}
|
||||
onChange={(v) => form.setData(demand ? "project_id" : "course_id", v)}
|
||||
/>
|
||||
<Select
|
||||
label="Ocupação"
|
||||
options={props.occupations}
|
||||
value={form.data.occupation_id}
|
||||
onChange={(v) => form.setData("occupation_id", v)}
|
||||
/>
|
||||
<Select
|
||||
label="Competência principal"
|
||||
options={props.skills}
|
||||
value={form.data.skill_id}
|
||||
onChange={(v) => form.setData("skill_id", v)}
|
||||
/>
|
||||
<Select
|
||||
label="Território"
|
||||
options={props.territories}
|
||||
value={form.data.geo_location_id}
|
||||
onChange={(v) => form.setData("geo_location_id", v)}
|
||||
/>
|
||||
{demand && (
|
||||
<Field label="Empregador declarante">
|
||||
<input
|
||||
className={control}
|
||||
required
|
||||
value={form.data.employer}
|
||||
onChange={(e) => form.setData("employer", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
<Field label="Qualificação exigida / desenvolvida">
|
||||
<input
|
||||
className={control}
|
||||
required
|
||||
value={form.data.qualification}
|
||||
onChange={(e) => form.setData("qualification", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label={
|
||||
demand
|
||||
? "Trabalhadores necessários"
|
||||
: "Vagas disponíveis (não trabalhadores)"
|
||||
}
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
type="number"
|
||||
min="1"
|
||||
required
|
||||
value={form.data.quantity}
|
||||
onChange={(e) => form.setData("quantity", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
{(["period_start", "period_end", "reference_date", "valid_until"] as const).map(
|
||||
(key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
period_start: demand
|
||||
? "Início da necessidade"
|
||||
: "Início da formação",
|
||||
period_end: demand
|
||||
? "Fim da necessidade"
|
||||
: "Conclusão prevista",
|
||||
reference_date: "Data de referência da fonte",
|
||||
valid_until: "Fonte válida até",
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
type="date"
|
||||
required
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
),
|
||||
)}
|
||||
<Field label="Fonte, referência da evidência e responsável pelos dados">
|
||||
<textarea
|
||||
className={control}
|
||||
required
|
||||
minLength={10}
|
||||
value={form.data.source}
|
||||
onChange={(e) => form.setData("source", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<div>
|
||||
<Errors errors={form.errors} />
|
||||
<button className={button} disabled={form.processing}>
|
||||
Submeter para revisão
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
function Review({ row, kind, today }: { row: RecordRow; kind: string; today: string }) {
|
||||
const form = useForm({
|
||||
version_no: row.version_no,
|
||||
status: "reviewed",
|
||||
review_reason: "",
|
||||
});
|
||||
return (
|
||||
<article className="space-y-3 rounded border p-4">
|
||||
<p className="font-semibold">
|
||||
{row.qualification} · {row.quantity}{" "}
|
||||
{kind === "demands" ? "trabalhadores" : "vagas formativas"}
|
||||
</p>
|
||||
<p>
|
||||
{row.period_start} a {row.period_end} ·{" "}
|
||||
{row.valid_until < today
|
||||
? "Fonte expirada"
|
||||
: (
|
||||
{
|
||||
submitted: "Submetido",
|
||||
reviewed: "Revisto internamente",
|
||||
rejected: "Rejeitado",
|
||||
} as Record<string, string>
|
||||
)[row.status]}
|
||||
</p>
|
||||
<p className="break-words">Fonte: {row.source}</p>
|
||||
{kind === "demands" && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/education/demands/${row.id}/analysis`}
|
||||
>
|
||||
Analisar procura e oferta
|
||||
</Link>
|
||||
)}
|
||||
<details>
|
||||
<summary>Revisão independente</summary>
|
||||
<form
|
||||
className="mt-3 space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
version_no: row.version_no,
|
||||
}));
|
||||
form.post(`/management/education/${kind}/${row.id}/review`);
|
||||
}}
|
||||
>
|
||||
<Field label="Decisão interna">
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData("status", e.target.value)}
|
||||
>
|
||||
<option value="reviewed">Registar revisão</option>
|
||||
<option value="rejected">Rejeitar declaração</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Justificação e evidência da revisão">
|
||||
<textarea
|
||||
className={control}
|
||||
minLength={15}
|
||||
required
|
||||
value={form.data.review_reason}
|
||||
onChange={(e) => form.setData("review_reason", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Errors errors={form.errors} />
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar decisão
|
||||
</button>
|
||||
</form>
|
||||
</details>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
export default function Index(props: Props) {
|
||||
const search = useForm({
|
||||
q: props.filters.q ?? "",
|
||||
status: props.filters.status ?? "",
|
||||
geo_location_id: props.filters.geo_location_id ?? "",
|
||||
});
|
||||
return (
|
||||
<Management title="Competências e investimento em educação">
|
||||
<p>
|
||||
Declarações internas de procura e oferta. A revisão não constitui acreditação,
|
||||
certificação ou validação institucional. Não introduza dados pessoais de formandos.
|
||||
</p>
|
||||
<section aria-label="Indicadores internos" className="grid gap-4 md:grid-cols-4">
|
||||
<p>
|
||||
Declarações de procura: <strong>{props.indicators.demand_records}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Declarações de oferta: <strong>{props.indicators.capacity_records}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Procuras a rever: <strong>{props.indicators.pending_demands}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Procuras com fonte expirada: <strong>{props.indicators.expired_demands}</strong>
|
||||
</p>
|
||||
</section>
|
||||
<p>
|
||||
Indicadores globais de registos internos, sem aplicação dos filtros. Não representam
|
||||
totais de trabalhadores, lacunas validadas ou resultados educativos.
|
||||
</p>
|
||||
<form
|
||||
className="grid gap-4 md:grid-cols-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
search.get("/management/education", { preserveState: true });
|
||||
}}
|
||||
>
|
||||
<Field label="Pesquisar qualificação">
|
||||
<input
|
||||
className={control}
|
||||
maxLength={150}
|
||||
value={search.data.q}
|
||||
onChange={(e) => search.setData("q", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Estado">
|
||||
<select
|
||||
className={control}
|
||||
value={search.data.status}
|
||||
onChange={(e) => search.setData("status", e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
<option value="submitted">Por rever, fonte vigente</option>
|
||||
<option value="reviewed">Revisto, fonte vigente</option>
|
||||
<option value="rejected">Rejeitado, fonte vigente</option>
|
||||
<option value="expired">Fonte expirada</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Território">
|
||||
<select
|
||||
className={control}
|
||||
value={search.data.geo_location_id}
|
||||
onChange={(e) => search.setData("geo_location_id", e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{props.territories.map((t) => (
|
||||
<option key={t.id} value={t.id}>
|
||||
{t.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<div>
|
||||
<button className={button} disabled={search.processing}>
|
||||
Filtrar
|
||||
</button>
|
||||
<Link className="ml-3 underline" href="/management/education">
|
||||
Limpar
|
||||
</Link>
|
||||
<Errors errors={search.errors} />
|
||||
</div>
|
||||
</form>
|
||||
<section className="grid gap-3 md:grid-cols-2">
|
||||
{[
|
||||
["skills", "Competências"],
|
||||
["occupations", "Ocupações"],
|
||||
["providers", "Instituições"],
|
||||
["courses", "Cursos"],
|
||||
].map(([kind, title]) => (
|
||||
<Catalog key={kind} kind={kind} title={title} providers={props.providers} />
|
||||
))}
|
||||
</section>
|
||||
<Intake kind="demands" props={props} />
|
||||
<Intake kind="capacities" props={props} />
|
||||
{(["demands", "capacities"] as const).map((kind) => (
|
||||
<section key={kind} className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{kind === "demands"
|
||||
? "Procura de mão-de-obra"
|
||||
: "Oferta formativa declarada"}
|
||||
</h2>
|
||||
{props[kind].data.map((row) => (
|
||||
<Review key={row.id} row={row} kind={kind} today={props.today} />
|
||||
))}
|
||||
{!props[kind].data.length && <p>Ainda sem declarações.</p>}
|
||||
<Pagination page={props[kind]} />
|
||||
</section>
|
||||
))}
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,645 @@
|
||||
import { Link, router, useForm, usePage } from "@inertiajs/react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Frame, Field, input, button, card, money, api, groupLabels } from "./shared";
|
||||
import type { Opportunity, References } from "./shared";
|
||||
|
||||
type Feature = {
|
||||
geometry: { coordinates: [number, number] };
|
||||
properties: { id: number; title: string; location: string; url: string };
|
||||
};
|
||||
export default function Catalogue({
|
||||
filters,
|
||||
references,
|
||||
results,
|
||||
favourites,
|
||||
territorial,
|
||||
}: {
|
||||
filters: Record<string, string | string[] | boolean>;
|
||||
references: References;
|
||||
results: {
|
||||
data: Opportunity[];
|
||||
total: number;
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
favourites: number[];
|
||||
territorial: {
|
||||
id: string;
|
||||
title: string;
|
||||
content: { code: string };
|
||||
project_id: string | null;
|
||||
cluster_id: string | null;
|
||||
corridor_id: string | null;
|
||||
}[];
|
||||
}) {
|
||||
const { auth } = usePage<{ auth: { user: unknown } }>().props;
|
||||
const form = useForm({
|
||||
q: String(filters.q ?? ""),
|
||||
dimension: String(filters.dimension ?? ""),
|
||||
view: String(filters.view ?? "grid"),
|
||||
sector: String(filters.sector ?? ""),
|
||||
province: String(filters.province ?? ""),
|
||||
district: String(filters.district ?? ""),
|
||||
cluster_id: String(filters.cluster_id ?? ""),
|
||||
zee_id: String(filters.zee_id ?? ""),
|
||||
zfi_id: String(filters.zfi_id ?? ""),
|
||||
park_id: String(filters.park_id ?? ""),
|
||||
corridor_id: String(filters.corridor_id ?? ""),
|
||||
project_id: String(filters.project_id ?? ""),
|
||||
geo_location_id: String(filters.geo_location_id ?? ""),
|
||||
education: Boolean(filters.education && filters.education !== "0"),
|
||||
min_amount: String(filters.min_amount ?? ""),
|
||||
max_amount: String(filters.max_amount ?? ""),
|
||||
currency: String(filters.currency ?? ""),
|
||||
maturity_level: String(filters.maturity_level ?? ""),
|
||||
before: String(filters.before ?? ""),
|
||||
sort: String(filters.sort ?? "recent"),
|
||||
facets: (Array.isArray(filters.facets) ? filters.facets : []).map(Number),
|
||||
});
|
||||
const view = String(filters.view ?? "grid");
|
||||
const [saved, setSaved] = useState(favourites);
|
||||
const [selected, setSelected] = useState<number[]>([]);
|
||||
const [comparison, setComparison] = useState<{ record: Opportunity }[]>([]);
|
||||
const [points, setPoints] = useState<Feature[] | null>(null);
|
||||
const [error, setError] = useState("");
|
||||
const [suggestions, setSuggestions] = useState<{ title: string; slug: string }[]>([]);
|
||||
const filterKey = JSON.stringify(filters);
|
||||
useEffect(() => {
|
||||
if (view !== "map" && view !== "combined") return;
|
||||
let active = true;
|
||||
const values = JSON.parse(filterKey) as Record<string, string | string[] | boolean>;
|
||||
const params = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(values)) {
|
||||
if (Array.isArray(value)) value.forEach((v) => params.append(`${key}[]`, v));
|
||||
else if (value !== "" && value !== null)
|
||||
params.set(key, String(value === true ? 1 : value === false ? 0 : value));
|
||||
}
|
||||
setPoints(null);
|
||||
setError("");
|
||||
api(`/api/v1/investment/map?${params}`)
|
||||
.then((data) => {
|
||||
if (active) setPoints(data.features);
|
||||
})
|
||||
.catch(() => {
|
||||
if (active)
|
||||
setError("Mapa indisponível. A lista e os filtros continuam disponíveis.");
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [view, filterKey]);
|
||||
useEffect(() => {
|
||||
if (form.data.q.length < 2) {
|
||||
setSuggestions([]);
|
||||
return;
|
||||
}
|
||||
let active = true;
|
||||
const timer = setTimeout(() => {
|
||||
api(`/api/v1/investment/suggest?q=${encodeURIComponent(form.data.q)}`)
|
||||
.then((data) => {
|
||||
if (active) setSuggestions(data.opportunities);
|
||||
})
|
||||
.catch(() => {
|
||||
if (active) setSuggestions([]);
|
||||
});
|
||||
}, 300);
|
||||
return () => {
|
||||
active = false;
|
||||
clearTimeout(timer);
|
||||
};
|
||||
}, [form.data.q]);
|
||||
const query = () => {
|
||||
const params = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(filters)) {
|
||||
if (Array.isArray(value)) value.forEach((v) => params.append(`${key}[]`, String(v)));
|
||||
else if (value !== "" && value !== null)
|
||||
params.set(key, String(value === true ? 1 : value === false ? 0 : value));
|
||||
}
|
||||
return params.toString();
|
||||
};
|
||||
const toggle = async (id: number) => {
|
||||
if (!auth.user) {
|
||||
window.location.href = "/login";
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const data = await api(`/api/v1/investment/favourites/${id}`, {
|
||||
saved: !saved.includes(id),
|
||||
});
|
||||
setSaved(data.saved ? [...saved, id] : saved.filter((n) => n !== id));
|
||||
} catch (e) {
|
||||
setError((e as Error).message);
|
||||
}
|
||||
};
|
||||
const dimensionUrl = (dimension: string) => {
|
||||
const params = new URLSearchParams(query());
|
||||
params.set("dimension", dimension);
|
||||
params.delete("page");
|
||||
return `/oportunidades?${params}`;
|
||||
};
|
||||
return (
|
||||
<Frame
|
||||
title={form.data.education ? "Oportunidades na Educação" : "Catálogo de investimento"}
|
||||
>
|
||||
<nav aria-label="Dimensões do catálogo" className="grid gap-3 sm:grid-cols-4">
|
||||
<Link className={card} href={dimensionUrl("cluster")}>
|
||||
Por Cluster
|
||||
</Link>
|
||||
<Link className={card} href={dimensionUrl("corridor")}>
|
||||
Por Corredor
|
||||
</Link>
|
||||
<Link className={card} href={dimensionUrl("zee")}>
|
||||
Por ZEE
|
||||
</Link>
|
||||
<Link className={card} href={dimensionUrl("zfi")}>
|
||||
Por ZFI
|
||||
</Link>
|
||||
</nav>
|
||||
<p>
|
||||
Combine contexto territorial, dimensão e necessidades. As fichas documentais e as
|
||||
oportunidades mantêm a sua origem e natureza.
|
||||
</p>
|
||||
<form
|
||||
className={card + " space-y-4"}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
setPoints(null);
|
||||
setComparison([]);
|
||||
setSelected([]);
|
||||
form.get("/oportunidades", { preserveState: true });
|
||||
}}
|
||||
>
|
||||
<Field label="Pesquisar oportunidades">
|
||||
<input
|
||||
className={input}
|
||||
value={form.data.q}
|
||||
onChange={(e) => form.setData("q", e.target.value)}
|
||||
autoComplete="off"
|
||||
aria-describedby="search-suggestions"
|
||||
/>
|
||||
</Field>
|
||||
{suggestions.length > 0 && (
|
||||
<ul
|
||||
id="search-suggestions"
|
||||
aria-label="Sugestões de pesquisa"
|
||||
className="space-y-2"
|
||||
>
|
||||
{suggestions.map((s) => (
|
||||
<li key={s.slug}>
|
||||
<Link href={`/oportunidades/${s.slug}`} className="underline">
|
||||
{s.title}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{(
|
||||
[
|
||||
["zee_id", "zee", "ZEE"],
|
||||
["zfi_id", "zfi", "ZFI"],
|
||||
["park_id", "industrial_park", "Parque industrial"],
|
||||
] as const
|
||||
).map(([field, category, label]) => (
|
||||
<Field key={field} label={label}>
|
||||
<select
|
||||
className={input}
|
||||
value={form.data[field]}
|
||||
onChange={(e) => form.setData(field, e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{(references.zones ?? [])
|
||||
.filter((z) => z.category === category)
|
||||
.map((z) => (
|
||||
<option key={z.id} value={z.id}>
|
||||
{z.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
))}
|
||||
{(["clusters", "corridors", "projects", "locations"] as const).map(
|
||||
(group, i) => {
|
||||
const key = (
|
||||
[
|
||||
"cluster_id",
|
||||
"corridor_id",
|
||||
"project_id",
|
||||
"geo_location_id",
|
||||
] as const
|
||||
)[i];
|
||||
return (
|
||||
<Field
|
||||
key={group}
|
||||
label={
|
||||
["Cluster", "Corredor", "Projecto âncora", "Localização"][i]
|
||||
}
|
||||
>
|
||||
<select
|
||||
className={input}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{references[group].map((r) => (
|
||||
<option value={r.id} key={r.id}>
|
||||
{r.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
);
|
||||
},
|
||||
)}
|
||||
<Field label="Sector">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.sector}
|
||||
onChange={(e) => form.setData("sector", e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{references.sectors.map((s) => (
|
||||
<option key={s.id} value={s.slug}>
|
||||
{s.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{(["province", "district"] as const).map((key) => (
|
||||
<Field key={key} label={key === "province" ? "Província" : "Distrito"}>
|
||||
<input
|
||||
className={input}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
maxLength={100}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Estado de preparação">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.maturity_level}
|
||||
onChange={(e) => form.setData("maturity_level", e.target.value)}
|
||||
>
|
||||
<option value="">Todos os níveis</option>
|
||||
{[1, 2, 3, 4, 5, 6].map((n) => (
|
||||
<option key={n} value={n}>
|
||||
Maturidade {n}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{(["min_amount", "max_amount"] as const).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
key === "min_amount" ? "Investimento mínimo" : "Investimento máximo"
|
||||
}
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
step="0.01"
|
||||
className={input}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => {
|
||||
form.setData(key, e.target.value);
|
||||
if (!form.data.currency) form.setData("currency", "MZN");
|
||||
}}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Moeda">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.currency}
|
||||
required={!!form.data.min_amount || !!form.data.max_amount}
|
||||
onChange={(e) => form.setData("currency", e.target.value)}
|
||||
>
|
||||
<option value="">Todas, sem comparação cambial</option>
|
||||
{["MZN", "USD", "EUR", "ZAR"].map((c) => (
|
||||
<option key={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Data-alvo até">
|
||||
<input
|
||||
type="date"
|
||||
className={input}
|
||||
value={form.data.before}
|
||||
onChange={(e) => form.setData("before", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.education}
|
||||
onChange={(e) => form.setData("education", e.target.checked)}
|
||||
/>
|
||||
Apenas oportunidades na educação
|
||||
</label>
|
||||
<details>
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
Subsector, educação, infraestruturas, competências e apoios
|
||||
</summary>
|
||||
<div className="mt-4 grid gap-4 md:grid-cols-3">
|
||||
{[
|
||||
"subsector",
|
||||
"education",
|
||||
"infrastructure",
|
||||
"labour",
|
||||
"qualification",
|
||||
"support",
|
||||
"impact",
|
||||
"partnership",
|
||||
].map((group) => (
|
||||
<fieldset
|
||||
key={group}
|
||||
className="max-h-52 space-y-2 overflow-auto rounded border p-3"
|
||||
>
|
||||
<legend className="font-semibold">{groupLabels[group]}</legend>
|
||||
{references.options
|
||||
.filter((o) => o.group === group)
|
||||
.map((o) => (
|
||||
<label key={o.id} className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.facets.includes(o.id)}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
"facets",
|
||||
e.target.checked
|
||||
? [...form.data.facets, o.id]
|
||||
: form.data.facets.filter(
|
||||
(id) => id !== o.id,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
{o.label}
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
<div className="flex flex-wrap items-end gap-4">
|
||||
<Field label="Ordenar">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.sort}
|
||||
onChange={(e) => form.setData("sort", e.target.value)}
|
||||
>
|
||||
<option value="recent">Mais recentes</option>
|
||||
<option value="title">Título</option>
|
||||
<option value="amount_asc">Montante crescente, por moeda</option>
|
||||
<option value="amount_desc">Montante decrescente, por moeda</option>
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Aplicar filtros
|
||||
</button>
|
||||
<Link href="/oportunidades" className="underline">
|
||||
Limpar filtros
|
||||
</Link>
|
||||
</div>
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
</form>
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<p role="status">{results.total} oportunidades publicadas</p>
|
||||
{["grid", "list", "map", "combined"].map((value, i) => (
|
||||
<button
|
||||
key={value}
|
||||
aria-pressed={view === value}
|
||||
className="rounded border px-4 py-2"
|
||||
onClick={() => {
|
||||
const params = new URLSearchParams(query());
|
||||
params.set("view", value);
|
||||
router.get(`/oportunidades?${params}`, {}, { preserveScroll: true });
|
||||
}}
|
||||
>
|
||||
{["Grelha", "Lista", "Mapa", "Lista e mapa"][i]}
|
||||
</button>
|
||||
))}
|
||||
<a className="underline" href={"/api/v1/investment/export?" + query()}>
|
||||
Exportar CSV (até 1.000)
|
||||
</a>
|
||||
<Link className="underline" href="/investidor/manifestacoes">
|
||||
Favoritos e pedidos
|
||||
</Link>
|
||||
</div>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
{(view === "map" || view === "combined") && !error && <Map points={points} />}
|
||||
{(view !== "map" || error || points?.length === 0) && (
|
||||
<div
|
||||
className={
|
||||
view === "grid" ? "grid gap-5 md:grid-cols-2 xl:grid-cols-3" : "space-y-4"
|
||||
}
|
||||
>
|
||||
{results.data.map((r) => (
|
||||
<article key={r.id} className={card + " space-y-3"}>
|
||||
<p className="text-sm">
|
||||
{r.sector?.name} · {r.province || "Localização não indicada"}
|
||||
</p>
|
||||
<h2 className="text-xl font-bold">
|
||||
<Link href={`/oportunidades/${r.slug}`}>{r.title}</Link>
|
||||
</h2>
|
||||
<p>{r.summary}</p>
|
||||
<p className="font-semibold">{money(r)}</p>
|
||||
<p>{r.maturity_label}</p>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link className="underline" href={`/oportunidades/${r.slug}`}>
|
||||
Ver ficha
|
||||
</Link>
|
||||
<button
|
||||
aria-pressed={saved.includes(r.id)}
|
||||
className="underline"
|
||||
onClick={() => toggle(r.id)}
|
||||
>
|
||||
{saved.includes(r.id) ? "Retirar favorito" : "Guardar favorito"}
|
||||
</button>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selected.includes(r.id)}
|
||||
disabled={!selected.includes(r.id) && selected.length >= 4}
|
||||
onChange={(e) =>
|
||||
setSelected(
|
||||
e.target.checked
|
||||
? [...selected, r.id]
|
||||
: selected.filter((id) => id !== r.id),
|
||||
)
|
||||
}
|
||||
/>
|
||||
Comparar
|
||||
</label>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{!results.total && (
|
||||
<p className={card}>
|
||||
Sem oportunidades com estes filtros. Explore as fichas territoriais ou{" "}
|
||||
<Link href="/apoio" className="underline">
|
||||
peça apoio
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
)}
|
||||
<nav aria-label="Paginação" className="flex gap-6">
|
||||
{results.prev_page_url && <Link href={results.prev_page_url}>Anterior</Link>}
|
||||
{results.next_page_url && <Link href={results.next_page_url}>Seguinte</Link>}
|
||||
</nav>
|
||||
{selected.length > 0 && (
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
api(
|
||||
"/api/v1/investment/compare?" +
|
||||
selected.map((id) => "ids[]=" + id).join("&"),
|
||||
)
|
||||
.then((data) => setComparison(data.records))
|
||||
.catch((e) => setError(e.message))
|
||||
}
|
||||
>
|
||||
Comparar {selected.length} oportunidades
|
||||
</button>
|
||||
)}
|
||||
{comparison.length > 0 && (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full border-collapse text-left">
|
||||
<caption className="p-3 text-left font-bold">
|
||||
Comparação — montantes nas moedas de origem
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="border p-3">Campo</th>
|
||||
{comparison.map(({ record: r }) => (
|
||||
<th key={r.id} className="border p-3">
|
||||
{r.title}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{[
|
||||
"Sector",
|
||||
"Província",
|
||||
"Investimento",
|
||||
"Maturidade",
|
||||
"Parceria",
|
||||
"Impacto",
|
||||
].map((field, i) => (
|
||||
<tr key={field}>
|
||||
<th className="border p-3">{field}</th>
|
||||
{comparison.map(({ record: r }) => (
|
||||
<td className="border p-3" key={r.id}>
|
||||
{[
|
||||
r.sector?.name,
|
||||
r.province,
|
||||
money(r),
|
||||
r.maturity_label,
|
||||
r.financing_modality,
|
||||
r.expected_impact,
|
||||
][i] || "Não indicado"}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
{territorial.length > 0 && (
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-2xl font-bold">Contexto territorial e projectos âncora</h2>
|
||||
<p>
|
||||
Fichas do documento de referência; montantes e metas conservam a natureza
|
||||
declarada na fonte.
|
||||
</p>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
{territorial.map((d) => (
|
||||
<Link href={`/carteira/${d.id}`} key={d.id} className={card}>
|
||||
<span className="text-sm">
|
||||
{d.content.code} ·{" "}
|
||||
{d.cluster_id
|
||||
? "Cluster"
|
||||
: d.corridor_id
|
||||
? "Corredor"
|
||||
: "Projecto âncora"}
|
||||
</span>
|
||||
<h3 className="mt-2 font-semibold">{d.title}</h3>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
function Map({ points }: { points: Feature[] | null }) {
|
||||
if (points === null) return <p role="status">A carregar localizações…</p>;
|
||||
if (!points.length)
|
||||
return (
|
||||
<p className={card}>
|
||||
Sem coordenadas públicas associadas aos resultados. Não são atribuídas localizações
|
||||
aproximadas.
|
||||
</p>
|
||||
);
|
||||
const xs = points.map((p) => p.geometry.coordinates[0]),
|
||||
ys = points.map((p) => p.geometry.coordinates[1]);
|
||||
const minX = Math.min(...xs) - 0.1,
|
||||
maxX = Math.max(...xs) + 0.1,
|
||||
minY = Math.min(...ys) - 0.1,
|
||||
maxY = Math.max(...ys) + 0.1;
|
||||
return (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Localizações georreferenciadas</h2>
|
||||
<p>
|
||||
Coordenadas WGS84 publicadas, sem mapa base externo. Até 1.000 pontos; a lista
|
||||
acessível apresenta os mesmos dados.
|
||||
</p>
|
||||
<svg
|
||||
viewBox="0 0 900 400"
|
||||
role="img"
|
||||
aria-label="Distribuição das localizações por longitude e latitude"
|
||||
className="my-4 w-full rounded bg-sky-50"
|
||||
>
|
||||
<path d="M30 10 V370 H880" fill="none" stroke="#475569" />
|
||||
{points.map((p, i) => (
|
||||
<a
|
||||
key={`${p.properties.id}-${i}`}
|
||||
href={p.properties.url}
|
||||
aria-label={`${p.properties.title}, ${p.properties.location}`}
|
||||
>
|
||||
<circle
|
||||
cx={45 + ((p.geometry.coordinates[0] - minX) / (maxX - minX)) * 810}
|
||||
cy={350 - ((p.geometry.coordinates[1] - minY) / (maxY - minY)) * 310}
|
||||
r="8"
|
||||
fill="#065f46"
|
||||
>
|
||||
<title>{p.properties.title}</title>
|
||||
</circle>
|
||||
</a>
|
||||
))}
|
||||
</svg>
|
||||
<ul className="space-y-2">
|
||||
{points.map((p, i) => (
|
||||
<li key={i}>
|
||||
<Link className="underline" href={p.properties.url}>
|
||||
{p.properties.title}
|
||||
</Link>{" "}
|
||||
— {p.properties.location}; longitude {p.geometry.coordinates[0]}, latitude{" "}
|
||||
{p.geometry.coordinates[1]}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management } from "../management/shared";
|
||||
import { Field, input, button, card, groupLabels } from "./shared";
|
||||
import type { Opportunity, Context, References } from "./shared";
|
||||
export default function EditContext({
|
||||
record,
|
||||
context,
|
||||
references,
|
||||
}: {
|
||||
record: Opportunity;
|
||||
context: Context;
|
||||
references: References;
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: context.profile?.version ?? 0,
|
||||
is_education: context.profile?.is_education ?? false,
|
||||
business_model: context.profile?.business_model ?? "",
|
||||
requirements: context.profile?.requirements ?? "",
|
||||
risks: context.profile?.risks ?? "",
|
||||
target_date: context.profile?.target_date ?? "",
|
||||
source_reference: context.profile?.source_reference ?? "",
|
||||
clusters: context.clusters.map((r) => r.id),
|
||||
corridors: context.corridors.map((r) => r.id),
|
||||
projects: context.projects.map((r) => r.id),
|
||||
locations: context.locations.map((r) => r.id),
|
||||
facets: context.facets.map((r) => r.id),
|
||||
});
|
||||
return (
|
||||
<Management title={"Contexto: " + record.title}>
|
||||
<p>
|
||||
As relações e características são parte da ficha publicada. Guardar devolve-a a
|
||||
rascunho para revisão.
|
||||
</p>
|
||||
<Link href={`/management/opportunities/${record.id}/edit`} className="underline">
|
||||
Editar e publicar a ficha principal
|
||||
</Link>
|
||||
<form
|
||||
className="space-y-6"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.put(`/management/opportunities/${record.id}/context`, {
|
||||
onSuccess: () => form.setData("version", form.data.version + 1),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.is_education}
|
||||
onChange={(e) => form.setData("is_education", e.target.checked)}
|
||||
/>
|
||||
Oportunidade na educação
|
||||
</label>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{(["clusters", "corridors", "projects", "locations"] as const).map((key, i) => (
|
||||
<fieldset className={card + " max-h-72 space-y-2 overflow-auto"} key={key}>
|
||||
<legend className="font-bold">
|
||||
{["Clusters", "Corredores", "Projectos âncora", "Localizações"][i]}
|
||||
</legend>
|
||||
{references[key].map((r) => (
|
||||
<label key={r.id} className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data[key].includes(r.id)}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
key,
|
||||
e.target.checked
|
||||
? [...form.data[key], r.id]
|
||||
: form.data[key].filter((id) => id !== r.id),
|
||||
)
|
||||
}
|
||||
/>
|
||||
{r.name}
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
))}
|
||||
</div>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
{[
|
||||
"subsector",
|
||||
"education",
|
||||
"infrastructure",
|
||||
"labour",
|
||||
"qualification",
|
||||
"support",
|
||||
"impact",
|
||||
"partnership",
|
||||
].map((group) => (
|
||||
<fieldset
|
||||
key={group}
|
||||
className={card + " max-h-64 space-y-2 overflow-auto"}
|
||||
>
|
||||
<legend>{groupLabels[group]}</legend>
|
||||
{references.options
|
||||
.filter((o) => o.group === group && o.active)
|
||||
.map((o) => (
|
||||
<label key={o.id} className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.facets.includes(o.id)}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
"facets",
|
||||
e.target.checked
|
||||
? [...form.data.facets, o.id]
|
||||
: form.data.facets.filter(
|
||||
(id) => id !== o.id,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
{o.label}
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
))}
|
||||
</div>
|
||||
{(["business_model", "requirements", "risks", "source_reference"] as const).map(
|
||||
(key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
business_model: "Modelo de negócio",
|
||||
requirements: "Requisitos e necessidades",
|
||||
risks: "Riscos",
|
||||
source_reference: "Fonte e referência de autorização",
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<textarea
|
||||
className={input}
|
||||
required={key === "source_reference"}
|
||||
rows={3}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
),
|
||||
)}
|
||||
<Field label="Data-alvo">
|
||||
<input
|
||||
type="date"
|
||||
className={input}
|
||||
value={form.data.target_date}
|
||||
onChange={(e) => form.setData("target_date", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar contexto em rascunho
|
||||
</button>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
import { useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { newSubmissionKey } from "@/lib/portal-api";
|
||||
import { Field, card, input, button, api } from "./shared";
|
||||
export type Message = { id: string; sender_role: string; body: string; created_at: string };
|
||||
export function Conversation({
|
||||
id,
|
||||
messages,
|
||||
submitted,
|
||||
revisions,
|
||||
}: {
|
||||
id: string;
|
||||
messages: Message[];
|
||||
submitted: boolean;
|
||||
revisions: { version: number; created_at: string }[];
|
||||
}) {
|
||||
const form = useForm({ client_key: newSubmissionKey(), body: "" });
|
||||
const [revision, setRevision] = useState<{
|
||||
version: number;
|
||||
snapshot: {
|
||||
payload: {
|
||||
full_name?: string;
|
||||
organisation?: string;
|
||||
objective?: string;
|
||||
horizon?: string;
|
||||
};
|
||||
needs: { details: { description: string } }[];
|
||||
attachment_ids: string[];
|
||||
};
|
||||
} | null>(null);
|
||||
const [error, setError] = useState("");
|
||||
return (
|
||||
<>
|
||||
<section className={card + " space-y-4"}>
|
||||
<h2 className="text-xl font-bold">Versões guardadas</h2>
|
||||
<Field label="Consultar versão">
|
||||
<select
|
||||
className={input}
|
||||
defaultValue=""
|
||||
onChange={(e) => {
|
||||
setError("");
|
||||
if (!e.target.value) {
|
||||
setRevision(null);
|
||||
return;
|
||||
}
|
||||
api(`/api/v1/investment/submissions/${id}/revisions/${e.target.value}`)
|
||||
.then(setRevision)
|
||||
.catch(() => setError("Não foi possível consultar esta versão."));
|
||||
}}
|
||||
>
|
||||
<option value="">Seleccionar versão</option>
|
||||
{revisions.map((r) => (
|
||||
<option value={r.version} key={r.version}>
|
||||
Versão {r.version} —{" "}
|
||||
{new Date(r.created_at).toLocaleString("pt-MZ")}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
{revision && (
|
||||
<div className="space-y-2">
|
||||
<h3 className="font-bold">Versão {revision.version}</h3>
|
||||
<p>Investidor: {revision.snapshot.payload.full_name}</p>
|
||||
<p>Empresa: {revision.snapshot.payload.organisation || "Não indicada"}</p>
|
||||
<p className="whitespace-pre-line">
|
||||
Objectivo: {revision.snapshot.payload.objective || "Não indicado"}
|
||||
</p>
|
||||
<p>Prazo: {revision.snapshot.payload.horizon || "Não indicado"}</p>
|
||||
<ul>
|
||||
{revision.snapshot.needs.map((n, i) => (
|
||||
<li key={i}>{n.details.description}</li>
|
||||
))}
|
||||
</ul>
|
||||
<p>
|
||||
{revision.snapshot.attachment_ids.length} anexos associados nessa
|
||||
versão.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
{submitted && (
|
||||
<section className={card + " space-y-4"}>
|
||||
<h2 className="text-xl font-bold">Conversa com o apoio</h2>
|
||||
<p>
|
||||
As mensagens ficam registadas neste pedido e são visíveis ao investidor e à
|
||||
equipa autorizada.
|
||||
</p>
|
||||
{messages.map((m) => (
|
||||
<article key={m.id} className="rounded-lg border p-4">
|
||||
<p className="font-semibold">
|
||||
{m.sender_role === "support" ? "Apoio ao Investidor" : "Investidor"}{" "}
|
||||
· {new Date(m.created_at).toLocaleString("pt-MZ")}
|
||||
</p>
|
||||
<p className="mt-2 whitespace-pre-line">{m.body}</p>
|
||||
</article>
|
||||
))}
|
||||
{!messages.length && <p>Ainda não existem mensagens neste pedido.</p>}
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(`/investidor/manifestacoes/${id}/messages`, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () =>
|
||||
form.setData({ client_key: newSubmissionKey(), body: "" }),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Field label="Mensagem para acompanhamento">
|
||||
<textarea
|
||||
className={input}
|
||||
rows={4}
|
||||
required
|
||||
minLength={3}
|
||||
maxLength={5000}
|
||||
value={form.data.body}
|
||||
onChange={(e) => form.setData("body", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Enviar mensagem
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
import { Link, router, usePage } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Frame, card, button, money, groupLabels } from "./shared";
|
||||
import type { Opportunity, Context } from "./shared";
|
||||
export default function Detail({
|
||||
record: r,
|
||||
context: c,
|
||||
zone_origin,
|
||||
}: {
|
||||
record: Opportunity;
|
||||
context: Context;
|
||||
zone_origin?: { id: string; name: string } | null;
|
||||
}) {
|
||||
const { auth } = usePage<{ auth: { user: unknown } }>().props;
|
||||
const [sharing, setSharing] = useState("");
|
||||
return (
|
||||
<Frame title={r.title}>
|
||||
<p>
|
||||
{r.reference} · {r.sector?.name} · {r.province} {r.district}
|
||||
</p>
|
||||
<p className="text-xl">{r.summary}</p>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{auth.user ? (
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post("/investidor/manifestacoes", {
|
||||
opportunity_id: r.id,
|
||||
...(zone_origin
|
||||
? { zone_id: zone_origin.id, intent: "interest" }
|
||||
: {}),
|
||||
})
|
||||
}
|
||||
>
|
||||
Preparar manifestação de interesse
|
||||
</button>
|
||||
) : (
|
||||
<Link className={button} href="/login">
|
||||
Entrar para preparar manifestação
|
||||
</Link>
|
||||
)}
|
||||
<Link className="underline" href={`/manifestar-interesse/${r.slug}`}>
|
||||
Contacto rápido sem rascunho
|
||||
</Link>
|
||||
<button
|
||||
className="underline"
|
||||
onClick={() => {
|
||||
if (!navigator.clipboard) {
|
||||
setSharing("Copie a ligação na barra de endereço do navegador.");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard
|
||||
.writeText(window.location.href)
|
||||
.then(() => setSharing("Ligação copiada."))
|
||||
.catch(() =>
|
||||
setSharing("Copie a ligação na barra de endereço do navegador."),
|
||||
);
|
||||
}}
|
||||
>
|
||||
Copiar ligação
|
||||
</button>
|
||||
</div>
|
||||
{sharing && <p role="status">{sharing}</p>}
|
||||
{!!c.zones?.length && (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">ZEE, ZFI e parques associados</h2>
|
||||
{c.zones.map((z) => (
|
||||
<p key={z.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
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}{" "}
|
||||
· Fonte: {z.source_reference}
|
||||
</p>
|
||||
))}
|
||||
<p>A associação não atribui automaticamente benefícios ou licenças.</p>
|
||||
</section>
|
||||
)}
|
||||
<div className="grid gap-6 lg:grid-cols-3">
|
||||
<section className={card + " whitespace-pre-line lg:col-span-2"}>
|
||||
<h2 className="mb-3 text-xl font-bold">O investimento</h2>
|
||||
{r.description || "Descrição por completar."}
|
||||
</section>
|
||||
<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],
|
||||
].map(([key, value]) => (
|
||||
<div key={key}>
|
||||
<dt className="font-bold">{key}</dt>
|
||||
<dd>{value || "Não indicado"}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
{c.profile && (
|
||||
<section className={card + " space-y-4"}>
|
||||
<h2 className="text-xl font-bold">Viabilidade e preparação</h2>
|
||||
{[
|
||||
["Modelo de negócio", c.profile.business_model],
|
||||
["Requisitos", c.profile.requirements],
|
||||
["Riscos", c.profile.risks],
|
||||
["Fonte", c.profile.source_reference],
|
||||
].map(([label, text]) => (
|
||||
<div key={label}>
|
||||
<h3 className="font-bold">{label}</h3>
|
||||
<p className="whitespace-pre-line">{text || "Não indicado"}</p>
|
||||
</div>
|
||||
))}
|
||||
{c.profile.is_education && (
|
||||
<Link href="/educacao" className="underline">
|
||||
Explorar oportunidades na educação
|
||||
</Link>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
<section className="grid gap-4 md:grid-cols-4">
|
||||
{(["clusters", "corridors", "projects", "locations"] as const).map((key, i) => (
|
||||
<div className={card} key={key}>
|
||||
<h2 className="font-bold">
|
||||
{["Clusters", "Corredores", "Projectos âncora", "Territórios"][i]}
|
||||
</h2>
|
||||
{c[key].map((entity) => (
|
||||
<p key={entity.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={
|
||||
"/oportunidades?" +
|
||||
[
|
||||
"cluster_id",
|
||||
"corridor_id",
|
||||
"project_id",
|
||||
"geo_location_id",
|
||||
][i] +
|
||||
"=" +
|
||||
entity.id
|
||||
}
|
||||
>
|
||||
{entity.name}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
{!c[key].length && <p>Sem relação publicada.</p>}
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">
|
||||
Infraestruturas, competências, educação e apoios
|
||||
</h2>
|
||||
{c.facets.map((f) => (
|
||||
<p key={f.id}>
|
||||
{groupLabels[f.group] ?? f.group}: {f.label}
|
||||
</p>
|
||||
))}
|
||||
{!c.facets.length && (
|
||||
<p>
|
||||
Sem características estruturadas publicadas. Pode declarar as suas
|
||||
necessidades na manifestação de interesse.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { Link, router } from "@inertiajs/react";
|
||||
import { Frame, card, button } from "./shared";
|
||||
export default function Notifications({
|
||||
unread,
|
||||
notifications,
|
||||
}: {
|
||||
unread: number;
|
||||
notifications: {
|
||||
data: {
|
||||
id: string;
|
||||
submission_id: string;
|
||||
kind: string;
|
||||
payload: { status?: string; reference?: string };
|
||||
read_at: string | null;
|
||||
created_at: string;
|
||||
}[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
}) {
|
||||
const states: Record<string, string> = {
|
||||
received: "Recebido",
|
||||
in_review: "Em análise",
|
||||
contacted: "Contactado",
|
||||
closed: "Encerrado",
|
||||
};
|
||||
return (
|
||||
<Frame title="Notificações e acompanhamento">
|
||||
<Link href="/investidor/manifestacoes" className="underline">
|
||||
Área do investidor
|
||||
</Link>
|
||||
<p role="status">{unread} notificações por ler</p>
|
||||
{notifications.data.map((n) => (
|
||||
<article key={n.id} className={card + " space-y-3"}>
|
||||
<h2 className="text-xl font-bold">
|
||||
{n.kind === "received"
|
||||
? "Manifestação recebida"
|
||||
: n.kind === "status"
|
||||
? "Estado actualizado"
|
||||
: "Nova mensagem na conversa"}
|
||||
</h2>
|
||||
<p>
|
||||
{n.payload.reference ??
|
||||
(n.payload.status
|
||||
? (states[n.payload.status] ?? n.payload.status)
|
||||
: "Consulte o pedido para ler a mensagem.")}
|
||||
</p>
|
||||
<p className="text-sm">{new Date(n.created_at).toLocaleString("pt-MZ")}</p>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link
|
||||
href={"/investidor/manifestacoes/" + n.submission_id}
|
||||
className="underline"
|
||||
>
|
||||
Abrir manifestação
|
||||
</Link>
|
||||
{!n.read_at && (
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
"/investidor/notifications/" + n.id + "/read",
|
||||
{},
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
}
|
||||
>
|
||||
Marcar como lida
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
{!notifications.data.length && <p>Ainda não existem notificações.</p>}
|
||||
<nav aria-label="Paginação" className="flex gap-4">
|
||||
{notifications.prev_page_url && (
|
||||
<Link href={notifications.prev_page_url}>Anterior</Link>
|
||||
)}
|
||||
{notifications.next_page_url && (
|
||||
<Link href={notifications.next_page_url}>Seguinte</Link>
|
||||
)}
|
||||
</nav>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
import { Link, router, useForm } from "@inertiajs/react";
|
||||
import { Frame, Field, input, button, card } from "./shared";
|
||||
|
||||
type RecordData = { version: number; payload: Record<string, string> };
|
||||
type Company = RecordData & { id: string };
|
||||
const labels: Record<string, string> = {
|
||||
phone: "Telefone",
|
||||
country: "País",
|
||||
sector: "Sector de interesse",
|
||||
experience: "Experiência relevante",
|
||||
investment_capacity: "Capacidade de investimento declarada",
|
||||
name: "Nome da empresa",
|
||||
registration: "Referência de registo / NUIT",
|
||||
role: "Função ou relação com a empresa",
|
||||
description: "Actividade e observações",
|
||||
};
|
||||
|
||||
export default function Profile({
|
||||
account,
|
||||
companies,
|
||||
}: {
|
||||
account: RecordData;
|
||||
companies: Company[];
|
||||
}) {
|
||||
return (
|
||||
<Frame title="Perfil de investimento e empresas">
|
||||
<Link href="/investidor/manifestacoes" className="underline">
|
||||
Voltar à área do investidor
|
||||
</Link>
|
||||
<p>
|
||||
Estes dados são privados e servem para preencher novas manifestações. Nome e email
|
||||
são mantidos nas{" "}
|
||||
<Link className="underline" href="/settings/profile">
|
||||
definições da conta
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
<Editor
|
||||
key={"account-" + account.version}
|
||||
record={account}
|
||||
fields={["phone", "country", "sector", "experience", "investment_capacity"]}
|
||||
/>
|
||||
<h2 className="text-2xl font-bold">Empresas declaradas</h2>
|
||||
<p>
|
||||
Declarar uma empresa não comprova representação legal nem concede acesso aos
|
||||
registos de outras pessoas. A equipa pode pedir evidência durante o atendimento.
|
||||
</p>
|
||||
{companies.map((company) => (
|
||||
<section key={company.id} className={card}>
|
||||
<h3 className="text-xl font-bold">{company.payload.name}</h3>
|
||||
<Editor
|
||||
key={company.version}
|
||||
record={company}
|
||||
fields={[
|
||||
"name",
|
||||
"country",
|
||||
"registration",
|
||||
"sector",
|
||||
"role",
|
||||
"description",
|
||||
]}
|
||||
/>
|
||||
<button
|
||||
className={button + " mt-4"}
|
||||
onClick={() =>
|
||||
router.post("/investidor/manifestacoes", { company_id: company.id })
|
||||
}
|
||||
>
|
||||
Preparar manifestação desta empresa
|
||||
</button>
|
||||
</section>
|
||||
))}
|
||||
{companies.length < 20 && (
|
||||
<section className={card}>
|
||||
<h3 className="text-xl font-bold">Acrescentar empresa</h3>
|
||||
<Editor
|
||||
key={"new-" + companies.length}
|
||||
record={{ version: 0, payload: {} }}
|
||||
company
|
||||
fields={[
|
||||
"name",
|
||||
"country",
|
||||
"registration",
|
||||
"sector",
|
||||
"role",
|
||||
"description",
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
function Editor({
|
||||
record,
|
||||
fields,
|
||||
company = false,
|
||||
}: {
|
||||
record: RecordData & { id?: string };
|
||||
fields: string[];
|
||||
company?: boolean;
|
||||
}) {
|
||||
const isCompany = company || !!record.id;
|
||||
const form = useForm({
|
||||
version: record.version,
|
||||
payload: Object.fromEntries(fields.map((key) => [key, record.payload[key] ?? ""])),
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="mt-4 space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const options = { preserveScroll: true };
|
||||
if (isCompany)
|
||||
form.post(
|
||||
"/investidor/companies" + (record.id ? "/" + record.id : ""),
|
||||
options,
|
||||
);
|
||||
else form.put("/investidor/profile", options);
|
||||
}}
|
||||
>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{fields.map((key) => (
|
||||
<Field key={key} label={labels[key]}>
|
||||
<input
|
||||
className={input}
|
||||
value={form.data.payload[key]}
|
||||
required={isCompany && ["name", "country", "role"].includes(key)}
|
||||
maxLength={
|
||||
key === "description" || key === "experience"
|
||||
? 2000
|
||||
: key === "investment_capacity"
|
||||
? 1000
|
||||
: 200
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData("payload", {
|
||||
...form.data.payload,
|
||||
[key]: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
</div>
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key} className="text-red-700">
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={form.processing}>
|
||||
{isCompany ? "Guardar declaração da empresa" : "Guardar perfil de investimento"}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
import { useForm } from "@inertiajs/react";
|
||||
import { Management } from "../management/shared";
|
||||
import { Field, input, button, card, groupLabels } from "./shared";
|
||||
import type { Option } from "./shared";
|
||||
export default function References({ options }: { options: Option[] }) {
|
||||
const groups = [...new Set(options.map((o) => o.group))];
|
||||
return (
|
||||
<Management title="Opções dos formulários e filtros">
|
||||
<p>
|
||||
Os códigos são estáveis; pode corrigir etiquetas ou desactivar opções sem eliminar
|
||||
referências históricas. Cada grupo conserva Outro — especificar.
|
||||
</p>
|
||||
<OptionForm groups={groups} />
|
||||
<div className="space-y-4">
|
||||
{groups.map((group) => (
|
||||
<details key={group} className={card}>
|
||||
<summary className="cursor-pointer font-bold">
|
||||
{groupLabels[group] ?? group}
|
||||
</summary>
|
||||
<div className="mt-4 space-y-5">
|
||||
{options
|
||||
.filter((o) => o.group === group)
|
||||
.map((o) => (
|
||||
<OptionForm key={o.id} option={o} groups={groups} />
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
))}
|
||||
</div>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
function OptionForm({ option, groups }: { option?: Option; groups: string[] }) {
|
||||
const form = useForm({
|
||||
group: option?.group ?? groups[0],
|
||||
code: option?.code ?? "",
|
||||
label: option?.label ?? "",
|
||||
active: option?.active ?? true,
|
||||
requires_description: option?.requires_description ?? false,
|
||||
sort_order: option?.sort_order ?? 0,
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post("/management/investment/references" + (option ? "/" + option.id : ""), {
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h2 className="font-semibold">{option ? "Editar opção" : "Criar opção"}</h2>
|
||||
<div className="grid gap-3 md:grid-cols-3">
|
||||
<Field label="Grupo">
|
||||
<select
|
||||
disabled={!!option}
|
||||
className={input}
|
||||
value={form.data.group}
|
||||
onChange={(e) => form.setData("group", e.target.value)}
|
||||
>
|
||||
{groups.map((g) => (
|
||||
<option key={g} value={g}>
|
||||
{groupLabels[g] ?? g}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Código">
|
||||
<input
|
||||
className={input}
|
||||
required
|
||||
readOnly={!!option}
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData("code", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Etiqueta">
|
||||
<input
|
||||
className={input}
|
||||
required
|
||||
value={form.data.label}
|
||||
onChange={(e) => form.setData("label", e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
<label className="mr-4 inline-flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.active}
|
||||
onChange={(e) => form.setData("active", e.target.checked)}
|
||||
/>
|
||||
Activa
|
||||
</label>
|
||||
<label className="inline-flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.requires_description}
|
||||
onChange={(e) => form.setData("requires_description", e.target.checked)}
|
||||
/>
|
||||
Exige especificação
|
||||
</label>
|
||||
<Field label="Ordem">
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="10000"
|
||||
className={input}
|
||||
value={form.data.sort_order}
|
||||
onChange={(e) => form.setData("sort_order", Number(e.target.value))}
|
||||
/>
|
||||
</Field>
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button disabled={form.processing} className={button}>
|
||||
Guardar opção
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import { Head, Link, usePage } from "@inertiajs/react";
|
||||
import type { ReactNode } from "react";
|
||||
import { PortalMenu } from "@/layouts/portal-navigation";
|
||||
|
||||
export type Option = {
|
||||
id: number;
|
||||
group: string;
|
||||
code: string;
|
||||
label: string;
|
||||
active: boolean;
|
||||
requires_description: boolean;
|
||||
sort_order: number;
|
||||
};
|
||||
export type Entity = { id: string; name: string };
|
||||
export type References = {
|
||||
zones?: { id: string; name: string; category: string }[];
|
||||
options: Option[];
|
||||
clusters: Entity[];
|
||||
corridors: Entity[];
|
||||
projects: Entity[];
|
||||
locations: Entity[];
|
||||
sectors: { id: number; name: string; slug: string }[];
|
||||
};
|
||||
export type Opportunity = {
|
||||
id: number;
|
||||
title: string;
|
||||
slug: string;
|
||||
reference: string;
|
||||
summary: string | null;
|
||||
description: string | null;
|
||||
province: string | null;
|
||||
district: string | null;
|
||||
sector?: { name: string; slug: string };
|
||||
estimated_investment_amount: string | null;
|
||||
estimated_investment_currency: string;
|
||||
maturity_label: string | null;
|
||||
promoter_name: string | null;
|
||||
expected_impact: string | null;
|
||||
financing_modality: string | null;
|
||||
status: string;
|
||||
};
|
||||
export type Context = {
|
||||
zones?: {
|
||||
id: string;
|
||||
name: string;
|
||||
category: string;
|
||||
association_type: string;
|
||||
source_reference: string;
|
||||
}[];
|
||||
profile: {
|
||||
version: number;
|
||||
is_education: boolean;
|
||||
business_model: string | null;
|
||||
requirements: string | null;
|
||||
risks: string | null;
|
||||
target_date: string | null;
|
||||
source_reference: string | null;
|
||||
} | null;
|
||||
facets: { id: number; group: string; label: string }[];
|
||||
clusters: Entity[];
|
||||
corridors: Entity[];
|
||||
projects: Entity[];
|
||||
locations: Entity[];
|
||||
};
|
||||
export const input =
|
||||
"w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-slate-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700";
|
||||
export const button =
|
||||
"inline-flex items-center justify-center rounded-lg bg-emerald-800 px-4 py-2 font-semibold text-white disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700";
|
||||
export const card = "rounded-xl border border-slate-200 bg-white p-5 shadow-sm";
|
||||
export function Frame({ title, children }: { title: string; children: ReactNode }) {
|
||||
const { flash } = usePage<{ flash?: { success?: string } }>().props;
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 text-slate-900">
|
||||
<Head title={title} />
|
||||
<PortalMenu />
|
||||
<main className="mx-auto max-w-7xl space-y-6 px-5 py-9">
|
||||
<h1 className="text-3xl font-bold">{title}</h1>
|
||||
{flash?.success && (
|
||||
<p
|
||||
role="status"
|
||||
className="rounded border border-emerald-700 bg-emerald-50 p-4"
|
||||
>
|
||||
{flash.success}
|
||||
</p>
|
||||
)}
|
||||
{children}
|
||||
</main>
|
||||
<footer className="border-t p-6 text-center">
|
||||
<Link href="/apoio" className="underline">
|
||||
Apoio ao Investidor
|
||||
</Link>{" "}
|
||||
·{" "}
|
||||
<Link href="/documentos" className="underline">
|
||||
Documentos
|
||||
</Link>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export function Field({ label, children }: { label: string; children: ReactNode }) {
|
||||
return (
|
||||
<label className="block space-y-1 text-sm font-medium">
|
||||
<span>{label}</span>
|
||||
{children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
export function money(r: Opportunity) {
|
||||
return r.estimated_investment_amount === null
|
||||
? "Montante não indicado"
|
||||
: `${new Intl.NumberFormat("pt-MZ", { maximumFractionDigits: 2 }).format(Number(r.estimated_investment_amount))} ${r.estimated_investment_currency}`;
|
||||
}
|
||||
export async function api(url: string, body?: unknown) {
|
||||
const token = decodeURIComponent(
|
||||
document.cookie
|
||||
.split("; ")
|
||||
.find((c) => c.startsWith("XSRF-TOKEN="))
|
||||
?.slice(11) ?? "",
|
||||
);
|
||||
const response = await fetch(url, {
|
||||
method: body === undefined ? "GET" : "POST",
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"X-XSRF-TOKEN": token,
|
||||
},
|
||||
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
||||
});
|
||||
const data = await response.json();
|
||||
if (!response.ok) throw new Error(data.message ?? "Não foi possível concluir a operação.");
|
||||
return data;
|
||||
}
|
||||
export const groupLabels: Record<string, string> = {
|
||||
education: "Educação",
|
||||
infrastructure: "Infraestruturas",
|
||||
labour: "Mão de obra",
|
||||
qualification: "Qualificações",
|
||||
support: "Apoios",
|
||||
impact: "Impacto",
|
||||
partnership: "Modelo de parceria",
|
||||
subsector: "Subsector",
|
||||
need_category: "Categoria da necessidade",
|
||||
priority: "Prioridade",
|
||||
unit: "Unidade",
|
||||
participation: "Participação",
|
||||
investor_profile: "Perfil do investidor",
|
||||
need_status: "Estado da necessidade",
|
||||
};
|
||||
@@ -0,0 +1,767 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Frame, Field, input, button, card } from "./shared";
|
||||
import type { References } from "./shared";
|
||||
import { Conversation } from "./conversation";
|
||||
import type { Message } from "./conversation";
|
||||
type Payload = {
|
||||
full_name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
country: string;
|
||||
organisation: string;
|
||||
representative_role: string;
|
||||
experience: string;
|
||||
investment_capacity: string;
|
||||
other_details: string;
|
||||
profile_id: string;
|
||||
sector: string;
|
||||
objective: string;
|
||||
participation_id: string;
|
||||
partnership_id: string;
|
||||
estimated_amount: string;
|
||||
currency: string;
|
||||
horizon: string;
|
||||
location: string;
|
||||
cluster_ids: string[];
|
||||
corridor_ids: string[];
|
||||
project_ids: string[];
|
||||
contact_consent: boolean;
|
||||
};
|
||||
type Need = {
|
||||
category_id: string;
|
||||
option_id: string;
|
||||
unit_id: string;
|
||||
priority_id: string;
|
||||
quantity: string;
|
||||
deadline: string;
|
||||
details: {
|
||||
description: string;
|
||||
location: string;
|
||||
observations: string;
|
||||
qualification: string;
|
||||
specialty: string;
|
||||
experience: string;
|
||||
certifications: string;
|
||||
availability: string;
|
||||
institution: string;
|
||||
training_mode: string;
|
||||
duration: string;
|
||||
status: string;
|
||||
};
|
||||
};
|
||||
type Props = {
|
||||
zone_origin?: {
|
||||
zone_id: string;
|
||||
zone_version: number;
|
||||
intent: "interest" | "dossier" | "meeting";
|
||||
} | null;
|
||||
submission: { id: string; version: number; payload: Partial<Payload>; status: string };
|
||||
references: References;
|
||||
needs: Need[];
|
||||
attachments: { id: string; file_name: string }[];
|
||||
events: { action: string; version: number; created_at: string }[];
|
||||
receipt: { reference: string; status: string } | null;
|
||||
target: string | null;
|
||||
management: boolean;
|
||||
messages: Message[];
|
||||
revisions: { version: number; created_at: string }[];
|
||||
};
|
||||
const emptyNeed = (): Need => ({
|
||||
category_id: "",
|
||||
option_id: "",
|
||||
unit_id: "",
|
||||
priority_id: "",
|
||||
quantity: "",
|
||||
deadline: "",
|
||||
details: {
|
||||
description: "",
|
||||
location: "",
|
||||
observations: "",
|
||||
qualification: "",
|
||||
specialty: "",
|
||||
experience: "",
|
||||
certifications: "",
|
||||
availability: "",
|
||||
institution: "",
|
||||
training_mode: "",
|
||||
duration: "",
|
||||
status: "",
|
||||
},
|
||||
});
|
||||
export default function Submission(props: Props) {
|
||||
const [step, setStep] = useState(0);
|
||||
return <Editor key={props.submission.version} {...props} step={step} setStep={setStep} />;
|
||||
}
|
||||
function Editor({
|
||||
zone_origin,
|
||||
submission: s,
|
||||
references: r,
|
||||
needs,
|
||||
attachments,
|
||||
events,
|
||||
receipt,
|
||||
target,
|
||||
management,
|
||||
messages,
|
||||
revisions,
|
||||
step,
|
||||
setStep,
|
||||
}: Props & { step: number; setStep: (step: number) => void }) {
|
||||
const initial: Payload = {
|
||||
full_name: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
country: "",
|
||||
organisation: "",
|
||||
representative_role: "",
|
||||
experience: "",
|
||||
investment_capacity: "",
|
||||
other_details: "",
|
||||
profile_id: "",
|
||||
sector: "",
|
||||
objective: "",
|
||||
participation_id: "",
|
||||
partnership_id: "",
|
||||
estimated_amount: "",
|
||||
currency: "",
|
||||
horizon: "",
|
||||
location: "",
|
||||
cluster_ids: [],
|
||||
corridor_ids: [],
|
||||
project_ids: [],
|
||||
contact_consent: false,
|
||||
...s.payload,
|
||||
};
|
||||
const form = useForm({
|
||||
version: s.version,
|
||||
payload: initial,
|
||||
needs: needs.map((n) => ({
|
||||
...emptyNeed(),
|
||||
...Object.fromEntries(
|
||||
Object.entries(n).filter(([k]) =>
|
||||
[
|
||||
"category_id",
|
||||
"option_id",
|
||||
"unit_id",
|
||||
"priority_id",
|
||||
"quantity",
|
||||
"deadline",
|
||||
"details",
|
||||
].includes(k),
|
||||
),
|
||||
),
|
||||
details: { ...emptyNeed().details, ...n.details },
|
||||
})) as Need[],
|
||||
});
|
||||
const upload = useForm<{ version: number; file: File | null }>({
|
||||
version: s.version,
|
||||
file: null,
|
||||
});
|
||||
const [note, setNote] = useState("");
|
||||
const readonly = s.status !== "draft" || management;
|
||||
const base = "/investidor/manifestacoes/" + s.id;
|
||||
const update = <K extends keyof Payload>(key: K, value: Payload[K]) =>
|
||||
form.setData("payload", { ...form.data.payload, [key]: value });
|
||||
const text = (key: keyof Payload, label: string, required = false, type = "text") => (
|
||||
<Field label={label}>
|
||||
<input
|
||||
className={input}
|
||||
type={type}
|
||||
required={required}
|
||||
disabled={readonly}
|
||||
name={key}
|
||||
min={type === "number" ? 0 : undefined}
|
||||
minLength={key === "objective" ? 20 : key === "full_name" ? 3 : undefined}
|
||||
onBlur={(e) => {
|
||||
if (!e.target.validity.valid)
|
||||
setNote(`Verifique o campo ${label}: ${e.target.validationMessage}`);
|
||||
else setNote("");
|
||||
}}
|
||||
value={String(form.data.payload[key] ?? "")}
|
||||
onChange={(e) => update(key, e.target.value as never)}
|
||||
maxLength={key === "objective" ? 5000 : 2000}
|
||||
/>
|
||||
</Field>
|
||||
);
|
||||
const option = (
|
||||
key: "profile_id" | "participation_id" | "partnership_id",
|
||||
group: string,
|
||||
label: string,
|
||||
) => (
|
||||
<Field label={label}>
|
||||
<select
|
||||
className={input}
|
||||
disabled={readonly}
|
||||
value={form.data.payload[key] ?? ""}
|
||||
onChange={(e) => update(key, e.target.value)}
|
||||
>
|
||||
<option value="">Seleccionar</option>
|
||||
{r.options
|
||||
.filter(
|
||||
(o) =>
|
||||
o.group === group &&
|
||||
(o.active || String(o.id) === String(form.data.payload[key])),
|
||||
)
|
||||
.map((o) => (
|
||||
<option value={o.id} key={o.id} disabled={!o.active}>
|
||||
{o.label}
|
||||
{!o.active ? " (inactiva)" : ""}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
);
|
||||
const updateNeed = (index: number, value: Need) =>
|
||||
form.setData(
|
||||
"needs",
|
||||
form.data.needs.map((n, i) => (i === index ? value : n)),
|
||||
);
|
||||
const errorStep = (key: string) =>
|
||||
key.startsWith("needs.")
|
||||
? 2
|
||||
: /payload\.(full_name|email|phone|country|profile_id|organisation|representative_role|sector|experience|investment_capacity)/.test(
|
||||
key,
|
||||
)
|
||||
? 0
|
||||
: key === "payload.contact_consent"
|
||||
? 4
|
||||
: 1;
|
||||
return (
|
||||
<Frame
|
||||
title={
|
||||
receipt ? "Manifestação " + receipt.reference : "Preparar manifestação de interesse"
|
||||
}
|
||||
>
|
||||
<p>
|
||||
{target ??
|
||||
(zone_origin
|
||||
? "Pedido relativo a zona de investimento"
|
||||
: "Interesse geral")}{" "}
|
||||
· Versão {s.version} · {s.status === "draft" ? "Rascunho privado" : "Submetido"}
|
||||
</p>
|
||||
{zone_origin && (
|
||||
<p className={card}>
|
||||
<Link className="underline" href={`/zonas/${zone_origin.zone_id}`}>
|
||||
Consultar zona de origem
|
||||
</Link>{" "}
|
||||
· Versão da ficha {zone_origin.zone_version} ·{" "}
|
||||
{
|
||||
{
|
||||
interest: "Manifestação de interesse",
|
||||
dossier: "Pedido de dossier",
|
||||
meeting: "Pedido de reunião",
|
||||
}[zone_origin.intent]
|
||||
}
|
||||
. Atendimento assistido, sem decisão administrativa automática.
|
||||
</p>
|
||||
)}
|
||||
{receipt && (
|
||||
<p role="status" className={card}>
|
||||
Protocolo: <strong>{receipt.reference}</strong> · Estado:{" "}
|
||||
{(
|
||||
{
|
||||
received: "Recebido",
|
||||
in_review: "Em análise",
|
||||
contacted: "Contactado",
|
||||
closed: "Encerrado",
|
||||
} as Record<string, string>
|
||||
)[receipt.status] ?? receipt.status}
|
||||
</p>
|
||||
)}
|
||||
<nav aria-label="Etapas da manifestação" className="flex flex-wrap gap-2">
|
||||
{["Identificação", "Investimento", "Necessidades", "Anexos", "Rever e enviar"].map(
|
||||
(label, i) => (
|
||||
<button
|
||||
key={label}
|
||||
type="button"
|
||||
aria-current={step === i ? "step" : undefined}
|
||||
className={step === i ? button : "rounded border px-4 py-2"}
|
||||
onClick={() => setStep(i)}
|
||||
>
|
||||
{i + 1}. {label}
|
||||
</button>
|
||||
),
|
||||
)}
|
||||
</nav>
|
||||
<p className="text-sm">
|
||||
Etapa {step + 1} de 5. Guarde antes de sair. A informação declarada não é publicada.
|
||||
</p>
|
||||
<form
|
||||
className={card + " space-y-5"}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.put(base, { preserveScroll: true });
|
||||
}}
|
||||
>
|
||||
{step === 0 && (
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{text("full_name", "Nome completo", true)}
|
||||
{text("email", "Email", true, "email")}
|
||||
{text("phone", "Telefone")}
|
||||
{text("country", "País", true)}
|
||||
{option("profile_id", "investor_profile", "Perfil do investidor")}
|
||||
{text("organisation", "Organização / empresa")}
|
||||
{text("representative_role", "Função do representante")}
|
||||
{text("sector", "Sector de interesse", true)}
|
||||
{text("experience", "Experiência relevante")}
|
||||
{text(
|
||||
"investment_capacity",
|
||||
"Capacidade de investimento / especificação do perfil",
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{step === 1 && (
|
||||
<div className="space-y-5">
|
||||
{text(
|
||||
"objective",
|
||||
"Objectivo do investimento (mínimo 20 caracteres)",
|
||||
true,
|
||||
)}
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{option(
|
||||
"participation_id",
|
||||
"participation",
|
||||
"Modalidade de participação",
|
||||
)}
|
||||
{option("partnership_id", "partnership", "Modelo de parceria")}
|
||||
{text("estimated_amount", "Investimento estimado", false, "number")}
|
||||
{text("currency", "Moeda (código de três letras)")}
|
||||
{text("horizon", "Prazo / horizonte", true)}
|
||||
{text("location", "Localização pretendida")}
|
||||
</div>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
{(["clusters", "corridors", "projects"] as const).map((group, i) => {
|
||||
const key = (
|
||||
["cluster_ids", "corridor_ids", "project_ids"] as const
|
||||
)[i];
|
||||
return (
|
||||
<fieldset
|
||||
className="max-h-64 space-y-2 overflow-auto rounded border p-3"
|
||||
key={group}
|
||||
>
|
||||
<legend>
|
||||
{["Clusters", "Corredores", "Projectos âncora"][i]}
|
||||
</legend>
|
||||
{r[group].map((entity) => (
|
||||
<label key={entity.id} className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
disabled={readonly}
|
||||
checked={(
|
||||
form.data.payload[key] ?? []
|
||||
).includes(entity.id)}
|
||||
onChange={(e) =>
|
||||
update(
|
||||
key,
|
||||
e.target.checked
|
||||
? [
|
||||
...(form.data.payload[key] ??
|
||||
[]),
|
||||
entity.id,
|
||||
]
|
||||
: form.data.payload[key].filter(
|
||||
(id) => id !== entity.id,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
{entity.name}
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{step === 2 && (
|
||||
<section className="space-y-5">
|
||||
<h2 className="text-xl font-bold">
|
||||
Mão de obra, infraestruturas, formação e apoios
|
||||
</h2>
|
||||
<p>
|
||||
Acrescente o que existe no local e o que necessita. As opções são
|
||||
mantidas pela gestão; use Outro para especificar casos adicionais.
|
||||
</p>
|
||||
{form.data.needs.map((need, index) => {
|
||||
const category =
|
||||
r.options.find((o) => String(o.id) === String(need.category_id))
|
||||
?.code ?? "";
|
||||
const group = category.startsWith("labour")
|
||||
? "labour"
|
||||
: category.startsWith("infrastructure")
|
||||
? "infrastructure"
|
||||
: category === "education"
|
||||
? "education"
|
||||
: "support";
|
||||
const needSelect = (
|
||||
field: "category_id" | "option_id" | "unit_id" | "priority_id",
|
||||
optionGroup: string,
|
||||
label: string,
|
||||
) => (
|
||||
<Field label={label}>
|
||||
<select
|
||||
className={input}
|
||||
disabled={readonly}
|
||||
value={need[field] ?? ""}
|
||||
onChange={(e) =>
|
||||
updateNeed(index, {
|
||||
...need,
|
||||
[field]: e.target.value,
|
||||
...(field === "category_id"
|
||||
? { option_id: "" }
|
||||
: {}),
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="">Seleccionar</option>
|
||||
{r.options
|
||||
.filter(
|
||||
(o) =>
|
||||
o.group === optionGroup &&
|
||||
(o.active ||
|
||||
String(o.id) === String(need[field])),
|
||||
)
|
||||
.map((o) => (
|
||||
<option value={o.id} key={o.id}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
);
|
||||
return (
|
||||
<fieldset key={index} className="space-y-4 rounded-lg border p-4">
|
||||
<legend className="font-bold">Necessidade {index + 1}</legend>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{needSelect("category_id", "need_category", "Categoria")}
|
||||
{needSelect("option_id", group, "Tipo")}
|
||||
{needSelect("unit_id", "unit", "Unidade")}
|
||||
{needSelect("priority_id", "priority", "Prioridade")}
|
||||
<Field label="Quantidade">
|
||||
<input
|
||||
className={input}
|
||||
type="number"
|
||||
min="0"
|
||||
step="0.01"
|
||||
disabled={readonly}
|
||||
value={need.quantity ?? ""}
|
||||
onChange={(e) =>
|
||||
updateNeed(index, {
|
||||
...need,
|
||||
quantity: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Prazo">
|
||||
<input
|
||||
className={input}
|
||||
type="date"
|
||||
disabled={readonly}
|
||||
value={need.deadline ?? ""}
|
||||
onChange={(e) =>
|
||||
updateNeed(index, {
|
||||
...need,
|
||||
deadline: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
{(
|
||||
[
|
||||
"description",
|
||||
"location",
|
||||
"observations",
|
||||
...(group === "labour"
|
||||
? [
|
||||
"qualification",
|
||||
"specialty",
|
||||
"experience",
|
||||
"certifications",
|
||||
"availability",
|
||||
"institution",
|
||||
]
|
||||
: []),
|
||||
...(group === "education"
|
||||
? [
|
||||
"qualification",
|
||||
"institution",
|
||||
"training_mode",
|
||||
"duration",
|
||||
"certifications",
|
||||
]
|
||||
: []),
|
||||
] as (keyof Need["details"])[]
|
||||
).map((field) => (
|
||||
<Field
|
||||
key={field}
|
||||
label={
|
||||
{
|
||||
description: "Descrição / especificação",
|
||||
location: "Localização",
|
||||
observations:
|
||||
"Observações e referência dos anexos de suporte",
|
||||
qualification: "Nível de qualificação",
|
||||
specialty: "Profissão / especialidade",
|
||||
experience: "Experiência",
|
||||
certifications: "Certificações",
|
||||
availability: "Disponibilidade",
|
||||
institution:
|
||||
"Instituições ou centros de formação",
|
||||
training_mode: "Modalidade de formação",
|
||||
duration: "Duração",
|
||||
status: "Estado",
|
||||
}[field]
|
||||
}
|
||||
>
|
||||
<textarea
|
||||
className={input}
|
||||
rows={2}
|
||||
disabled={readonly}
|
||||
value={need.details[field] ?? ""}
|
||||
onChange={(e) =>
|
||||
updateNeed(index, {
|
||||
...need,
|
||||
details: {
|
||||
...need.details,
|
||||
[field]: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
{!readonly && (
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
onClick={() =>
|
||||
form.setData(
|
||||
"needs",
|
||||
form.data.needs.filter((_, i) => i !== index),
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar esta necessidade
|
||||
</button>
|
||||
)}
|
||||
</fieldset>
|
||||
);
|
||||
})}
|
||||
{!readonly && (
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
disabled={form.data.needs.length >= 40}
|
||||
onClick={() =>
|
||||
form.setData("needs", [...form.data.needs, emptyNeed()])
|
||||
}
|
||||
>
|
||||
Acrescentar necessidade
|
||||
</button>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
{step === 3 && (
|
||||
<p>
|
||||
Guarde primeiro o rascunho e carregue os anexos no formulário abaixo.
|
||||
Identifique o nome do ficheiro nas observações da necessidade a que
|
||||
corresponde.
|
||||
</p>
|
||||
)}
|
||||
{step === 4 && (
|
||||
<section className="space-y-5">
|
||||
<h2 className="text-xl font-bold">Rever antes de enviar</h2>
|
||||
<dl className="space-y-3">
|
||||
{[
|
||||
["Investidor", form.data.payload.full_name],
|
||||
["Email", form.data.payload.email],
|
||||
["Organização", form.data.payload.organisation],
|
||||
["Objectivo", form.data.payload.objective],
|
||||
["Prazo", form.data.payload.horizon],
|
||||
["Necessidades", String(form.data.needs.length)],
|
||||
["Anexos", String(attachments.length)],
|
||||
].map(([label, value]) => (
|
||||
<div key={label}>
|
||||
<dt className="font-semibold">{label}</dt>
|
||||
<dd className="whitespace-pre-line">
|
||||
{value || "Não indicado"}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<label className="flex gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
disabled={readonly}
|
||||
checked={form.data.payload.contact_consent}
|
||||
onChange={(e) => update("contact_consent", e.target.checked)}
|
||||
/>
|
||||
Autorizo o tratamento destes dados e o contacto pela equipa para
|
||||
analisar e acompanhar esta manifestação. Os anexos são privados. Não
|
||||
constitui consentimento para utilização em IA.
|
||||
</label>
|
||||
</section>
|
||||
)}
|
||||
{r.options.some(
|
||||
(o) =>
|
||||
o.requires_description &&
|
||||
[
|
||||
form.data.payload.profile_id,
|
||||
form.data.payload.participation_id,
|
||||
form.data.payload.partnership_id,
|
||||
]
|
||||
.map(String)
|
||||
.includes(String(o.id)),
|
||||
) &&
|
||||
text(
|
||||
"other_details",
|
||||
"Outro — especifique o perfil, participação ou parceria seleccionados",
|
||||
true,
|
||||
)}
|
||||
{Object.entries(form.errors).map(([key, value]) => (
|
||||
<p key={key} role="alert" className="text-red-700">
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
onClick={() => setStep(errorStep(key))}
|
||||
>
|
||||
Corrigir na etapa {errorStep(key) + 1}
|
||||
</button>
|
||||
: {value}
|
||||
</p>
|
||||
))}
|
||||
{note && <p role="status">{note}</p>}
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{step > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
onClick={() => setStep(step - 1)}
|
||||
>
|
||||
Anterior
|
||||
</button>
|
||||
)}
|
||||
{step < 4 && (
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() => {
|
||||
setNote("");
|
||||
setStep(step + 1);
|
||||
}}
|
||||
>
|
||||
Continuar
|
||||
</button>
|
||||
)}
|
||||
{!readonly && (
|
||||
<button
|
||||
formNoValidate
|
||||
className="rounded border px-4 py-2"
|
||||
disabled={form.processing}
|
||||
>
|
||||
Guardar rascunho
|
||||
</button>
|
||||
)}
|
||||
{step === 4 && !readonly && (
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
disabled={form.processing || !form.data.payload.contact_consent}
|
||||
onClick={() =>
|
||||
form.post(base + "/submit", {
|
||||
preserveScroll: true,
|
||||
onError: (errors) =>
|
||||
setStep(errorStep(Object.keys(errors)[0] ?? "")),
|
||||
})
|
||||
}
|
||||
>
|
||||
Submeter manifestação
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
{step === 3 && (
|
||||
<section className={card + " space-y-4"}>
|
||||
<h2 className="text-xl font-bold">Anexos privados</h2>
|
||||
<p>
|
||||
PDF ou TXT, até 10 MiB cada, máximo de dez anexos. Guardar um anexo
|
||||
actualiza a versão do rascunho.
|
||||
</p>
|
||||
{attachments.map((a) => (
|
||||
<p key={a.id}>
|
||||
<a className="underline" href={base + "/attachments/" + a.id}>
|
||||
{a.file_name}
|
||||
</a>
|
||||
</p>
|
||||
))}
|
||||
{!readonly && (
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
if (form.isDirty) {
|
||||
setNote(
|
||||
"Guarde as alterações do formulário antes de carregar o anexo.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
upload.post(base + "/attachments", {
|
||||
forceFormData: true,
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Field label="Documento de suporte">
|
||||
<input
|
||||
type="file"
|
||||
accept="application/pdf,text/plain"
|
||||
required
|
||||
onChange={(e) =>
|
||||
upload.setData("file", e.target.files?.[0] ?? null)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{Object.entries(upload.errors).map(([key, value]) => (
|
||||
<p role="alert" key={key}>
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={upload.processing}>
|
||||
Carregar anexo
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
<details className={card}>
|
||||
<summary className="cursor-pointer font-bold">Histórico do pedido</summary>
|
||||
<ol className="mt-3 space-y-2">
|
||||
{events.map((e, i) => (
|
||||
<li key={i}>
|
||||
{new Date(e.created_at).toLocaleString("pt-MZ")} —{" "}
|
||||
{(
|
||||
{
|
||||
draft_created: "Rascunho criado",
|
||||
draft_saved: "Rascunho guardado",
|
||||
attachment_added: "Anexo acrescentado",
|
||||
submitted: "Submetido",
|
||||
} as Record<string, string>
|
||||
)[e.action] ?? e.action}{" "}
|
||||
· versão {e.version}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</details>
|
||||
<Conversation
|
||||
id={s.id}
|
||||
messages={messages}
|
||||
revisions={revisions}
|
||||
submitted={s.status === "submitted"}
|
||||
/>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import { Link, router } from "@inertiajs/react";
|
||||
import { Frame, card, button } from "./shared";
|
||||
export default function Workspace({
|
||||
submissions,
|
||||
favourites,
|
||||
}: {
|
||||
submissions: {
|
||||
data: {
|
||||
id: string;
|
||||
status: string;
|
||||
reference: string | null;
|
||||
request_status: string | null;
|
||||
created_at: string;
|
||||
}[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
favourites: { id: number; title: string; slug: string }[];
|
||||
}) {
|
||||
const states: Record<string, string> = {
|
||||
received: "Recebido",
|
||||
in_review: "Em análise",
|
||||
contacted: "Contactado",
|
||||
closed: "Encerrado",
|
||||
};
|
||||
return (
|
||||
<Frame title="Área do investidor">
|
||||
<nav className="flex flex-wrap gap-4">
|
||||
<Link href="/investidor/profile" className="underline">
|
||||
Perfil e empresas
|
||||
</Link>
|
||||
<Link href="/investidor/notifications" className="underline">
|
||||
Notificações
|
||||
</Link>
|
||||
<Link href="/investidor" className="underline">
|
||||
Fichas territoriais guardadas
|
||||
</Link>
|
||||
<Link href="/balcao-virtual" className="underline">
|
||||
Apoio e parcerias
|
||||
</Link>
|
||||
</nav>
|
||||
<button className={button} onClick={() => router.post("/investidor/manifestacoes")}>
|
||||
Preparar nova manifestação
|
||||
</button>
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-2xl font-bold">Rascunhos e manifestações</h2>
|
||||
{submissions.data.map((s) => (
|
||||
<article className={card} key={s.id}>
|
||||
<Link
|
||||
href={`/investidor/manifestacoes/${s.id}`}
|
||||
className="font-semibold underline"
|
||||
>
|
||||
{s.reference ?? "Continuar rascunho"}
|
||||
</Link>
|
||||
<p>
|
||||
{s.status === "draft"
|
||||
? "Rascunho privado"
|
||||
: (states[s.request_status ?? ""] ?? s.request_status)}
|
||||
</p>
|
||||
<p>{new Date(s.created_at).toLocaleDateString("pt-MZ")}</p>
|
||||
</article>
|
||||
))}
|
||||
{!submissions.data.length && <p>Ainda não existem manifestações neste percurso.</p>}
|
||||
<nav aria-label="Paginação" className="flex gap-4">
|
||||
{submissions.prev_page_url && (
|
||||
<Link href={submissions.prev_page_url}>Anterior</Link>
|
||||
)}
|
||||
{submissions.next_page_url && (
|
||||
<Link href={submissions.next_page_url}>Seguinte</Link>
|
||||
)}
|
||||
</nav>
|
||||
</section>
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-2xl font-bold">Oportunidades favoritas</h2>
|
||||
{favourites.map((f) => (
|
||||
<Link href={`/oportunidades/${f.slug}`} className={card + " block"} key={f.id}>
|
||||
{f.title}
|
||||
</Link>
|
||||
))}
|
||||
{!favourites.length && (
|
||||
<p>Explore o catálogo e guarde as oportunidades que pretende acompanhar.</p>
|
||||
)}
|
||||
</section>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { useState } from "react";
|
||||
import { api, button, card } from "./shared";
|
||||
|
||||
type Feature = {
|
||||
id: string;
|
||||
geometry: { type: string; coordinates: unknown[] };
|
||||
properties: { purpose: string; source: string; observed_at: string };
|
||||
};
|
||||
function rings(value: unknown): number[][][] {
|
||||
if (!Array.isArray(value) || !value.length) return [];
|
||||
if (typeof value[0] === "number") return [[value as number[]]];
|
||||
if (Array.isArray(value[0]) && typeof value[0][0] === "number") return [value as number[][]];
|
||||
return value.flatMap(rings);
|
||||
}
|
||||
export default function ZoneMap({ id }: { id: string }) {
|
||||
const [features, setFeatures] = useState<Feature[] | null>(null);
|
||||
const [error, setError] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const points = (features ?? []).flatMap((f) => rings(f.geometry.coordinates).flat());
|
||||
const xs = points.map((p) => p[0]),
|
||||
ys = points.map((p) => p[1]);
|
||||
const west = xs.length ? Math.min(...xs) : 0,
|
||||
south = ys.length ? Math.min(...ys) : 0;
|
||||
const dx = xs.length ? Math.max(...xs) - west : 1,
|
||||
dy = ys.length ? Math.max(...ys) - south : 1;
|
||||
const project = (p: number[]) => [
|
||||
20 + ((p[0] - west) / (dx || 1)) * 600,
|
||||
300 - ((p[1] - south) / (dy || 1)) * 280,
|
||||
];
|
||||
return (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Localização e geometrias autorizadas</h2>
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={async () => {
|
||||
setBusy(true);
|
||||
setError("");
|
||||
try {
|
||||
const data = await api(`/api/v2/investment/zone-map?zone_id=${id}`);
|
||||
setFeatures(data.features);
|
||||
if (data.truncated) setError("Exibidas as primeiras 100 geometrias.");
|
||||
} catch {
|
||||
setError(
|
||||
"Mapa indisponível. A ficha, a localização textual e as acções de apoio continuam disponíveis.",
|
||||
);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{busy ? "A carregar…" : "Consultar mapa"}
|
||||
</button>
|
||||
{error && <p role="status">{error}</p>}
|
||||
{features?.length === 0 && (
|
||||
<p>Não existe geometria autorizada para divulgação nesta ficha.</p>
|
||||
)}
|
||||
{!!features?.length && (
|
||||
<>
|
||||
<p>
|
||||
Esquema das geometrias cadastradas, sem mapa-base. Não serve para demarcação
|
||||
ou atribuição de estatuto.
|
||||
</p>
|
||||
<svg
|
||||
viewBox="0 0 640 320"
|
||||
className="w-full rounded border bg-slate-50"
|
||||
role="img"
|
||||
aria-label="Esquema das geometrias autorizadas da zona"
|
||||
>
|
||||
{features.map((f) => (
|
||||
<g key={f.id}>
|
||||
<title>
|
||||
{f.properties.purpose} · {f.properties.source}
|
||||
</title>
|
||||
{rings(f.geometry.coordinates).map((ring, i) =>
|
||||
ring.length === 1 ? (
|
||||
<circle
|
||||
key={i}
|
||||
cx={project(ring[0])[0]}
|
||||
cy={project(ring[0])[1]}
|
||||
r="5"
|
||||
fill="#065f46"
|
||||
/>
|
||||
) : (
|
||||
<polyline
|
||||
key={i}
|
||||
points={ring.map((p) => project(p).join(",")).join(" ")}
|
||||
fill="none"
|
||||
stroke="#065f46"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</g>
|
||||
))}
|
||||
</svg>
|
||||
<ul>
|
||||
{features.map((f) => (
|
||||
<li key={f.id}>
|
||||
{f.properties.purpose} · Fonte: {f.properties.source} · Data:{" "}
|
||||
{f.properties.observed_at}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
import { Field, input, button, card } from "./shared";
|
||||
|
||||
export type ZoneTargets = {
|
||||
opportunities: { id: number; title: string }[];
|
||||
dossiers: {
|
||||
id: string;
|
||||
title: string;
|
||||
project_id: string | null;
|
||||
cluster_id: string | null;
|
||||
corridor_id: string | null;
|
||||
}[];
|
||||
};
|
||||
type Review = {
|
||||
id: string;
|
||||
version_no: number;
|
||||
validation_status: string;
|
||||
association_type?: string;
|
||||
purpose?: string;
|
||||
};
|
||||
type Props = {
|
||||
id: string;
|
||||
targets: ZoneTargets;
|
||||
sources: { id: string; title: string }[];
|
||||
relations: Review[];
|
||||
geometries: Review[];
|
||||
busy: boolean;
|
||||
action: (url: string, data: unknown) => Promise<void>;
|
||||
};
|
||||
export default function ZoneRelations({
|
||||
id,
|
||||
targets,
|
||||
sources,
|
||||
relations,
|
||||
geometries,
|
||||
busy,
|
||||
action,
|
||||
}: Props) {
|
||||
return (
|
||||
<>
|
||||
<form
|
||||
className={card + " grid gap-4 md:grid-cols-2"}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const data = Object.fromEntries(new FormData(e.currentTarget));
|
||||
if (typeof data.target !== "string") return;
|
||||
const [kind, target] = data.target.split(":");
|
||||
delete data.target;
|
||||
void action(
|
||||
`/api/v2/investment/admin/zones/${id}/${kind === "opportunity_id" ? "links" : "relations"}`,
|
||||
{ ...data, [kind]: target },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold md:col-span-2">
|
||||
Associar investimento ou território
|
||||
</h2>
|
||||
<Field label="Registo existente">
|
||||
<select className={input} name="target" required>
|
||||
<option value="">Seleccionar</option>
|
||||
{targets.opportunities.map((o) => (
|
||||
<option key={o.id} value={`opportunity_id:${o.id}`}>
|
||||
{o.title} · oportunidade
|
||||
</option>
|
||||
))}
|
||||
{targets.dossiers.map((d) => {
|
||||
const field = d.project_id
|
||||
? "project_id"
|
||||
: d.cluster_id
|
||||
? "cluster_id"
|
||||
: "corridor_id";
|
||||
return (
|
||||
<option key={d.id} value={`${field}:${d[field]}`}>
|
||||
{d.title} · ficha territorial
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Tipo de associação">
|
||||
<select className={input} name="association_type">
|
||||
<option value="potential">Potencial</option>
|
||||
<option value="official">Oficial, com título próprio</option>
|
||||
<option value="influence">Área de influência</option>
|
||||
<option value="proximity">Proximidade geográfica</option>
|
||||
<option value="historical">Histórica</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Papel">
|
||||
<select className={input} name="role">
|
||||
<option value="related">Relacionada</option>
|
||||
<option value="primary">Principal</option>
|
||||
<option value="beneficiary">Beneficiária</option>
|
||||
<option value="served">Servida</option>
|
||||
<option value="enabled">Habilitada</option>
|
||||
<option value="dependent">Dependente</option>
|
||||
<option value="potential">Potencial</option>
|
||||
<option value="historical">Histórica</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Fonte jurídica, obrigatória para associação oficial">
|
||||
<select name="legal_source_id" className={input}>
|
||||
<option value="">Não aplicável à relação proposta</option>
|
||||
{sources.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Fonte da relação">
|
||||
<input
|
||||
name="source_reference"
|
||||
className={input}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={2000}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Justificação">
|
||||
<textarea
|
||||
name="justification"
|
||||
className={input}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={3000}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Válida desde">
|
||||
<input name="valid_from" type="date" className={input} required />
|
||||
</Field>
|
||||
<Field label="Válida até">
|
||||
<input name="valid_until" type="date" className={input} />
|
||||
</Field>
|
||||
<button disabled={busy} className={button}>
|
||||
Submeter associação para revisão
|
||||
</button>
|
||||
</form>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Relações territoriais</h2>
|
||||
{relations.map((r) => (
|
||||
<p key={r.id}>
|
||||
{r.association_type} · {r.validation_status}{" "}
|
||||
<button
|
||||
disabled={busy || r.validation_status === "revoked"}
|
||||
className={button}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/v2/investment/admin/zone-relations/${r.id}/${r.validation_status === "pending" ? "validate" : "revoke"}`,
|
||||
{ version_no: r.version_no },
|
||||
)
|
||||
}
|
||||
>
|
||||
{r.validation_status === "pending" ? "Validar" : "Revogar"}
|
||||
</button>
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
<form
|
||||
className={card + " grid gap-4 md:grid-cols-2"}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const data = Object.fromEntries(new FormData(e.currentTarget));
|
||||
if (typeof data.geometry !== "string") return;
|
||||
const raw = data.geometry;
|
||||
try {
|
||||
data.geometry = JSON.parse(raw);
|
||||
void action(`/api/v2/investment/admin/zones/${id}/geometries`, data);
|
||||
} catch {
|
||||
const field = e.currentTarget.elements.namedItem(
|
||||
"geometry",
|
||||
) as HTMLTextAreaElement;
|
||||
field.setCustomValidity("Introduza GeoJSON válido.");
|
||||
field.reportValidity();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold md:col-span-2">Geometria para revisão GIS</h2>
|
||||
<p>
|
||||
GeoJSON no SRID 4326, até 200 KB. Não desenhe um perímetro sem fonte autorizada.
|
||||
</p>
|
||||
<Field label="GeoJSON">
|
||||
<textarea
|
||||
name="geometry"
|
||||
className={input}
|
||||
required
|
||||
onChange={(e) => e.currentTarget.setCustomValidity("")}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Finalidade">
|
||||
<select name="purpose" className={input}>
|
||||
<option value="site">Localização</option>
|
||||
<option value="influence">Área de influência</option>
|
||||
<option value="alternative">Alternativa</option>
|
||||
<option value="official_perimeter">Perímetro oficial</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Fonte jurídica do perímetro">
|
||||
<select name="legal_source_id" className={input}>
|
||||
<option value="">Por confirmar</option>
|
||||
{sources.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Proveniência da geometria">
|
||||
<input className={input} name="source_reference" required minLength={10} />
|
||||
</Field>
|
||||
<Field label="Entidade indicada para validação">
|
||||
<input className={input} name="validating_entity" required />
|
||||
</Field>
|
||||
<Field label="Data da observação">
|
||||
<input className={input} type="date" name="observed_at" required />
|
||||
</Field>
|
||||
<button disabled={busy} className={button}>
|
||||
Submeter geometria
|
||||
</button>
|
||||
</form>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Revisão GIS</h2>
|
||||
{geometries.map((g) => (
|
||||
<p key={g.id}>
|
||||
{g.purpose} · {g.validation_status}{" "}
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy || g.validation_status === "revoked"}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/v2/investment/admin/zone-geometries/${g.id}/${g.validation_status === "pending" ? "validate" : "revoke"}`,
|
||||
{ version_no: g.version_no },
|
||||
)
|
||||
}
|
||||
>
|
||||
{g.validation_status === "pending"
|
||||
? "Validar e autorizar divulgação"
|
||||
: "Retirar geometria"}
|
||||
</button>
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
import { Link, router, useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Frame, Field, input, button, card, api } from "./shared";
|
||||
import ZoneRelations from "./zone-relations";
|
||||
import ZoneMap from "./zone-map";
|
||||
import type { ZoneTargets } from "./zone-relations";
|
||||
|
||||
type Zone = {
|
||||
id: string;
|
||||
version_no: number;
|
||||
code: string;
|
||||
category: string;
|
||||
name: string;
|
||||
name_en: string | null;
|
||||
description: string | null;
|
||||
description_en: string | null;
|
||||
province: string | null;
|
||||
district: string | null;
|
||||
operator_id?: string;
|
||||
legal_source_id?: string;
|
||||
publication_status?: string;
|
||||
validation_status: string;
|
||||
};
|
||||
type Source = {
|
||||
id: string;
|
||||
title: string;
|
||||
url: string;
|
||||
diploma: string;
|
||||
article: string;
|
||||
competent_entity: string;
|
||||
valid_from: string;
|
||||
valid_until: string | null;
|
||||
version_no: number;
|
||||
validation_status: string;
|
||||
};
|
||||
type Props = {
|
||||
targets: ZoneTargets | null;
|
||||
related: { id: string; title: string }[];
|
||||
relations: {
|
||||
id: string;
|
||||
version_no: number;
|
||||
association_type: string;
|
||||
validation_status: string;
|
||||
}[];
|
||||
geometries: { id: string; version_no: number; purpose: string; validation_status: string }[];
|
||||
record: Zone;
|
||||
management: boolean;
|
||||
source: Source | null;
|
||||
operator: string | null;
|
||||
operators: { id: string; name: string }[];
|
||||
legalSources: Source[];
|
||||
links: {
|
||||
id: string;
|
||||
item_id: string;
|
||||
association_type: string;
|
||||
validation_status: string;
|
||||
version_no: number;
|
||||
}[];
|
||||
revisions: { version_no: number; action: string; created_at: string }[];
|
||||
opportunities: {
|
||||
data: { id: number; title: string; slug: string }[];
|
||||
next_page_url: string | null;
|
||||
prev_page_url: string | null;
|
||||
} | null;
|
||||
};
|
||||
export default function ZonePage(props: Props) {
|
||||
return <Editor key={`${props.record.id}:${props.record.version_no}`} {...props} />;
|
||||
}
|
||||
function Editor({
|
||||
targets,
|
||||
related,
|
||||
relations,
|
||||
geometries,
|
||||
record: z,
|
||||
management,
|
||||
source,
|
||||
operator,
|
||||
operators,
|
||||
legalSources,
|
||||
links,
|
||||
revisions,
|
||||
opportunities,
|
||||
}: Props) {
|
||||
const [message, setMessage] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const form = useForm({
|
||||
version_no: z.version_no,
|
||||
code: z.code,
|
||||
category: z.category,
|
||||
name: z.name,
|
||||
name_en: z.name_en ?? "",
|
||||
description: z.description ?? "",
|
||||
description_en: z.description_en ?? "",
|
||||
province: z.province ?? "",
|
||||
district: z.district ?? "",
|
||||
operator_id: z.operator_id ?? "",
|
||||
legal_source_id: z.legal_source_id ?? "",
|
||||
});
|
||||
async function action(url: string, data: unknown) {
|
||||
setBusy(true);
|
||||
setMessage("");
|
||||
try {
|
||||
await api(url, data);
|
||||
router.reload();
|
||||
} catch (e) {
|
||||
setMessage(e instanceof Error ? e.message : "Falha na operação.");
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Frame title={z.name}>
|
||||
<p>
|
||||
{z.code} · {z.category.toUpperCase()} · {z.validation_status} · {z.province}{" "}
|
||||
{z.district}
|
||||
</p>
|
||||
<p>
|
||||
A ficha é informativa. A associação territorial não atribui benefícios, licenças ou
|
||||
autorização aduaneira.
|
||||
</p>
|
||||
{message && (
|
||||
<p role="alert" className={card}>
|
||||
{message}
|
||||
</p>
|
||||
)}
|
||||
{management ? (
|
||||
<>
|
||||
<form
|
||||
className={card + " grid gap-4 md:grid-cols-2"}
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
setBusy(true);
|
||||
setMessage("");
|
||||
try {
|
||||
await api(`/api/v2/investment/admin/zones/${z.id}`, {
|
||||
...form.data,
|
||||
_method: "PUT",
|
||||
});
|
||||
router.reload();
|
||||
} catch (failure) {
|
||||
setMessage(
|
||||
failure instanceof Error
|
||||
? failure.message
|
||||
: "Falha ao guardar.",
|
||||
);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{(
|
||||
[
|
||||
["code", "Código"],
|
||||
["name", "Nome PT"],
|
||||
["name_en", "Nome EN"],
|
||||
["province", "Província"],
|
||||
["district", "Distrito"],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<Field key={key} label={label}>
|
||||
<input
|
||||
className={input}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Categoria">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.category}
|
||||
onChange={(e) => form.setData("category", e.target.value)}
|
||||
>
|
||||
<option value="pending">Pendente</option>
|
||||
<option value="zee">ZEE</option>
|
||||
<option value="zfi">ZFI</option>
|
||||
<option value="industrial_park">Parque industrial</option>
|
||||
</select>
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
["description", "Descrição PT"],
|
||||
["description_en", "Descrição EN"],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<Field key={key} label={label}>
|
||||
<textarea
|
||||
className={input}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Operador cadastrado">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.operator_id}
|
||||
onChange={(e) => form.setData("operator_id", e.target.value)}
|
||||
>
|
||||
<option value="">Por confirmar</option>
|
||||
{operators.map((o) => (
|
||||
<option key={o.id} value={o.id}>
|
||||
{o.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Fonte jurídica">
|
||||
<select
|
||||
className={input}
|
||||
value={form.data.legal_source_id}
|
||||
onChange={(e) => form.setData("legal_source_id", e.target.value)}
|
||||
>
|
||||
<option value="">Por confirmar</option>
|
||||
{legalSources.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.title} · {s.validation_status}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button disabled={busy} className={button}>
|
||||
Guardar rascunho
|
||||
</button>
|
||||
</form>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Revisão independente</h2>
|
||||
<p>
|
||||
Versão {z.version_no}. Outra pessoa gestora deve rever antes da
|
||||
publicação. Guarde primeiro as alterações.
|
||||
</p>
|
||||
<div className="flex gap-4">
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy || form.isDirty}
|
||||
onClick={() =>
|
||||
action(`/api/v2/investment/admin/zones/${z.id}/publish`, {
|
||||
version_no: z.version_no,
|
||||
})
|
||||
}
|
||||
>
|
||||
Validar e publicar
|
||||
</button>
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={() =>
|
||||
action(`/api/v2/investment/admin/zones/${z.id}/suspend`, {
|
||||
version_no: z.version_no,
|
||||
})
|
||||
}
|
||||
>
|
||||
Suspender publicação
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Fontes por rever</h2>
|
||||
{legalSources.map((s) => (
|
||||
<article key={s.id} className="my-4">
|
||||
<p>
|
||||
{s.title} · {s.diploma} · {s.article} · {s.validation_status}
|
||||
</p>
|
||||
<a
|
||||
className="underline"
|
||||
href={s.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Consultar documento
|
||||
</a>
|
||||
<div className="flex gap-4">
|
||||
{s.validation_status === "pending" && (
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/v2/investment/admin/legal-sources/${s.id}/validate`,
|
||||
{ version_no: s.version_no },
|
||||
)
|
||||
}
|
||||
>
|
||||
Validar fonte
|
||||
</button>
|
||||
)}
|
||||
{s.validation_status !== "revoked" && (
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/v2/investment/admin/legal-sources/${s.id}/revoke`,
|
||||
{ version_no: s.version_no },
|
||||
)
|
||||
}
|
||||
>
|
||||
Revogar referência
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
<form
|
||||
className={card + " grid gap-4 md:grid-cols-2"}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
void action(
|
||||
"/api/v2/investment/admin/legal-sources",
|
||||
Object.fromEntries(new FormData(e.currentTarget)),
|
||||
);
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold md:col-span-2">Registar fonte jurídica</h2>
|
||||
{(
|
||||
[
|
||||
["title", "Título", "text"],
|
||||
["url", "URL HTTPS", "url"],
|
||||
["diploma", "Diploma", "text"],
|
||||
["article", "Artigo", "text"],
|
||||
[
|
||||
"competent_entity",
|
||||
"Entidade competente indicada no diploma",
|
||||
"text",
|
||||
],
|
||||
["valid_from", "Início de vigência", "date"],
|
||||
["valid_until", "Fim de vigência, se aplicável", "date"],
|
||||
] as const
|
||||
).map(([name, label, type]) => (
|
||||
<Field key={name} label={label}>
|
||||
<input
|
||||
className={input}
|
||||
name={name}
|
||||
type={type}
|
||||
required={name !== "valid_until"}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<button className={button} disabled={busy}>
|
||||
Registar para revisão
|
||||
</button>
|
||||
</form>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Associações para revisão</h2>
|
||||
{links.map((l) => (
|
||||
<div key={l.id}>
|
||||
<p>
|
||||
{l.item_id} · {l.association_type} · {l.validation_status}
|
||||
</p>
|
||||
<button
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/v2/investment/admin/zone-links/${l.id}/${l.validation_status === "pending" ? "validate" : "revoke"}`,
|
||||
{ version_no: l.version_no },
|
||||
)
|
||||
}
|
||||
>
|
||||
{l.validation_status === "pending"
|
||||
? "Validar associação"
|
||||
: "Revogar associação"}
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Histórico editorial</h2>
|
||||
{revisions.map((r) => (
|
||||
<p key={r.version_no}>
|
||||
Versão {r.version_no} · {r.action} · {r.created_at}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
{targets && (
|
||||
<ZoneRelations
|
||||
id={z.id}
|
||||
targets={targets}
|
||||
sources={legalSources}
|
||||
relations={relations}
|
||||
geometries={geometries}
|
||||
busy={busy}
|
||||
action={action}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="whitespace-pre-line">{z.description}</p>
|
||||
<ZoneMap id={z.id} />
|
||||
{z.description_en && (
|
||||
<details>
|
||||
<summary>English description</summary>
|
||||
<p lang="en" className="whitespace-pre-line">
|
||||
{z.description_en}
|
||||
</p>
|
||||
</details>
|
||||
)}
|
||||
<p>Operador: {operator ?? "Informação pública por disponibilizar"}</p>
|
||||
{source && (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Fonte e vigência</h2>
|
||||
<a
|
||||
className="underline"
|
||||
href={source.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{source.title}
|
||||
</a>
|
||||
<p>
|
||||
{source.diploma} · {source.article} · {source.competent_entity}
|
||||
</p>
|
||||
<p>
|
||||
{source.valid_from} —{" "}
|
||||
{source.valid_until ?? "Sem fim indicado na referência"} · Versão{" "}
|
||||
{source.version_no}
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Investimentos relacionados</h2>
|
||||
{opportunities?.data.map((o) => (
|
||||
<p key={o.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/oportunidades/${o.slug}?zone_id=${z.id}`}
|
||||
>
|
||||
{o.title}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
{!opportunities?.data.length && (
|
||||
<p>Sem investimentos publicados associados.</p>
|
||||
)}
|
||||
<nav aria-label="Paginação">
|
||||
{opportunities?.prev_page_url && (
|
||||
<Link href={opportunities.prev_page_url}>Anterior</Link>
|
||||
)}{" "}
|
||||
{opportunities?.next_page_url && (
|
||||
<Link href={opportunities.next_page_url}>Seguinte</Link>
|
||||
)}
|
||||
</nav>
|
||||
</section>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{(
|
||||
[
|
||||
["interest", "Manifestar interesse"],
|
||||
["dossier", "Solicitar dossier"],
|
||||
["meeting", "Pedir reunião"],
|
||||
] as const
|
||||
).map(([intent, label]) => (
|
||||
<button
|
||||
key={intent}
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post("/investidor/manifestacoes", {
|
||||
zone_id: z.id,
|
||||
intent,
|
||||
})
|
||||
}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<p>
|
||||
Pedido assistido com conta e consentimento. Não inicia prazo de decisão
|
||||
administrativa nem confirma uma reunião.
|
||||
</p>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">
|
||||
Clusters, corredores e projectos relacionados
|
||||
</h2>
|
||||
{related.map((r) => (
|
||||
<p key={r.id}>
|
||||
<Link className="underline" href={`/carteira/${r.id}`}>
|
||||
{r.title}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
{!related.length && <p>Sem relações territoriais publicadas.</p>}
|
||||
</section>
|
||||
</>
|
||||
)}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import { Link, router } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Frame, Field, input, button, card, api } from "./shared";
|
||||
|
||||
type Zone = {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
category: string;
|
||||
description: string | null;
|
||||
province: string | null;
|
||||
version_no: number;
|
||||
publication_status: string;
|
||||
validation_status: string;
|
||||
};
|
||||
export default function Zones({
|
||||
records,
|
||||
filters,
|
||||
management,
|
||||
}: {
|
||||
records: {
|
||||
data: Zone[];
|
||||
total: number;
|
||||
next_page_url: string | null;
|
||||
prev_page_url: string | null;
|
||||
};
|
||||
filters: { q?: string; category?: string };
|
||||
management: boolean;
|
||||
}) {
|
||||
const [error, setError] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
return (
|
||||
<Frame
|
||||
title={management ? "Gestão de ZEE, ZFI e parques" : "ZEE, ZFI e parques industriais"}
|
||||
>
|
||||
<p>
|
||||
A informação territorial não atribui benefícios nem substitui certificados ou
|
||||
decisões das entidades competentes.
|
||||
</p>
|
||||
<nav aria-label="Dimensões de investimento" className="flex flex-wrap gap-4 underline">
|
||||
<Link href="/clusters">Por Cluster</Link>
|
||||
<Link href="/corredores">Por Corredor</Link>
|
||||
<Link href="/zonas?category=zee">Por ZEE</Link>
|
||||
<Link href="/zonas?category=zfi">Por ZFI</Link>
|
||||
<Link href="/zonas?category=industrial_park">Parques industriais</Link>
|
||||
</nav>
|
||||
<form method="get" className={card + " grid gap-4 md:grid-cols-3"}>
|
||||
<Field label="Pesquisar por nome ou código">
|
||||
<input className={input} name="q" defaultValue={filters.q} maxLength={120} />
|
||||
</Field>
|
||||
<Field label="Categoria">
|
||||
<select className={input} name="category" defaultValue={filters.category ?? ""}>
|
||||
<option value="">Todas</option>
|
||||
<option value="zee">ZEE</option>
|
||||
<option value="zfi">ZFI</option>
|
||||
<option value="industrial_park">Parque industrial</option>
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
<p role="status">{records.total} registos disponíveis</p>
|
||||
{!records.total && (
|
||||
<p className={card}>
|
||||
Sem registos disponíveis para estes filtros. As zonas aguardam cadastro e
|
||||
validação documental.
|
||||
</p>
|
||||
)}
|
||||
{records.data.map((zone) => (
|
||||
<article className={card} key={zone.id}>
|
||||
<h2 className="text-xl font-bold">
|
||||
<Link
|
||||
className="underline"
|
||||
href={`${management ? "/management/investment/zones" : "/zonas"}/${zone.id}`}
|
||||
>
|
||||
{zone.name}
|
||||
</Link>
|
||||
</h2>
|
||||
<p>
|
||||
{zone.code} · {zone.category.toUpperCase()} ·{" "}
|
||||
{zone.province ?? "Localização por confirmar"}
|
||||
</p>
|
||||
<p>{zone.description}</p>
|
||||
<p>Validação: {zone.validation_status}</p>
|
||||
{management && (
|
||||
<p>
|
||||
Versão {zone.version_no} · {zone.publication_status}
|
||||
</p>
|
||||
)}
|
||||
</article>
|
||||
))}
|
||||
<nav aria-label="Paginação" className="flex gap-4 underline">
|
||||
{records.prev_page_url && <Link href={records.prev_page_url}>Anterior</Link>}
|
||||
{records.next_page_url && <Link href={records.next_page_url}>Seguinte</Link>}
|
||||
</nav>
|
||||
{management && (
|
||||
<form
|
||||
className={card + " space-y-4"}
|
||||
onSubmit={async (event) => {
|
||||
event.preventDefault();
|
||||
const data = Object.fromEntries(new FormData(event.currentTarget));
|
||||
setBusy(true);
|
||||
setError("");
|
||||
try {
|
||||
await api("/api/v2/investment/admin/zones", data);
|
||||
router.reload();
|
||||
} catch (failure) {
|
||||
setError(
|
||||
failure instanceof Error
|
||||
? failure.message
|
||||
: "Não foi possível guardar. Tente novamente.",
|
||||
);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold">Criar rascunho</h2>
|
||||
<Field label="Código">
|
||||
<input name="code" className={input} required maxLength={80} />
|
||||
</Field>
|
||||
<Field label="Nome">
|
||||
<input name="name" className={input} required maxLength={255} />
|
||||
</Field>
|
||||
<Field label="Categoria proposta">
|
||||
<select name="category" className={input}>
|
||||
<option value="pending">Pendente de enquadramento</option>
|
||||
<option value="zee">ZEE</option>
|
||||
<option value="zfi">ZFI</option>
|
||||
<option value="industrial_park">Parque industrial</option>
|
||||
</select>
|
||||
</Field>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
<button className={button} disabled={busy}>
|
||||
Guardar rascunho
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { Head, Link, usePage } from '@inertiajs/react';
|
||||
import type { Auth } from '@/types';
|
||||
|
||||
export default function ManagementAccess({
|
||||
registrationEnabled,
|
||||
}: {
|
||||
registrationEnabled: boolean;
|
||||
}) {
|
||||
const { auth } = usePage<{ auth: Auth }>().props;
|
||||
const user = auth.user;
|
||||
const action =
|
||||
'inline-flex rounded-lg bg-slate-900 px-5 py-3 font-medium text-white';
|
||||
return (
|
||||
<main className="min-h-screen bg-slate-50 px-5 py-12 text-slate-900">
|
||||
<Head title="Acesso à gestão" />
|
||||
<div className="mx-auto max-w-2xl space-y-6">
|
||||
<Link href="/" className="text-emerald-700 underline">
|
||||
Voltar ao portal
|
||||
</Link>
|
||||
<h1 className="text-3xl font-semibold">
|
||||
Acesso à gestão do portal
|
||||
</h1>
|
||||
<p>
|
||||
Pode configurar a sua conta quando estiver pronto. A
|
||||
consulta de oportunidades e o envio de manifestações de
|
||||
interesse continuam disponíveis no portal público.
|
||||
</p>
|
||||
<section className="space-y-4 rounded-xl border bg-white p-6">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{!user
|
||||
? 'Preparar a sua conta'
|
||||
: auth.canManagePortal
|
||||
? 'Acesso disponível'
|
||||
: !user.email_verified_at
|
||||
? 'Verificar o seu email'
|
||||
: 'Autorização pendente'}
|
||||
</h2>
|
||||
{!user ? (
|
||||
<>
|
||||
<p>
|
||||
Use o email autorizado pela equipa do portal.
|
||||
Depois de criar a conta, confirme o email
|
||||
através da ligação de verificação.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Link className={action} href="/login">
|
||||
Entrar
|
||||
</Link>
|
||||
{registrationEnabled && (
|
||||
<Link className={action} href="/register">
|
||||
Criar conta
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : auth.canManagePortal ? (
|
||||
<>
|
||||
<p>
|
||||
A sua conta tem acesso à gestão de pedidos,
|
||||
sectores e oportunidades.
|
||||
</p>
|
||||
<Link
|
||||
className={action}
|
||||
href="/management/interests"
|
||||
>
|
||||
Abrir gestão
|
||||
</Link>
|
||||
</>
|
||||
) : !user.email_verified_at ? (
|
||||
<>
|
||||
<p>
|
||||
Confirme o endereço de email da sua conta. A
|
||||
confirmação do email não atribui permissões de
|
||||
gestão automaticamente.
|
||||
</p>
|
||||
<Link className={action} href="/email/verify">
|
||||
Verificar email
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
A sua conta está verificada, mas ainda não tem
|
||||
autorização de gestão. Contacte o responsável
|
||||
pelo portal para confirmar o acesso.
|
||||
</p>
|
||||
<Link className={action} href="/settings/profile">
|
||||
Consultar a minha conta
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
<p>
|
||||
<Link href="/" className="text-emerald-700 underline">
|
||||
Configurar mais tarde e voltar ao portal
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Pagination, button, control, states } from './shared';
|
||||
import type { Paginated } from './shared';
|
||||
|
||||
type Record = {
|
||||
id: number;
|
||||
name?: string;
|
||||
title?: string;
|
||||
reference?: string;
|
||||
slug: string;
|
||||
is_active?: boolean;
|
||||
status?: string;
|
||||
};
|
||||
export default function Catalog({
|
||||
resource,
|
||||
records,
|
||||
filters,
|
||||
sectors,
|
||||
}: {
|
||||
resource: 'sectors' | 'opportunities';
|
||||
records: Paginated<Record>;
|
||||
filters: { q?: string; status?: string; sector_id?: number | string };
|
||||
sectors: { id: number; name: string }[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
q: filters.q ?? '',
|
||||
status: filters.status ?? '',
|
||||
sector_id: String(filters.sector_id ?? ''),
|
||||
});
|
||||
return (
|
||||
<Management
|
||||
title={resource === 'sectors' ? 'Sectores' : 'Oportunidades'}
|
||||
>
|
||||
<Link className={button} href={`/management/${resource}/create`}>
|
||||
Criar {resource === 'sectors' ? 'sector' : 'oportunidade'}
|
||||
</Link>
|
||||
<form
|
||||
className="flex flex-wrap gap-3"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.get(`/management/${resource}`, {
|
||||
preserveState: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<input
|
||||
aria-label="Pesquisar catálogo"
|
||||
placeholder="Nome, título, referência ou slug"
|
||||
className={`${control} max-w-sm`}
|
||||
value={form.data.q}
|
||||
onChange={(event) => form.setData('q', event.target.value)}
|
||||
maxLength={150}
|
||||
/>
|
||||
<select
|
||||
aria-label="Estado"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.status}
|
||||
onChange={(event) =>
|
||||
form.setData('status', event.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos os estados</option>
|
||||
{(resource === 'sectors'
|
||||
? ['active', 'inactive']
|
||||
: ['draft', 'published', 'archived']
|
||||
).map((status) => (
|
||||
<option key={status} value={status}>
|
||||
{status === 'active'
|
||||
? 'Activo'
|
||||
: status === 'inactive'
|
||||
? 'Inactivo'
|
||||
: states[status]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{resource === 'opportunities' && (
|
||||
<select
|
||||
aria-label="Sector"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.sector_id}
|
||||
onChange={(event) =>
|
||||
form.setData('sector_id', event.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos os sectores</option>
|
||||
{sectors.map((sector) => (
|
||||
<option key={sector.id} value={sector.id}>
|
||||
{sector.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Pesquisar
|
||||
</button>
|
||||
<Link
|
||||
className="p-2 underline"
|
||||
href={`/management/${resource}`}
|
||||
>
|
||||
Limpar filtros
|
||||
</Link>
|
||||
{Object.values(form.errors).map((error) => (
|
||||
<p key={error} role="alert" className="w-full text-red-600">
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
</form>
|
||||
<div className="space-y-3">
|
||||
{records.data.map((record) => (
|
||||
<article
|
||||
key={record.id}
|
||||
className="flex flex-wrap items-center justify-between gap-3 rounded border p-4"
|
||||
>
|
||||
<div>
|
||||
<h2 className="font-semibold">
|
||||
{record.name ?? record.title}
|
||||
</h2>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{record.reference ?? record.slug} ·{' '}
|
||||
{resource === 'sectors'
|
||||
? record.is_active
|
||||
? 'Activo'
|
||||
: 'Inactivo'
|
||||
: states[record.status ?? 'draft']}
|
||||
</p>
|
||||
</div>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/${resource}/${record.id}/edit`}
|
||||
>
|
||||
Editar
|
||||
</Link>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!records.data.length && <p>Nenhum registo encontrado.</p>}
|
||||
<Pagination page={records} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, button, control, states } from "./shared";
|
||||
|
||||
type Values = Record<string, string | boolean>;
|
||||
type Entry = Record<string, string | number | boolean | null> & { id: number };
|
||||
const opportunityFields = {
|
||||
reference: "Referência",
|
||||
title: "Título",
|
||||
slug: "Slug (endereço)",
|
||||
summary: "Resumo",
|
||||
description: "Descrição",
|
||||
province: "Província",
|
||||
district: "Distrito",
|
||||
promoter_name: "Promotor",
|
||||
promoter_type: "Tipo de promotor",
|
||||
estimated_investment_amount: "Investimento estimado",
|
||||
estimated_investment_currency: "Moeda (código de três letras)",
|
||||
financing_modality: "Modalidade de financiamento",
|
||||
expected_impact: "Impacto esperado",
|
||||
};
|
||||
const sectorFields = {
|
||||
name: "Nome",
|
||||
slug: "Slug (endereço)",
|
||||
short_description: "Descrição curta",
|
||||
description: "Descrição",
|
||||
sort_order: "Ordem de apresentação",
|
||||
};
|
||||
const maturities = [
|
||||
"Ideia identificada",
|
||||
"Pré-estudo disponível",
|
||||
"Estudo de viabilidade em curso",
|
||||
"Projecto estruturado",
|
||||
"Pronto para investimento",
|
||||
"Em negociação ou implementação",
|
||||
];
|
||||
|
||||
export default function Editor({
|
||||
resource,
|
||||
record,
|
||||
sectors,
|
||||
}: {
|
||||
resource: "sectors" | "opportunities";
|
||||
record: Entry | null;
|
||||
sectors: { id: number; name: string }[];
|
||||
}) {
|
||||
const isSector = resource === "sectors";
|
||||
const fields = isSector ? sectorFields : opportunityFields;
|
||||
const initial: Values = Object.fromEntries(
|
||||
Object.keys(fields).map((key) => [
|
||||
key,
|
||||
String(
|
||||
record?.[key] ??
|
||||
(key === "estimated_investment_currency"
|
||||
? "USD"
|
||||
: key === "sort_order"
|
||||
? "0"
|
||||
: ""),
|
||||
),
|
||||
]),
|
||||
);
|
||||
if (isSector) initial.is_active = Boolean(record?.is_active ?? true);
|
||||
else {
|
||||
initial.sector_id = String(record?.sector_id ?? "");
|
||||
initial.maturity_level = String(record?.maturity_level ?? "");
|
||||
initial.status = String(record?.status ?? "draft");
|
||||
initial.is_featured = Boolean(record?.is_featured ?? false);
|
||||
}
|
||||
const form = useForm<Values>(initial);
|
||||
return (
|
||||
<Management
|
||||
title={`${record ? "Editar" : "Criar"} ${isSector ? "sector" : "oportunidade"}`}
|
||||
>
|
||||
{!isSector && record && (
|
||||
<Link className="underline" href={`/management/opportunities/${record.id}/context`}>
|
||||
Gerir clusters, corredores, projectos, educação e necessidades
|
||||
</Link>
|
||||
)}
|
||||
<form
|
||||
className="max-w-3xl space-y-5"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
if (record) form.put(`/management/${resource}/${record.id}`);
|
||||
else form.post(`/management/${resource}`);
|
||||
}}
|
||||
>
|
||||
<fieldset disabled={form.processing} className="space-y-5">
|
||||
{Object.entries(fields).map(([key, label]) => (
|
||||
<Field key={key} label={label} error={form.errors[key]}>
|
||||
{[
|
||||
"description",
|
||||
"summary",
|
||||
"short_description",
|
||||
"expected_impact",
|
||||
].includes(key) ? (
|
||||
<textarea
|
||||
className={control}
|
||||
rows={key === "description" ? 6 : 3}
|
||||
value={String(form.data[key])}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
) : (
|
||||
<input
|
||||
className={control}
|
||||
value={String(form.data[key])}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
))}
|
||||
{!isSector && (
|
||||
<>
|
||||
<Field label="Sector" error={form.errors.sector_id}>
|
||||
<select
|
||||
className={control}
|
||||
value={String(form.data.sector_id)}
|
||||
onChange={(e) => form.setData("sector_id", e.target.value)}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{sectors.map((sector) => (
|
||||
<option key={sector.id} value={sector.id}>
|
||||
{sector.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Maturidade" error={form.errors.maturity_level}>
|
||||
<select
|
||||
className={control}
|
||||
value={String(form.data.maturity_level)}
|
||||
onChange={(e) => form.setData("maturity_level", e.target.value)}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
{maturities.map((label, index) => (
|
||||
<option key={label} value={index + 1}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Estado" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={String(form.data.status)}
|
||||
onChange={(e) => form.setData("status", e.target.value)}
|
||||
>
|
||||
{["draft", "published", "archived"].map((key) => (
|
||||
<option key={key} value={key}>
|
||||
{states[key]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
<Field
|
||||
label={isSector ? "Activo" : "Em destaque"}
|
||||
error={form.errors[isSector ? "is_active" : "is_featured"]}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={Boolean(form.data[isSector ? "is_active" : "is_featured"])}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
isSector ? "is_active" : "is_featured",
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<div className="flex gap-4">
|
||||
<button className={button} disabled={form.processing}>
|
||||
{form.processing ? "A guardar…" : "Guardar"}
|
||||
</button>
|
||||
<Link className="p-2 underline" href={`/management/${resource}`}>
|
||||
Cancelar
|
||||
</Link>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
import { Management, Pagination } from './shared';
|
||||
import type { Paginated } from './shared';
|
||||
|
||||
type Event = {
|
||||
id: string;
|
||||
entity_type: string;
|
||||
action: string;
|
||||
occurred_at: string;
|
||||
actor: string | null;
|
||||
before_data: { values: Record<string, unknown> };
|
||||
after_data: {
|
||||
record_id: number | string;
|
||||
changed_fields: string[];
|
||||
values: Record<string, unknown>;
|
||||
};
|
||||
};
|
||||
const entities: Record<string, string> = {
|
||||
investment_accounts: 'Perfil de investimento',
|
||||
investment_company_declarations: 'Declaração de empresa',
|
||||
investment_submissions: 'Manifestação de interesse',
|
||||
investment_messages: 'Mensagem de acompanhamento',
|
||||
investment_reference_options: 'Opção de formulário',
|
||||
opportunity_context: 'Contexto da oportunidade',
|
||||
sectors: 'Sector',
|
||||
opportunities: 'Oportunidade',
|
||||
interest_requests: 'Pedido',
|
||||
investors: 'Investidor',
|
||||
contacts: 'Contacto',
|
||||
leads: 'Lead',
|
||||
tasks: 'Tarefa',
|
||||
projects: 'Projecto',
|
||||
economic_clusters: 'Cluster',
|
||||
cluster_projects: 'Associação projecto–cluster',
|
||||
value_chains: 'Etapa da cadeia de valor',
|
||||
value_chain_links: 'Ligação entre etapas',
|
||||
investment_gaps: 'Lacuna de investimento',
|
||||
};
|
||||
const fields: Record<string, string> = {
|
||||
version: 'Versão',
|
||||
active: 'Activo',
|
||||
name: 'Nome',
|
||||
slug: 'Endereço',
|
||||
description: 'Descrição',
|
||||
short_description: 'Descrição curta',
|
||||
status: 'Estado',
|
||||
is_active: 'Activo',
|
||||
is_featured: 'Destaque',
|
||||
sort_order: 'Ordem',
|
||||
sector_id: 'Sector',
|
||||
maturity_level: 'Maturidade',
|
||||
maturity_label: 'Descrição da maturidade',
|
||||
estimated_investment_amount: 'Investimento',
|
||||
estimated_investment_currency: 'Moeda',
|
||||
reference: 'Referência',
|
||||
title: 'Título',
|
||||
summary: 'Resumo',
|
||||
province: 'Província',
|
||||
district: 'Distrito',
|
||||
promoter_name: 'Promotor',
|
||||
promoter_type: 'Tipo de promotor',
|
||||
financing_modality: 'Financiamento',
|
||||
expected_impact: 'Impacto',
|
||||
published_at: 'Publicação',
|
||||
reviewed_at: 'Data de revisão',
|
||||
reviewed_by: 'Responsável pela revisão',
|
||||
};
|
||||
function display(value: unknown): string {
|
||||
if (value === null || value === undefined) return '—';
|
||||
if (typeof value === 'boolean') return value ? 'Sim' : 'Não';
|
||||
if (typeof value === 'object') return JSON.stringify(value);
|
||||
if (typeof value === 'string') return value;
|
||||
if (typeof value === 'number') return value.toString();
|
||||
return '—';
|
||||
}
|
||||
export default function History({ events }: { events: Paginated<Event> }) {
|
||||
return (
|
||||
<Management title="Histórico de alterações">
|
||||
<p className="text-muted-foreground">
|
||||
Alterações efectuadas na gestão do portal. Os textos e contactos
|
||||
pessoais não são copiados para o histórico.
|
||||
</p>
|
||||
<div className="space-y-4">
|
||||
{events.data.map((event) => (
|
||||
<article
|
||||
key={event.id}
|
||||
className="space-y-2 rounded border p-4"
|
||||
>
|
||||
<h2 className="font-semibold break-words">
|
||||
{entities[event.entity_type] ?? event.entity_type} #
|
||||
{event.after_data.record_id} ·{' '}
|
||||
{event.action === 'created'
|
||||
? 'Criado'
|
||||
: 'Actualizado'}
|
||||
</h2>
|
||||
<p>
|
||||
{event.actor ?? 'Utilizador indisponível'} ·{' '}
|
||||
{new Intl.DateTimeFormat('pt-MZ', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
timeZone: 'Africa/Maputo',
|
||||
}).format(new Date(event.occurred_at))}{' '}
|
||||
(Maputo)
|
||||
</p>
|
||||
<p className="text-sm break-words">
|
||||
Campos:{' '}
|
||||
{event.after_data.changed_fields
|
||||
.map((key) => fields[key] ?? key)
|
||||
.join(', ')}
|
||||
</p>
|
||||
{Object.entries(event.after_data.values)
|
||||
.filter(
|
||||
([key, value]) =>
|
||||
JSON.stringify(
|
||||
event.before_data.values[key],
|
||||
) !== JSON.stringify(value),
|
||||
)
|
||||
.map(([key, value]) => (
|
||||
<p key={key} className="text-sm break-words">
|
||||
{fields[key] ?? key}:{' '}
|
||||
{display(
|
||||
event.before_data.values[key] ?? '—',
|
||||
)}{' '}
|
||||
→ {display(value)}
|
||||
</p>
|
||||
))}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!events.data.length && (
|
||||
<p>Ainda não existem alterações registadas.</p>
|
||||
)}
|
||||
<Pagination page={events} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, button, control, states } from "./shared";
|
||||
|
||||
type Interest = {
|
||||
id: number;
|
||||
reference: string;
|
||||
full_name: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
investor_type: string;
|
||||
country: string;
|
||||
sector_interest: string;
|
||||
opportunity_reference: string | null;
|
||||
investment_range: string | null;
|
||||
message: string;
|
||||
status: string;
|
||||
consented_at: string | null;
|
||||
reviewed_at: string | null;
|
||||
reviewed_by: number | null;
|
||||
created_at: string;
|
||||
metadata?: {
|
||||
submission_id?: string;
|
||||
journey_id?: string;
|
||||
dossier_id?: string;
|
||||
role?: string;
|
||||
horizon?: string;
|
||||
};
|
||||
};
|
||||
function dateTime(value: string | null) {
|
||||
if (!value) return "—";
|
||||
return new Intl.DateTimeFormat("pt-MZ", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "short",
|
||||
timeZone: "Africa/Maputo",
|
||||
}).format(new Date(value));
|
||||
}
|
||||
export default function InterestDetail({ interest }: { interest: Interest }) {
|
||||
const form = useForm({ status: interest.status });
|
||||
const rows: [string, string | number | null][] = [
|
||||
["Nome", interest.full_name],
|
||||
["Email", interest.email],
|
||||
["Telefone", interest.phone],
|
||||
["Tipo de investidor", interest.investor_type],
|
||||
["País", interest.country],
|
||||
["Sector", interest.sector_interest],
|
||||
["Oportunidade", interest.opportunity_reference],
|
||||
["Faixa de investimento", interest.investment_range],
|
||||
["Recebido em (Maputo)", dateTime(interest.created_at)],
|
||||
["Consentimento em (Maputo)", dateTime(interest.consented_at)],
|
||||
["Revisto em (Maputo)", dateTime(interest.reviewed_at)],
|
||||
["Revisto pelo utilizador", interest.reviewed_by],
|
||||
];
|
||||
return (
|
||||
<Management title={interest.reference}>
|
||||
{interest.metadata?.submission_id && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/investidor/manifestacoes/${interest.metadata.submission_id}`}
|
||||
>
|
||||
Consultar manifestação completa, necessidades e anexos privados
|
||||
</Link>
|
||||
)}
|
||||
{interest.metadata?.dossier_id && (
|
||||
<section className="space-y-2 rounded border p-4">
|
||||
<h2 className="font-semibold">Contexto de investimento</h2>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/portfolio/${interest.metadata.dossier_id}`}
|
||||
>
|
||||
Consultar corredor, cluster ou projecto de origem
|
||||
</Link>
|
||||
<p>Jornada: {interest.metadata.journey_id}</p>
|
||||
<p>
|
||||
Papel: {interest.metadata.role} · Horizonte: {interest.metadata.horizon}
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
<Link className={button} href={`/management/crm/convert/${interest.id}`}>
|
||||
Encaminhar para o CRM
|
||||
</Link>
|
||||
<dl className="grid gap-4 sm:grid-cols-2">
|
||||
{rows.map(([label, value]) => (
|
||||
<div key={label}>
|
||||
<dt className="text-muted-foreground text-sm">{label}</dt>
|
||||
<dd className="break-words">{value ?? "—"}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<section>
|
||||
<h2 className="font-semibold">Mensagem</h2>
|
||||
<p className="mt-2 break-words whitespace-pre-wrap">{interest.message}</p>
|
||||
</section>
|
||||
<form
|
||||
className="max-w-sm space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.patch(`/management/interests/${interest.id}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Estado do pedido" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData("status", e.target.value)}
|
||||
>
|
||||
{["received", "in_review", "contacted", "closed"].map((key) => (
|
||||
<option key={key} value={key}>
|
||||
{states[key]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
{form.processing ? "A guardar…" : "Guardar estado"}
|
||||
</button>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import { Link, router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Management, Pagination, button, control, states } from './shared';
|
||||
import type { Paginated } from './shared';
|
||||
|
||||
type Interest = {
|
||||
id: number;
|
||||
reference: string;
|
||||
full_name: string;
|
||||
email: string;
|
||||
sector_interest: string;
|
||||
status: string;
|
||||
};
|
||||
export default function Interests({
|
||||
requests,
|
||||
filters,
|
||||
}: {
|
||||
requests: Paginated<Interest>;
|
||||
filters: { q?: string; status?: string };
|
||||
}) {
|
||||
const [q, setQ] = useState(filters.q ?? '');
|
||||
const [status, setStatus] = useState(filters.status ?? '');
|
||||
return (
|
||||
<Management title="Manifestações de interesse">
|
||||
<form
|
||||
className="flex flex-wrap gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
router.get('/management/interests', { q, status });
|
||||
}}
|
||||
>
|
||||
<input
|
||||
aria-label="Pesquisar pedidos"
|
||||
className={`${control} max-w-sm`}
|
||||
placeholder="Referência, nome ou email"
|
||||
value={q}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
/>
|
||||
<select
|
||||
aria-label="Estado"
|
||||
className={`${control} max-w-xs`}
|
||||
value={status}
|
||||
onChange={(e) => setStatus(e.target.value)}
|
||||
>
|
||||
<option value="">Todos os estados</option>
|
||||
{['received', 'in_review', 'contacted', 'closed'].map(
|
||||
(key) => (
|
||||
<option key={key} value={key}>
|
||||
{states[key]}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
{[
|
||||
'Referência',
|
||||
'Nome',
|
||||
'Email',
|
||||
'Sector',
|
||||
'Estado',
|
||||
].map((label) => (
|
||||
<th key={label} className="border-b p-3">
|
||||
{label}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{requests.data.map((item) => (
|
||||
<tr key={item.id}>
|
||||
<td className="border-b p-3">
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/interests/${item.id}`}
|
||||
>
|
||||
{item.reference}
|
||||
</Link>
|
||||
</td>
|
||||
<td className="border-b p-3">
|
||||
{item.full_name}
|
||||
</td>
|
||||
<td className="border-b p-3">{item.email}</td>
|
||||
<td className="border-b p-3">
|
||||
{item.sector_interest}
|
||||
</td>
|
||||
<td className="border-b p-3">
|
||||
{states[item.status] ?? item.status}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!requests.data.length && <p>Nenhum pedido encontrado.</p>}
|
||||
<Pagination page={requests} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import { Head, Link, usePage } from "@inertiajs/react";
|
||||
import type { ReactNode } from "react";
|
||||
import { cloneElement, isValidElement, useId } from "react";
|
||||
|
||||
export type Paginated<T> = {
|
||||
data: T[];
|
||||
total: number;
|
||||
current_page: number;
|
||||
last_page: number;
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
export const control = "w-full rounded-md border border-input bg-background p-2 text-foreground";
|
||||
export const button =
|
||||
"inline-flex items-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50";
|
||||
export const states: Record<string, string> = {
|
||||
received: "Recebido",
|
||||
in_review: "Em análise",
|
||||
contacted: "Contactado",
|
||||
closed: "Encerrado",
|
||||
draft: "Rascunho",
|
||||
published: "Publicado",
|
||||
archived: "Arquivado",
|
||||
};
|
||||
|
||||
export function Management({ title, children }: { title: string; children: ReactNode }) {
|
||||
const { flash, educationEnabled, aiEnabled } = usePage<{
|
||||
flash?: { success?: string };
|
||||
educationEnabled?: boolean;
|
||||
aiEnabled?: boolean;
|
||||
}>().props;
|
||||
return (
|
||||
<main className="space-y-6 p-4 md:p-8">
|
||||
<Head title={title} />
|
||||
<nav className="flex flex-wrap gap-4 text-sm underline" aria-label="Gestão do portal">
|
||||
<Link href="/management/interests">Pedidos de interesse</Link>
|
||||
<Link href="/management/sectors">Sectores</Link>
|
||||
<Link href="/management/opportunities">Oportunidades</Link>
|
||||
<Link href="/management/history">Histórico</Link>
|
||||
<Link href="/management/crm/leads">CRM</Link>
|
||||
<Link href="/management/crm/investors">Investidores</Link>
|
||||
<Link href="/management/projects">Projectos</Link>
|
||||
<Link href="/management/clusters">Clusters</Link>
|
||||
<Link href="/management/investment/zones">ZEE, ZFI e parques</Link>
|
||||
{educationEnabled && (
|
||||
<Link href="/management/education">Competências e formação</Link>
|
||||
)}
|
||||
{aiEnabled && <Link href="/management/ai">Assistência e fontes</Link>}
|
||||
<Link href="/management/portfolio">Corredores e matriz de investimento</Link>
|
||||
<Link href="/management/portal-services">Documentos e parcerias</Link>
|
||||
<Link href="/management/investment/references">Referências e formulários</Link>
|
||||
<a href="/">Portal público</a>
|
||||
</nav>
|
||||
<h1 className="text-2xl font-semibold break-words">{title}</h1>
|
||||
{flash?.success && (
|
||||
<p role="status" className="rounded border border-emerald-600 p-3">
|
||||
{flash.success}
|
||||
</p>
|
||||
)}
|
||||
{children}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export function Pagination<T>({ page }: { page: Paginated<T> }) {
|
||||
return (
|
||||
<nav aria-label="Paginação" className="flex flex-wrap items-center gap-4">
|
||||
{page.prev_page_url && (
|
||||
<Link className={button} href={page.prev_page_url}>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
<span>
|
||||
{page.total} registos · Página {page.current_page} de {page.last_page}
|
||||
</span>
|
||||
{page.next_page_url && (
|
||||
<Link className={button} href={page.next_page_url}>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export function Field({
|
||||
label,
|
||||
error,
|
||||
children,
|
||||
}: {
|
||||
label: string;
|
||||
error?: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const id = useId();
|
||||
return (
|
||||
<label className="block space-y-1">
|
||||
<span id={id} className="text-sm font-medium">
|
||||
{label}
|
||||
</span>
|
||||
{isValidElement<{
|
||||
"aria-labelledby"?: string;
|
||||
"aria-describedby"?: string;
|
||||
"aria-invalid"?: boolean;
|
||||
}>(children)
|
||||
? cloneElement(children, {
|
||||
"aria-labelledby": id,
|
||||
"aria-describedby": error ? `${id}-error` : undefined,
|
||||
"aria-invalid": Boolean(error),
|
||||
})
|
||||
: children}
|
||||
{error && (
|
||||
<span id={`${id}-error`} role="alert" className="block text-sm text-red-600">
|
||||
{error}
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
import { router, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, control, button } from "../management/shared";
|
||||
|
||||
export default function Manage({
|
||||
documents,
|
||||
resources,
|
||||
partnerships,
|
||||
}: {
|
||||
documents: { id: string; file_name: string }[];
|
||||
resources: { id: number; title: string; published: boolean }[];
|
||||
partnerships: {
|
||||
id: number;
|
||||
title: string;
|
||||
sector: string;
|
||||
province: string;
|
||||
offer: string;
|
||||
seeking: string;
|
||||
status: string;
|
||||
}[];
|
||||
}) {
|
||||
const upload = useForm<{ file: File | null; publication_consent: boolean }>({
|
||||
file: null,
|
||||
publication_consent: false,
|
||||
});
|
||||
const form = useForm({
|
||||
document_id: "",
|
||||
title: "",
|
||||
category: "",
|
||||
topic: "",
|
||||
source_reference: "",
|
||||
legislation: false,
|
||||
essential: false,
|
||||
published: false,
|
||||
});
|
||||
return (
|
||||
<Management title="Documentos públicos e Bolsa de Parcerias">
|
||||
<form
|
||||
className="space-y-4 rounded border p-5"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
upload.post("/management/portal-services/upload", {
|
||||
forceFormData: true,
|
||||
preserveScroll: true,
|
||||
onSuccess: () => upload.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold">Carregar documento autorizado</h2>
|
||||
<p>
|
||||
PDF ou TXT, até 10 MiB. Não carregar dados privados. A publicação é feita no
|
||||
catálogo abaixo.
|
||||
</p>
|
||||
<Field label="Ficheiro">
|
||||
<input
|
||||
type="file"
|
||||
accept="application/pdf,text/plain"
|
||||
required
|
||||
onChange={(e) => upload.setData("file", e.target.files?.[0] ?? null)}
|
||||
/>
|
||||
</Field>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
required
|
||||
checked={upload.data.publication_consent}
|
||||
onChange={(e) => upload.setData("publication_consent", e.target.checked)}
|
||||
/>
|
||||
Confirmo que o ficheiro está autorizado para divulgação pública.
|
||||
</label>
|
||||
{Object.entries(upload.errors).map(([key, error]) => (
|
||||
<p role="alert" key={key}>
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={upload.processing}>
|
||||
Carregar
|
||||
</button>
|
||||
</form>
|
||||
<form
|
||||
className="space-y-4 rounded border p-5"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post("/management/portal-services/resources", {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold">Catalogar documento</h2>
|
||||
<Field label="Documento público">
|
||||
<select
|
||||
required
|
||||
className={control}
|
||||
value={form.data.document_id}
|
||||
onChange={(e) => form.setData("document_id", e.target.value)}
|
||||
>
|
||||
<option value="">Seleccionar</option>
|
||||
{documents.map((d) => (
|
||||
<option value={d.id} key={d.id}>
|
||||
{d.file_name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{(["title", "category", "topic", "source_reference"] as const).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
title: "Título",
|
||||
category: "Categoria (ex.: Formulário)",
|
||||
topic: "Tema (ex.: Incentivos)",
|
||||
source_reference: "Fonte, versão e referência de autorização",
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<input
|
||||
required
|
||||
className={control}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
{(["legislation", "essential", "published"] as const).map((key) => (
|
||||
<label key={key} className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.checked)}
|
||||
/>
|
||||
{
|
||||
{
|
||||
legislation: "Incluir em Legislação e Incentivos",
|
||||
essential: "Documento essencial",
|
||||
published: "Aprovar e publicar",
|
||||
}[key]
|
||||
}
|
||||
</label>
|
||||
))}
|
||||
{Object.entries(form.errors).map(([key, error]) => (
|
||||
<p role="alert" key={key}>
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar catálogo
|
||||
</button>
|
||||
</form>
|
||||
<h2 className="text-xl font-bold">Documentos catalogados</h2>
|
||||
{resources.map((r) => (
|
||||
<article key={r.id} className="space-y-3 rounded border p-4">
|
||||
<h3>
|
||||
{r.title} — {r.published ? "Publicado" : "Retirado"}
|
||||
</h3>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/management/portal-services/resources/${r.id}`,
|
||||
{ published: !r.published },
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
}
|
||||
>
|
||||
{r.published ? "Retirar" : "Publicar"}
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
<h2 className="text-xl font-bold">Propostas de parceria</h2>
|
||||
{partnerships.map((p) => (
|
||||
<article key={p.id} className="space-y-3 rounded border p-4">
|
||||
<h3 className="font-bold">{p.title}</h3>
|
||||
<p>
|
||||
{p.sector} · {p.province} ·{" "}
|
||||
{p.status === "published"
|
||||
? "Publicado"
|
||||
: p.status === "pending"
|
||||
? "Pendente"
|
||||
: "Retirado"}
|
||||
</p>
|
||||
<p className="whitespace-pre-line">Oferece: {p.offer}</p>
|
||||
<p className="whitespace-pre-line">Procura: {p.seeking}</p>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/management/portal-services/partnerships/${p.id}`,
|
||||
{ published: p.status !== "published" },
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
}
|
||||
>
|
||||
{p.status === "published" ? "Retirar" : "Aprovar e publicar"}
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,777 @@
|
||||
import { Head, Link, useForm, usePage } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { PortalMenu } from "@/layouts/portal-navigation";
|
||||
import { newSubmissionKey } from "@/lib/portal-api";
|
||||
|
||||
const input = "w-full rounded-lg border border-slate-300 bg-white p-3 text-slate-900";
|
||||
const button =
|
||||
"inline-block rounded-lg bg-emerald-800 px-5 py-3 font-semibold text-white disabled:opacity-50";
|
||||
const titles: Record<string, string> = {
|
||||
sectors: "Sectores Prioritários",
|
||||
sector: "Sector prioritário",
|
||||
procedures: "Como Investir / Procedimentos",
|
||||
legislation: "Legislação e Incentivos",
|
||||
documents: "Documentos e Formulários",
|
||||
support: "Apoio ao Investidor",
|
||||
partnerships: "Bolsa de Parcerias",
|
||||
simulator: "Simulador Fiscal",
|
||||
investor: "Formulário de investidor",
|
||||
company: "Formulário de empresa",
|
||||
desk: "Balcão Virtual",
|
||||
};
|
||||
type Resource = {
|
||||
id: number;
|
||||
title: string;
|
||||
category: string;
|
||||
topic: string;
|
||||
source_reference: string;
|
||||
essential: boolean;
|
||||
};
|
||||
type Partnership = {
|
||||
id: number;
|
||||
title: string;
|
||||
sector: string;
|
||||
province: string;
|
||||
offer: string;
|
||||
seeking: string;
|
||||
};
|
||||
type Page<T> = {
|
||||
data: T[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
total: number;
|
||||
};
|
||||
type Props = {
|
||||
section: string;
|
||||
filters?: Record<string, string>;
|
||||
sectors?: {
|
||||
name: string;
|
||||
slug: string;
|
||||
short_description: string;
|
||||
opportunities_count: number;
|
||||
}[];
|
||||
sector?: { name: string; slug: string; description: string; short_description: string };
|
||||
opportunities?: { title: string; slug: string; province: string; summary: string }[];
|
||||
resources?: Page<Resource>;
|
||||
categories?: string[];
|
||||
topics?: string[];
|
||||
partnerships?: Page<Partnership>;
|
||||
contacts?: { email?: string; phone?: string; address?: string; hours?: string };
|
||||
requests?: {
|
||||
reference: string;
|
||||
status: string;
|
||||
created_at: string;
|
||||
metadata: { kind: string };
|
||||
}[];
|
||||
myPartnerships?: { id: number; title: string; status: string }[];
|
||||
};
|
||||
const states: Record<string, string> = {
|
||||
received: "Recebido",
|
||||
in_review: "Em análise",
|
||||
contacted: "Contactado",
|
||||
closed: "Encerrado",
|
||||
pending: "A aguardar publicação",
|
||||
published: "Publicado",
|
||||
withdrawn: "Retirado",
|
||||
};
|
||||
|
||||
function Pagination({ page }: { page: Page<unknown> }) {
|
||||
return (
|
||||
<nav aria-label="Paginação" className="flex gap-6 py-5">
|
||||
{page.prev_page_url && <Link href={page.prev_page_url}>Anterior</Link>}
|
||||
<span>{page.total} registos</span>
|
||||
{page.next_page_url && <Link href={page.next_page_url}>Seguinte</Link>}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
function RequestForm({ kind, partnershipId }: { kind: string; partnershipId?: number }) {
|
||||
const { auth } = usePage<{ auth: { user: { name: string; email: string } | null } }>().props;
|
||||
const form = useForm({
|
||||
kind,
|
||||
fullName: auth.user?.name ?? "",
|
||||
email: auth.user?.email ?? "",
|
||||
phone: "",
|
||||
country: "Moçambique",
|
||||
company: "",
|
||||
sectorInterest: "",
|
||||
message: "",
|
||||
privacyConsent: false,
|
||||
submission_key: "",
|
||||
partnership_id: partnershipId ?? null,
|
||||
});
|
||||
const [sent, setSent] = useState(false);
|
||||
return (
|
||||
<form
|
||||
className="space-y-4 rounded-xl border bg-white p-6"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const key = form.data.submission_key || newSubmissionKey();
|
||||
form.setData("submission_key", key);
|
||||
form.transform((data) => ({ ...data, submission_key: key }));
|
||||
form.post("/apoio", { preserveScroll: true, onSuccess: () => setSent(true) });
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
{kind === "company" ? "Dados da empresa e do representante" : "Enviar pedido"}
|
||||
</h2>
|
||||
{!auth.user && (
|
||||
<p className="text-sm">
|
||||
Pode enviar sem conta. Para acompanhar no Balcão Virtual,{" "}
|
||||
<Link href="/login" className="underline">
|
||||
entre antes de enviar
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
)}
|
||||
{(
|
||||
[
|
||||
"fullName",
|
||||
"email",
|
||||
"phone",
|
||||
"country",
|
||||
"sectorInterest",
|
||||
...(kind === "company" ? ["company"] : []),
|
||||
] as const
|
||||
).map((key) => {
|
||||
const field = key as
|
||||
| "fullName"
|
||||
| "email"
|
||||
| "phone"
|
||||
| "country"
|
||||
| "sectorInterest"
|
||||
| "company";
|
||||
const labels = {
|
||||
fullName: "Nome do representante",
|
||||
email: "Email",
|
||||
phone: "Telefone (opcional)",
|
||||
country: "País",
|
||||
sectorInterest: "Sector ou assunto",
|
||||
company: "Nome da empresa",
|
||||
};
|
||||
return (
|
||||
<label key={field} className="block space-y-1">
|
||||
<span>{labels[field]}</span>
|
||||
<input
|
||||
className={input}
|
||||
type={field === "email" ? "email" : "text"}
|
||||
required={field !== "phone"}
|
||||
maxLength={field === "phone" ? 30 : 150}
|
||||
value={form.data[field]}
|
||||
onChange={(e) => form.setData(field, e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
<label className="block">
|
||||
Descreva o pedido
|
||||
<textarea
|
||||
className={input}
|
||||
required
|
||||
minLength={20}
|
||||
maxLength={2000}
|
||||
rows={5}
|
||||
value={form.data.message}
|
||||
onChange={(e) => form.setData("message", e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
required
|
||||
checked={form.data.privacyConsent}
|
||||
onChange={(e) => form.setData("privacyConsent", e.target.checked)}
|
||||
/>
|
||||
<span>
|
||||
Autorizo o tratamento destes dados para responder e acompanhar este pedido. Os
|
||||
dados ficam acessíveis à equipa de atendimento; não serão publicados na bolsa.
|
||||
</span>
|
||||
</label>
|
||||
{Object.entries(form.errors).map(([key, error]) => (
|
||||
<p key={key} role="alert" className="text-red-700">
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
{sent ? (
|
||||
<p role="status">
|
||||
Pedido enviado. Guarde o protocolo apresentado acima.{" "}
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
onClick={() => {
|
||||
setSent(false);
|
||||
form.setData("submission_key", "");
|
||||
form.setData("message", "");
|
||||
}}
|
||||
>
|
||||
Enviar novo pedido
|
||||
</button>
|
||||
</p>
|
||||
) : (
|
||||
<button className={button} disabled={form.processing}>
|
||||
Enviar e obter protocolo
|
||||
</button>
|
||||
)}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function PartnershipForm() {
|
||||
const form = useForm({
|
||||
title: "",
|
||||
sector: "",
|
||||
province: "",
|
||||
offer: "",
|
||||
seeking: "",
|
||||
publication_consent: false,
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="space-y-4 rounded-xl border p-6"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post("/parcerias", { preserveScroll: true, onSuccess: () => form.reset() });
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold">Propor parceria</h2>
|
||||
<p>
|
||||
Descreva apenas informação destinada a publicação. Não inclua contactos pessoais ou
|
||||
documentos confidenciais.
|
||||
</p>
|
||||
{(["title", "sector", "province", "offer", "seeking"] as const).map((key) => (
|
||||
<label className="block" key={key}>
|
||||
{
|
||||
{
|
||||
title: "Título",
|
||||
sector: "Sector",
|
||||
province: "Província",
|
||||
offer: "O que oferece",
|
||||
seeking: "Parceiro ou capacidade que procura",
|
||||
}[key]
|
||||
}
|
||||
<textarea
|
||||
className={input}
|
||||
required
|
||||
minLength={key === "offer" || key === "seeking" ? 20 : 1}
|
||||
maxLength={key === "offer" || key === "seeking" ? 2000 : 100}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
required
|
||||
checked={form.data.publication_consent}
|
||||
onChange={(e) => form.setData("publication_consent", e.target.checked)}
|
||||
/>
|
||||
Autorizo a publicação dos dados desta proposta após revisão.
|
||||
</label>
|
||||
{Object.entries(form.errors).map(([key, error]) => (
|
||||
<p role="alert" key={key}>
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
<button disabled={form.processing} className={button}>
|
||||
Submeter proposta
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function Simulator() {
|
||||
const [base, setBase] = useState("");
|
||||
const [rate, setRate] = useState("");
|
||||
const [reduction, setReduction] = useState("0");
|
||||
const [currency, setCurrency] = useState("MZN");
|
||||
const valid =
|
||||
base !== "" &&
|
||||
rate !== "" &&
|
||||
reduction !== "" &&
|
||||
Number.isFinite(Number(base)) &&
|
||||
Number(base) >= 0 &&
|
||||
Number(base) <= 1e12 &&
|
||||
Number(rate) >= 0 &&
|
||||
Number(rate) <= 100 &&
|
||||
Number(reduction) >= 0 &&
|
||||
Number(reduction) <= 100;
|
||||
const gross = (Number(base) * Number(rate)) / 100;
|
||||
const net = gross * (1 - Number(reduction) / 100);
|
||||
const format = (n: number) =>
|
||||
new Intl.NumberFormat("pt-MZ", { style: "currency", currency }).format(n);
|
||||
return (
|
||||
<section className="max-w-2xl space-y-5 rounded-xl border bg-white p-6">
|
||||
<h2 className="text-xl font-bold">Cenário com parâmetros próprios</h2>
|
||||
<p>
|
||||
Introduza uma base tributável e uma taxa que pretende comparar. Não existem taxas
|
||||
legais ou incentivos automáticos neste cálculo; a redução é uma hipótese introduzida
|
||||
por si.
|
||||
</p>
|
||||
<label className="block">
|
||||
Moeda
|
||||
<select
|
||||
className={input}
|
||||
value={currency}
|
||||
onChange={(e) => setCurrency(e.target.value)}
|
||||
>
|
||||
{["MZN", "USD", "EUR", "ZAR"].map((c) => (
|
||||
<option key={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block">
|
||||
Base tributável
|
||||
<input
|
||||
className={input}
|
||||
type="number"
|
||||
min="0"
|
||||
max="1000000000000"
|
||||
step="0.01"
|
||||
value={base}
|
||||
onChange={(e) => setBase(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Taxa a simular (%)
|
||||
<input
|
||||
className={input}
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="0.01"
|
||||
value={rate}
|
||||
onChange={(e) => setRate(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Redução hipotética do imposto (%)
|
||||
<input
|
||||
className={input}
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="0.01"
|
||||
value={reduction}
|
||||
onChange={(e) => setReduction(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<div role="status" className="rounded bg-emerald-50 p-5">
|
||||
{valid ? (
|
||||
<>
|
||||
<p>
|
||||
Sem redução: <strong>{format(gross)}</strong>
|
||||
</p>
|
||||
<p>Redução simulada: {format(gross - net)}</p>
|
||||
<p>
|
||||
Total do cenário: <strong>{format(net)}</strong>
|
||||
</p>
|
||||
<p className="mt-3 text-sm">
|
||||
Base × taxa ÷ 100 × (1 − redução ÷ 100). Não inclui outros impostos,
|
||||
deduções, escalões ou regras sectoriais.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p>Preencha a base e uma taxa válida entre 0 e 100%.</p>
|
||||
)}
|
||||
</div>
|
||||
<Link href="/apoio" className="underline">
|
||||
Pedir esclarecimento sobre o enquadramento aplicável
|
||||
</Link>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Services(p: Props) {
|
||||
const { flash, auth } = usePage<{ flash?: { success?: string }; auth: { user: unknown } }>()
|
||||
.props;
|
||||
const filter = useForm({
|
||||
q: p.filters?.q ?? "",
|
||||
category: p.filters?.category ?? "",
|
||||
topic: p.filters?.topic ?? "",
|
||||
sector: p.filters?.sector ?? "",
|
||||
province: p.filters?.province ?? "",
|
||||
});
|
||||
const [selectedPartner, setSelectedPartner] = useState<number>();
|
||||
const title = p.sector?.name ?? titles[p.section];
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 text-slate-900">
|
||||
<Head title={title} />
|
||||
<PortalMenu />
|
||||
<main className="mx-auto max-w-6xl space-y-8 px-5 py-10">
|
||||
<h1 className="text-3xl font-bold">{title}</h1>
|
||||
{flash?.success && (
|
||||
<p
|
||||
role="status"
|
||||
className="rounded border border-emerald-700 bg-emerald-50 p-4"
|
||||
>
|
||||
{flash.success}
|
||||
</p>
|
||||
)}
|
||||
{p.section === "sectors" && (
|
||||
<div className="grid gap-5 md:grid-cols-3">
|
||||
{p.sectors?.map((s) => (
|
||||
<article className="rounded-xl border bg-white p-6" key={s.slug}>
|
||||
<h2 className="text-xl font-bold">
|
||||
<Link href={`/sectores/${s.slug}`}>{s.name}</Link>
|
||||
</h2>
|
||||
<p className="my-3">{s.short_description}</p>
|
||||
<p>{s.opportunities_count} oportunidades publicadas</p>
|
||||
</article>
|
||||
))}
|
||||
{!p.sectors?.length && <p>Não existem sectores publicados.</p>}
|
||||
</div>
|
||||
)}
|
||||
{p.section === "sector" && p.sector && (
|
||||
<>
|
||||
<p className="whitespace-pre-line">
|
||||
{p.sector.description ||
|
||||
p.sector.short_description ||
|
||||
"Descrição sectorial em preparação."}
|
||||
</p>
|
||||
<h2 className="text-xl font-bold">Oportunidades no sector</h2>
|
||||
{p.opportunities?.map((o) => (
|
||||
<article key={o.slug} className="rounded border bg-white p-5">
|
||||
<Link
|
||||
className="text-lg font-bold underline"
|
||||
href={`/oportunidades/${o.slug}`}
|
||||
>
|
||||
{o.title}
|
||||
</Link>
|
||||
<p>{o.province}</p>
|
||||
<p>{o.summary}</p>
|
||||
</article>
|
||||
))}
|
||||
{!p.opportunities?.length && (
|
||||
<p>Sem oportunidades publicadas neste sector.</p>
|
||||
)}
|
||||
<Link className={button} href={`/oportunidades?sector=${p.sector.slug}`}>
|
||||
Pesquisar todas as oportunidades do sector
|
||||
</Link>
|
||||
<p>
|
||||
<Link href="/como-investir" className="underline">
|
||||
Preparar o investimento
|
||||
</Link>{" "}
|
||||
·{" "}
|
||||
<Link href="/apoio" className="underline">
|
||||
Pedir apoio sectorial
|
||||
</Link>
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{p.section === "procedures" && (
|
||||
<>
|
||||
<p>
|
||||
Roteiro de preparação e acompanhamento. Os requisitos concretos dependem
|
||||
da actividade e devem ser confirmados com a entidade competente.
|
||||
</p>
|
||||
<ol className="space-y-5">
|
||||
{[
|
||||
[
|
||||
"Definir o investimento",
|
||||
"Descreva actividade, localização, dimensão, promotor e objectivos. Identifique as componentes que pretende financiar ou executar.",
|
||||
"/oportunidades",
|
||||
"Explorar oportunidades",
|
||||
],
|
||||
[
|
||||
"Preparar o perfil do promotor",
|
||||
"Reúna os dados de contacto, identificação do representante e descrição da capacidade técnica e financeira. Utilize o formulário adequado ao seu perfil.",
|
||||
"/formularios/empresa",
|
||||
"Preencher perfil da empresa",
|
||||
],
|
||||
[
|
||||
"Confirmar procedimentos e enquadramento",
|
||||
"Solicite à equipa a identificação dos procedimentos aplicáveis à localização e actividade, entidades intervenientes e documentos necessários.",
|
||||
"/apoio",
|
||||
"Solicitar orientação",
|
||||
],
|
||||
[
|
||||
"Organizar documentos",
|
||||
"Consulte a biblioteca e confirme versões, formulários, anexos e referências antes da submissão à entidade competente.",
|
||||
"/documentos",
|
||||
"Consultar documentos",
|
||||
],
|
||||
[
|
||||
"Analisar parceiros e cenários",
|
||||
"Identifique parceiros, necessidades de financiamento e cenários. Confirme as condições legais dos incentivos antes de os incorporar no plano.",
|
||||
"/parcerias",
|
||||
"Explorar parcerias",
|
||||
],
|
||||
[
|
||||
"Submeter e acompanhar o pedido",
|
||||
"Entre na sua conta, envie o pedido e guarde o protocolo. Acompanhe o estado no Balcão Virtual e responda aos contactos da equipa.",
|
||||
"/balcao-virtual",
|
||||
"Abrir Balcão Virtual",
|
||||
],
|
||||
].map(([heading, text, href, label], i) => (
|
||||
<li key={heading} className="rounded-xl border bg-white p-6">
|
||||
<h2 className="text-xl font-bold">
|
||||
{i + 1}. {heading}
|
||||
</h2>
|
||||
<p className="my-3">{text}</p>
|
||||
<Link href={href} className="underline">
|
||||
{label}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</>
|
||||
)}
|
||||
{(p.section === "documents" || p.section === "legislation") && (
|
||||
<>
|
||||
<p>
|
||||
Documentos publicados pela gestão, organizados por categoria e tema.
|
||||
Cada download mantém a referência da fonte.
|
||||
</p>
|
||||
<form
|
||||
className="grid gap-3 md:grid-cols-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
filter.get(
|
||||
p.section === "documents" ? "/documentos" : "/legislacao",
|
||||
);
|
||||
}}
|
||||
>
|
||||
<label>
|
||||
Pesquisar
|
||||
<input
|
||||
className={input}
|
||||
value={filter.data.q}
|
||||
onChange={(e) => filter.setData("q", e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Categoria
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.category}
|
||||
onChange={(e) => filter.setData("category", e.target.value)}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.categories?.map((c) => (
|
||||
<option key={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Tema
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.topic}
|
||||
onChange={(e) => filter.setData("topic", e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.topics?.map((t) => (
|
||||
<option key={t}>{t}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
{p.resources?.data.map((r) => (
|
||||
<article key={r.id} className="rounded-xl border bg-white p-5">
|
||||
<h2 className="text-xl font-bold">
|
||||
{r.title}
|
||||
{r.essential ? " · Essencial" : ""}
|
||||
</h2>
|
||||
<p>
|
||||
{r.category} · {r.topic}
|
||||
</p>
|
||||
<p className="my-3 text-sm">Fonte: {r.source_reference}</p>
|
||||
<a href={`/documentos/${r.id}/download`} className="underline">
|
||||
Descarregar {r.title}
|
||||
</a>
|
||||
</article>
|
||||
))}
|
||||
{!p.resources?.data.length && (
|
||||
<p>
|
||||
Não existem documentos publicados para esta pesquisa.{" "}
|
||||
<Link href="/apoio" className="underline">
|
||||
Solicitar documento ao apoio
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
)}
|
||||
{p.resources && <Pagination page={p.resources} />}
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link className={button} href="/formularios/investidor">
|
||||
Formulário de investidor
|
||||
</Link>
|
||||
<Link className={button} href="/formularios/empresa">
|
||||
Formulário de empresa
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{["support", "investor", "company"].includes(p.section) && (
|
||||
<RequestForm
|
||||
key={p.section}
|
||||
kind={p.section === "support" ? "support" : p.section}
|
||||
/>
|
||||
)}
|
||||
{p.section === "support" && (
|
||||
<>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-bold">Contactos</h2>
|
||||
{p.contacts?.email && (
|
||||
<p>
|
||||
Email:{" "}
|
||||
<a className="underline" href={`mailto:${p.contacts.email}`}>
|
||||
{p.contacts.email}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
{p.contacts?.phone && <p>Telefone: {p.contacts.phone}</p>}
|
||||
{p.contacts?.address && <p>{p.contacts.address}</p>}
|
||||
{p.contacts?.hours && <p>Horário: {p.contacts.hours}</p>}
|
||||
{!p.contacts?.email && !p.contacts?.phone && (
|
||||
<p>
|
||||
Utilize o formulário para contactar a equipa. Os contactos
|
||||
directos ainda não estão publicados.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-bold">Perguntas frequentes</h2>
|
||||
{[
|
||||
[
|
||||
"Como acompanho um pedido?",
|
||||
"Entre antes de enviar o pedido. O protocolo e o estado ficam disponíveis no Balcão Virtual. Para pedidos enviados sem conta, conserve o protocolo e indique-o nos contactos seguintes.",
|
||||
],
|
||||
[
|
||||
"Manifestar interesse garante financiamento ou aprovação?",
|
||||
"O envio regista o interesse para análise e contacto da equipa. Não representa aprovação do investimento nem compromisso de financiamento.",
|
||||
],
|
||||
[
|
||||
"Como publico uma parceria?",
|
||||
"Entre com email verificado, preencha a proposta na Bolsa de Parcerias e autorize a publicação. A gestão revê a proposta antes de a tornar pública.",
|
||||
],
|
||||
[
|
||||
"Onde obtenho documentos e formulários?",
|
||||
"Consulte Documentos e Formulários. Se não encontrar o documento, indique o título ou assunto num pedido de apoio.",
|
||||
],
|
||||
].map(([q, a]) => (
|
||||
<details key={q} className="rounded border bg-white p-4">
|
||||
<summary className="cursor-pointer font-semibold">{q}</summary>
|
||||
<p className="mt-3">{a}</p>
|
||||
</details>
|
||||
))}
|
||||
</section>
|
||||
</>
|
||||
)}
|
||||
{p.section === "simulator" && <Simulator />}
|
||||
{p.section === "partnerships" && (
|
||||
<>
|
||||
<p>
|
||||
Encontre capacidades e parceiros. O contacto é intermediado pelo apoio;
|
||||
os dados privados dos proponentes não são publicados.
|
||||
</p>
|
||||
<form
|
||||
className="grid gap-3 md:grid-cols-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
filter.get("/parcerias");
|
||||
}}
|
||||
>
|
||||
{(["q", "sector", "province"] as const).map((key) => (
|
||||
<label key={key}>
|
||||
{
|
||||
{ q: "Pesquisar", sector: "Sector", province: "Província" }[
|
||||
key
|
||||
]
|
||||
}
|
||||
<input
|
||||
className={input}
|
||||
value={filter.data[key]}
|
||||
onChange={(e) => filter.setData(key, e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
<button className={button}>Filtrar</button>
|
||||
</form>
|
||||
{p.partnerships?.data.map((item) => (
|
||||
<article
|
||||
key={item.id}
|
||||
className="space-y-3 rounded-xl border bg-white p-6"
|
||||
>
|
||||
<h2 className="text-xl font-bold">{item.title}</h2>
|
||||
<p>
|
||||
{item.sector} · {item.province}
|
||||
</p>
|
||||
<h3 className="font-bold">Oferece</h3>
|
||||
<p className="whitespace-pre-line">{item.offer}</p>
|
||||
<h3 className="font-bold">Procura</h3>
|
||||
<p className="whitespace-pre-line">{item.seeking}</p>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() => setSelectedPartner(item.id)}
|
||||
>
|
||||
Pedir contacto sobre esta parceria
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
{!p.partnerships?.data.length && (
|
||||
<p>Ainda não existem propostas publicadas para esta pesquisa.</p>
|
||||
)}
|
||||
{p.partnerships && <Pagination page={p.partnerships} />}
|
||||
{selectedPartner && (
|
||||
<RequestForm
|
||||
key={selectedPartner}
|
||||
kind="partnership"
|
||||
partnershipId={selectedPartner}
|
||||
/>
|
||||
)}{" "}
|
||||
{auth.user ? (
|
||||
<PartnershipForm />
|
||||
) : (
|
||||
<Link className={button} href="/login">
|
||||
Entrar para propor parceria
|
||||
</Link>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{p.section === "desk" && (
|
||||
<>
|
||||
<p>
|
||||
Acompanhe os pedidos submetidos com esta conta. Os contactos da equipa
|
||||
continuam pelos dados fornecidos no pedido.
|
||||
</p>
|
||||
<Link className={button} href="/apoio">
|
||||
Novo pedido
|
||||
</Link>
|
||||
<h2 className="text-xl font-bold">Os meus pedidos</h2>
|
||||
{p.requests?.map((r) => (
|
||||
<article key={r.reference} className="rounded border bg-white p-5">
|
||||
<strong>{r.reference}</strong>
|
||||
<p>{states[r.status] ?? r.status}</p>
|
||||
<p>{new Date(r.created_at).toLocaleDateString("pt-MZ")}</p>
|
||||
</article>
|
||||
))}
|
||||
{!p.requests?.length && (
|
||||
<p>Ainda não existem pedidos de apoio enviados com esta conta.</p>
|
||||
)}
|
||||
<h2 className="text-xl font-bold">As minhas propostas de parceria</h2>
|
||||
{p.myPartnerships?.map((r) => (
|
||||
<p key={r.id}>
|
||||
{r.title} — {states[r.status] ?? r.status}
|
||||
</p>
|
||||
))}
|
||||
<Link href="/investidor" className="underline">
|
||||
Abrir fichas e manifestações de interesse da carteira
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
<footer className="border-t px-5 py-8 text-center text-sm">
|
||||
Investe Moçambique ·{" "}
|
||||
<Link href="/apoio" className="underline">
|
||||
Apoio ao Investidor
|
||||
</Link>{" "}
|
||||
·{" "}
|
||||
<Link href="/documentos" className="underline">
|
||||
Documentos e Formulários
|
||||
</Link>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Head } from '@inertiajs/react';
|
||||
import AppearanceTabs from '@/components/appearance-tabs';
|
||||
import Heading from '@/components/heading';
|
||||
import { edit as editAppearance } from '@/routes/appearance';
|
||||
|
||||
export default function Appearance() {
|
||||
return (
|
||||
<>
|
||||
<Head title="Appearance settings" />
|
||||
|
||||
<h1 className="sr-only">Appearance settings</h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Appearance settings"
|
||||
description="Update the appearance settings for your account"
|
||||
/>
|
||||
<AppearanceTabs />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Appearance.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Appearance settings',
|
||||
href: editAppearance(),
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,148 @@
|
||||
import { Form, Head, usePage } from '@inertiajs/react';
|
||||
/* @chisel-email-verification */
|
||||
import { Link } from '@inertiajs/react';
|
||||
/* @end-chisel-email-verification */
|
||||
import ProfileController from '@/actions/App/Http/Controllers/Settings/ProfileController';
|
||||
import DeleteUser from '@/components/delete-user';
|
||||
import Heading from '@/components/heading';
|
||||
import InputError from '@/components/input-error';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { edit } from '@/routes/profile';
|
||||
import type { Auth } from '@/types';
|
||||
/* @chisel-email-verification */
|
||||
import { send } from '@/routes/verification';
|
||||
/* @end-chisel-email-verification */
|
||||
|
||||
type PageProps = {
|
||||
auth: Auth;
|
||||
};
|
||||
|
||||
export default function Profile(
|
||||
/* @chisel-email-verification */
|
||||
{
|
||||
mustVerifyEmail,
|
||||
status,
|
||||
}: {
|
||||
mustVerifyEmail: boolean;
|
||||
status?: string;
|
||||
},
|
||||
/* @end-chisel-email-verification */
|
||||
) {
|
||||
const { auth } = usePage<PageProps>().props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Profile settings" />
|
||||
|
||||
<h1 className="sr-only">Profile settings</h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Profile"
|
||||
description="Update your name and email address"
|
||||
/>
|
||||
|
||||
<Form
|
||||
{...ProfileController.update.form()}
|
||||
options={{
|
||||
preserveScroll: true,
|
||||
}}
|
||||
className="space-y-6"
|
||||
>
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
|
||||
<Input
|
||||
id="name"
|
||||
className="mt-1 block w-full"
|
||||
defaultValue={auth.user.name}
|
||||
name="name"
|
||||
required
|
||||
autoComplete="name"
|
||||
placeholder="Full name"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
className="mt-2"
|
||||
message={errors.name}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
className="mt-1 block w-full"
|
||||
defaultValue={auth.user.email}
|
||||
name="email"
|
||||
required
|
||||
autoComplete="username"
|
||||
placeholder="Email address"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
className="mt-2"
|
||||
message={errors.email}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* @chisel-email-verification */}
|
||||
{mustVerifyEmail &&
|
||||
auth.user.email_verified_at === null && (
|
||||
<div>
|
||||
<p className="text-muted-foreground -mt-4 text-sm">
|
||||
Your email address is unverified.{' '}
|
||||
<Link
|
||||
href={send()}
|
||||
as="button"
|
||||
className="text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500"
|
||||
>
|
||||
Click here to re-send the
|
||||
verification email.
|
||||
</Link>
|
||||
</p>
|
||||
|
||||
{status ===
|
||||
'verification-link-sent' && (
|
||||
<div className="mt-2 text-sm font-medium text-green-600">
|
||||
A new verification link has been
|
||||
sent to your email address.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* @end-chisel-email-verification */}
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Button
|
||||
disabled={processing}
|
||||
data-test="update-profile-button"
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
<DeleteUser />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Profile.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Profile settings',
|
||||
href: edit(),
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,156 @@
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import { useRef } from 'react';
|
||||
import SecurityController from '@/actions/App/Http/Controllers/Settings/SecurityController';
|
||||
import Heading from '@/components/heading';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { edit } from '@/routes/security';
|
||||
/* @chisel-passkeys */
|
||||
import type { Props as ManagePasskeysProps } from '@/components/manage-passkeys';
|
||||
import ManagePasskeys from '@/components/manage-passkeys';
|
||||
/* @end-chisel-passkeys */
|
||||
/* @chisel-2fa */
|
||||
import type { Props as ManageTwoFactorProps } from '@/components/manage-two-factor';
|
||||
import ManageTwoFactor from '@/components/manage-two-factor';
|
||||
/* @end-chisel-2fa */
|
||||
|
||||
// oxfmt-ignore
|
||||
type Props = {
|
||||
passwordRules: string;
|
||||
} /* @chisel-passkeys */ & ManagePasskeysProps /* @end-chisel-passkeys */ /* @chisel-2fa */ &
|
||||
ManageTwoFactorProps /* @end-chisel-2fa */;
|
||||
|
||||
export default function Security(props: Props) {
|
||||
const passwordInput = useRef<HTMLInputElement>(null);
|
||||
const currentPasswordInput = useRef<HTMLInputElement>(null);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Security settings" />
|
||||
|
||||
<h1 className="sr-only">Security settings</h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Update password"
|
||||
description="Ensure your account is using a long, random password to stay secure"
|
||||
/>
|
||||
|
||||
<Form
|
||||
{...SecurityController.update.form()}
|
||||
options={{
|
||||
preserveScroll: true,
|
||||
}}
|
||||
resetOnError={[
|
||||
'password',
|
||||
'password_confirmation',
|
||||
'current_password',
|
||||
]}
|
||||
resetOnSuccess
|
||||
onError={(errors) => {
|
||||
if (errors.password) {
|
||||
passwordInput.current?.focus();
|
||||
}
|
||||
|
||||
if (errors.current_password) {
|
||||
currentPasswordInput.current?.focus();
|
||||
}
|
||||
}}
|
||||
className="space-y-6"
|
||||
>
|
||||
{({ errors, processing }) => (
|
||||
<>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="current_password">
|
||||
Current password
|
||||
</Label>
|
||||
|
||||
<PasswordInput
|
||||
id="current_password"
|
||||
ref={currentPasswordInput}
|
||||
name="current_password"
|
||||
className="mt-1 block w-full"
|
||||
autoComplete="current-password"
|
||||
placeholder="Current password"
|
||||
/>
|
||||
|
||||
<InputError message={errors.current_password} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">New password</Label>
|
||||
|
||||
<PasswordInput
|
||||
id="password"
|
||||
ref={passwordInput}
|
||||
name="password"
|
||||
className="mt-1 block w-full"
|
||||
autoComplete="new-password"
|
||||
placeholder="New password"
|
||||
passwordrules={props.passwordRules}
|
||||
/>
|
||||
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password_confirmation">
|
||||
Confirm password
|
||||
</Label>
|
||||
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
name="password_confirmation"
|
||||
className="mt-1 block w-full"
|
||||
autoComplete="new-password"
|
||||
placeholder="Confirm password"
|
||||
passwordrules={props.passwordRules}
|
||||
/>
|
||||
|
||||
<InputError
|
||||
message={errors.password_confirmation}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Button
|
||||
disabled={processing}
|
||||
data-test="update-password-button"
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
{/* @chisel-2fa */}
|
||||
<ManageTwoFactor
|
||||
canManageTwoFactor={props.canManageTwoFactor}
|
||||
requiresConfirmation={props.requiresConfirmation}
|
||||
twoFactorEnabled={props.twoFactorEnabled}
|
||||
/>
|
||||
{/* @end-chisel-2fa */}
|
||||
|
||||
{/* @chisel-passkeys */}
|
||||
<ManagePasskeys
|
||||
canManagePasskeys={props.canManagePasskeys}
|
||||
passkeys={props.passkeys}
|
||||
/>
|
||||
{/* @end-chisel-passkeys */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Security.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Security settings',
|
||||
href: edit(),
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,353 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Field, button, control } from '../management/shared';
|
||||
import { titles, statuses, stages, roles } from './types';
|
||||
import type { Structure, StructureRecord, Chain } from './types';
|
||||
import ValueNetwork from './value-network';
|
||||
import type { ChainLink, Gap } from './value-network';
|
||||
|
||||
function ChainForm({ clusterId, chain }: { clusterId: string; chain?: Chain }) {
|
||||
const form = useForm({
|
||||
code: chain?.code ?? '',
|
||||
name: chain?.name ?? '',
|
||||
stage: chain?.stage ?? 'input',
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const url = `/management/clusters/${clusterId}/chains`;
|
||||
if (chain)
|
||||
form.put(`${url}/${chain.id}`, { preserveScroll: true });
|
||||
else
|
||||
form.post(url, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
{chain ? chain.name : 'Nova etapa'}
|
||||
</h3>
|
||||
<Field label="Código da etapa" error={form.errors.code}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData('code', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nome da etapa" error={form.errors.name}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.name}
|
||||
onChange={(e) => form.setData('name', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Fase da cadeia" error={form.errors.stage}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.stage}
|
||||
onChange={(e) => form.setData('stage', e.target.value)}
|
||||
>
|
||||
{Object.entries(stages).map(([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar etapa
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Editor({
|
||||
structure,
|
||||
record,
|
||||
projects,
|
||||
chains,
|
||||
memberships,
|
||||
chainLinks,
|
||||
gaps,
|
||||
}: {
|
||||
structure: Structure;
|
||||
record: StructureRecord | null;
|
||||
projects: { id: string; name: string; code: string }[];
|
||||
chains: Chain[];
|
||||
chainLinks: ChainLink[];
|
||||
gaps: Gap[];
|
||||
memberships: {
|
||||
id: string;
|
||||
project_id: string;
|
||||
name: string;
|
||||
role: string;
|
||||
}[];
|
||||
}) {
|
||||
const isProject = structure === 'projects';
|
||||
const form = useForm({
|
||||
code: record?.code ?? '',
|
||||
name: record?.name ?? '',
|
||||
status: record?.status ?? (isProject ? 'draft' : 'planned'),
|
||||
sector: record?.sector ?? '',
|
||||
description: record?.description ?? '',
|
||||
budget_amount: record?.budget_amount ?? '',
|
||||
budget_currency: record?.budget_currency ?? '',
|
||||
start_date: record?.start_date?.slice(0, 10) ?? '',
|
||||
end_date: record?.end_date?.slice(0, 10) ?? '',
|
||||
});
|
||||
const association = useForm({ project_id: '', role: 'complementary' });
|
||||
return (
|
||||
<Management
|
||||
title={`${record ? 'Editar' : 'Criar'} ${isProject ? 'projecto' : 'cluster'}`}
|
||||
>
|
||||
<Link className="underline" href={`/management/${structure}`}>
|
||||
Voltar a {titles[structure].toLowerCase()}
|
||||
</Link>
|
||||
<p>
|
||||
Registo interno de gestão. O estado activo não publica este
|
||||
conteúdo no portal.
|
||||
</p>
|
||||
<form
|
||||
className="max-w-3xl space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
if (record)
|
||||
form.put(`/management/${structure}/${record.id}`);
|
||||
else form.post(`/management/${structure}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Código" error={form.errors.code}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData('code', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nome" error={form.errors.name}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.name}
|
||||
onChange={(e) => form.setData('name', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Estado" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
{Object.entries(statuses[structure]).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
{!isProject && (
|
||||
<Field label="Sector do cluster" error={form.errors.sector}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.sector}
|
||||
onChange={(e) =>
|
||||
form.setData('sector', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{isProject && (
|
||||
<>
|
||||
<Field
|
||||
label="Descrição"
|
||||
error={form.errors.description}
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
rows={5}
|
||||
value={form.data.description}
|
||||
onChange={(e) =>
|
||||
form.setData('description', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Orçamento (use ponto para os decimais)"
|
||||
error={form.errors.budget_amount}
|
||||
>
|
||||
<input
|
||||
inputMode="decimal"
|
||||
className={control}
|
||||
value={form.data.budget_amount}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'budget_amount',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Moeda (código de três letras)"
|
||||
error={form.errors.budget_currency}
|
||||
>
|
||||
<input
|
||||
maxLength={3}
|
||||
className={control}
|
||||
value={form.data.budget_currency}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'budget_currency',
|
||||
e.target.value.toUpperCase(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Data de início"
|
||||
error={form.errors.start_date}
|
||||
>
|
||||
<input
|
||||
type="date"
|
||||
className={control}
|
||||
value={form.data.start_date}
|
||||
onChange={(e) =>
|
||||
form.setData('start_date', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Data de conclusão"
|
||||
error={form.errors.end_date}
|
||||
>
|
||||
<input
|
||||
type="date"
|
||||
className={control}
|
||||
value={form.data.end_date}
|
||||
onChange={(e) =>
|
||||
form.setData('end_date', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar
|
||||
</button>
|
||||
</form>
|
||||
{!isProject && record && (
|
||||
<>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Projectos associados
|
||||
</h2>
|
||||
{memberships.map((member) => (
|
||||
<p key={member.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/projects/${member.project_id}/edit`}
|
||||
>
|
||||
{member.name}
|
||||
</Link>{' '}
|
||||
· {roles[member.role]}
|
||||
</p>
|
||||
))}
|
||||
{!memberships.length && (
|
||||
<p>Ainda não existem projectos associados.</p>
|
||||
)}
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
association.post(
|
||||
`/management/clusters/${record.id}/projects`,
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
label="Projecto"
|
||||
error={association.errors.project_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={association.data.project_id}
|
||||
onChange={(e) =>
|
||||
association.setData(
|
||||
'project_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{projects.map((project) => (
|
||||
<option
|
||||
key={project.id}
|
||||
value={project.id}
|
||||
>
|
||||
{project.code} — {project.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Papel no cluster"
|
||||
error={association.errors.role}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={association.data.role}
|
||||
onChange={(e) =>
|
||||
association.setData(
|
||||
'role',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
{Object.entries(roles).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
<button
|
||||
className={button}
|
||||
disabled={association.processing}
|
||||
>
|
||||
Guardar associação
|
||||
</button>
|
||||
<p className="text-sm">
|
||||
Seleccionar um projecto já associado permite
|
||||
actualizar o seu papel.
|
||||
</p>
|
||||
</form>
|
||||
</section>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Etapas da cadeia de valor
|
||||
</h2>
|
||||
{chains.map((chain) => (
|
||||
<ChainForm
|
||||
key={chain.id}
|
||||
clusterId={record.id}
|
||||
chain={chain}
|
||||
/>
|
||||
))}
|
||||
<ChainForm clusterId={record.id} />
|
||||
</section>
|
||||
<ValueNetwork
|
||||
clusterId={record.id}
|
||||
chains={chains}
|
||||
links={chainLinks}
|
||||
gaps={gaps}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
Management,
|
||||
Field,
|
||||
Pagination,
|
||||
button,
|
||||
control,
|
||||
} from '../management/shared';
|
||||
import type { Paginated } from '../management/shared';
|
||||
import { titles, statuses } from './types';
|
||||
import type { Structure, StructureRecord } from './types';
|
||||
|
||||
export default function Index({
|
||||
structure,
|
||||
records,
|
||||
filters,
|
||||
}: {
|
||||
structure: Structure;
|
||||
records: Paginated<StructureRecord>;
|
||||
filters: { q?: string };
|
||||
}) {
|
||||
const form = useForm({ q: filters.q ?? '' });
|
||||
return (
|
||||
<Management title={titles[structure]}>
|
||||
<Link className={button} href={`/management/${structure}/create`}>
|
||||
{structure === 'projects' ? 'Criar projecto' : 'Criar cluster'}
|
||||
</Link>
|
||||
<form
|
||||
className="flex flex-wrap items-end gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.get(`/management/${structure}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Pesquisar por nome ou código">
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.q}
|
||||
onChange={(e) => form.setData('q', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
<div className="space-y-3">
|
||||
{records.data.map((record) => (
|
||||
<article
|
||||
key={record.id}
|
||||
className="rounded border p-4 break-words"
|
||||
>
|
||||
<Link
|
||||
className="font-semibold underline"
|
||||
href={`/management/${structure}/${record.id}/edit`}
|
||||
>
|
||||
{record.name}
|
||||
</Link>
|
||||
<p>
|
||||
{record.code} · {statuses[structure][record.status]}
|
||||
</p>
|
||||
{record.sector && <p>{record.sector}</p>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!records.data.length && <p>Nenhum registo encontrado.</p>}
|
||||
<Pagination page={records} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
export type Structure = 'projects' | 'clusters';
|
||||
export type StructureRecord = {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
status: string;
|
||||
sector?: string;
|
||||
description?: string | null;
|
||||
budget_amount?: string | null;
|
||||
budget_currency?: string | null;
|
||||
start_date?: string | null;
|
||||
end_date?: string | null;
|
||||
};
|
||||
export const titles = { projects: 'Projectos', clusters: 'Clusters' };
|
||||
export const statuses: Record<Structure, Record<string, string>> = {
|
||||
projects: {
|
||||
draft: 'Rascunho',
|
||||
planned: 'Planeado',
|
||||
active: 'Activo',
|
||||
suspended: 'Suspenso',
|
||||
completed: 'Concluído',
|
||||
cancelled: 'Cancelado',
|
||||
},
|
||||
clusters: { planned: 'Planeado', active: 'Activo', inactive: 'Inactivo' },
|
||||
};
|
||||
export const stages: Record<string, string> = {
|
||||
input: 'Insumos',
|
||||
production: 'Produção',
|
||||
processing: 'Transformação',
|
||||
logistics: 'Logística',
|
||||
market: 'Mercado',
|
||||
};
|
||||
export const roles: Record<string, string> = {
|
||||
anchor: 'Âncora',
|
||||
complementary: 'Complementar',
|
||||
supporting: 'Apoio',
|
||||
};
|
||||
export type Chain = { id: string; code: string; name: string; stage: string };
|
||||
@@ -0,0 +1,313 @@
|
||||
import { useForm } from '@inertiajs/react';
|
||||
import { Field, button, control } from '../management/shared';
|
||||
import type { Chain } from './types';
|
||||
|
||||
export type ChainLink = {
|
||||
id: string;
|
||||
origin: string;
|
||||
destination: string;
|
||||
link_type: string;
|
||||
};
|
||||
export type Gap = {
|
||||
id: string;
|
||||
value_chain_id: string;
|
||||
title: string;
|
||||
location: string;
|
||||
required_capacity: string;
|
||||
rationale: string;
|
||||
status: string;
|
||||
call_to_action: string;
|
||||
};
|
||||
const linkTypes: Record<string, string> = {
|
||||
supplies: 'Fornece a',
|
||||
processes: 'Transforma para',
|
||||
distributes: 'Distribui para',
|
||||
supports: 'Apoia',
|
||||
};
|
||||
const gapStates: Record<string, string> = {
|
||||
identified: 'Identificada',
|
||||
in_review: 'Em análise',
|
||||
resolved: 'Resolvida',
|
||||
withdrawn: 'Retirada',
|
||||
};
|
||||
|
||||
function RemoveLink({
|
||||
clusterId,
|
||||
link,
|
||||
}: {
|
||||
clusterId: string;
|
||||
link: ChainLink;
|
||||
}) {
|
||||
const form = useForm({});
|
||||
return (
|
||||
<li className="flex flex-wrap items-center justify-between gap-3 rounded border p-3 break-words">
|
||||
<span>
|
||||
{link.origin} → {linkTypes[link.link_type]} → {link.destination}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className="underline disabled:opacity-50"
|
||||
disabled={form.processing}
|
||||
aria-label={`Retirar ligação de ${link.origin} para ${link.destination}`}
|
||||
onClick={() =>
|
||||
form.delete(
|
||||
`/management/clusters/${clusterId}/chain-links/${link.id}`,
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar ligação
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function GapForm({
|
||||
clusterId,
|
||||
chains,
|
||||
gap,
|
||||
}: {
|
||||
clusterId: string;
|
||||
chains: Chain[];
|
||||
gap?: Gap;
|
||||
}) {
|
||||
const form = useForm({
|
||||
value_chain_id: gap?.value_chain_id ?? '',
|
||||
title: gap?.title ?? '',
|
||||
location: gap?.location ?? '',
|
||||
required_capacity: gap?.required_capacity ?? '',
|
||||
rationale: gap?.rationale ?? '',
|
||||
status: gap?.status ?? 'identified',
|
||||
call_to_action: gap?.call_to_action ?? '',
|
||||
});
|
||||
const textFields = {
|
||||
title: 'Título da lacuna',
|
||||
location: 'Localização',
|
||||
required_capacity: 'Capacidade necessária',
|
||||
rationale: 'Justificação',
|
||||
call_to_action: 'Chamada para acção',
|
||||
} as const;
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const url = `/management/clusters/${clusterId}/gaps`;
|
||||
if (gap) form.put(`${url}/${gap.id}`, { preserveScroll: true });
|
||||
else
|
||||
form.post(url, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h3 className="font-semibold">{gap ? gap.title : 'Nova lacuna'}</h3>
|
||||
<Field label="Etapa com lacuna" error={form.errors.value_chain_id}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.value_chain_id}
|
||||
onChange={(e) =>
|
||||
form.setData('value_chain_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{chains.map((chain) => (
|
||||
<option key={chain.id} value={chain.id}>
|
||||
{chain.code} — {chain.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{(Object.keys(textFields) as (keyof typeof textFields)[]).map(
|
||||
(field) => (
|
||||
<Field
|
||||
key={field}
|
||||
label={textFields[field]}
|
||||
error={form.errors[field]}
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
rows={field === 'title' ? 1 : 2}
|
||||
value={form.data[field]}
|
||||
onChange={(e) =>
|
||||
form.setData(field, e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
),
|
||||
)}
|
||||
<Field label="Estado da lacuna" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
{Object.entries(gapStates).map(([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar lacuna
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ValueNetwork({
|
||||
clusterId,
|
||||
chains,
|
||||
links,
|
||||
gaps,
|
||||
}: {
|
||||
clusterId: string;
|
||||
chains: Chain[];
|
||||
links: ChainLink[];
|
||||
gaps: Gap[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
from_value_chain_id: '',
|
||||
to_value_chain_id: '',
|
||||
link_type: 'supplies',
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">Ligações entre etapas</h2>
|
||||
{links.length ? (
|
||||
<ul className="space-y-2">
|
||||
{links.map((link) => (
|
||||
<RemoveLink
|
||||
key={link.id}
|
||||
clusterId={clusterId}
|
||||
link={link}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p>Ainda não existem ligações entre etapas.</p>
|
||||
)}
|
||||
{chains.length < 2 ? (
|
||||
<p>Crie pelo menos duas etapas para as ligar.</p>
|
||||
) : (
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(
|
||||
`/management/clusters/${clusterId}/chain-links`,
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
label="Etapa de origem"
|
||||
error={form.errors.from_value_chain_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.from_value_chain_id}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'from_value_chain_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{chains.map((chain) => (
|
||||
<option key={chain.id} value={chain.id}>
|
||||
{chain.code} — {chain.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Etapa de destino"
|
||||
error={form.errors.to_value_chain_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.to_value_chain_id}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'to_value_chain_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{chains
|
||||
.filter(
|
||||
(chain) =>
|
||||
chain.id !==
|
||||
form.data.from_value_chain_id,
|
||||
)
|
||||
.map((chain) => (
|
||||
<option key={chain.id} value={chain.id}>
|
||||
{chain.code} — {chain.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Tipo de ligação"
|
||||
error={form.errors.link_type}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.link_type}
|
||||
onChange={(e) =>
|
||||
form.setData('link_type', e.target.value)
|
||||
}
|
||||
>
|
||||
{Object.entries(linkTypes).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar ligação
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</section>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Lacunas de investimento
|
||||
</h2>
|
||||
<p>
|
||||
{
|
||||
gaps.filter((gap) =>
|
||||
['identified', 'in_review'].includes(gap.status),
|
||||
).length
|
||||
}{' '}
|
||||
lacunas por resolver.
|
||||
</p>
|
||||
{gaps.map((gap) => (
|
||||
<details key={gap.id} className="rounded border p-3">
|
||||
<summary className="cursor-pointer break-words">
|
||||
{gap.title} · {gapStates[gap.status]}
|
||||
</summary>
|
||||
<GapForm
|
||||
clusterId={clusterId}
|
||||
chains={chains}
|
||||
gap={gap}
|
||||
/>
|
||||
</details>
|
||||
))}
|
||||
{chains.length ? (
|
||||
<GapForm clusterId={clusterId} chains={chains} />
|
||||
) : (
|
||||
<p>Crie uma etapa antes de registar lacunas.</p>
|
||||
)}
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
import { Head, Link, usePage } from '@inertiajs/react';
|
||||
import { dashboard, login } from '@/routes';
|
||||
/* @chisel-registration */
|
||||
import { register } from '@/routes';
|
||||
/* @end-chisel-registration */
|
||||
|
||||
export default function Welcome() {
|
||||
const { auth } = usePage().props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Welcome" />
|
||||
<div className="flex min-h-screen flex-col items-center bg-[#FDFDFC] p-6 text-[#1b1b18] lg:justify-center lg:p-8 dark:bg-[#0a0a0a]">
|
||||
<header className="mb-6 w-full max-w-[335px] text-sm not-has-[nav]:hidden lg:max-w-4xl">
|
||||
<nav className="flex items-center justify-end gap-4">
|
||||
{auth.user ? (
|
||||
<Link
|
||||
href={dashboard()}
|
||||
className="inline-block rounded-sm border border-[#19140035] px-5 py-1.5 text-sm leading-normal text-[#1b1b18] hover:border-[#1915014a] dark:border-[#3E3E3A] dark:text-[#EDEDEC] dark:hover:border-[#62605b]"
|
||||
>
|
||||
Dashboard
|
||||
</Link>
|
||||
) : (
|
||||
<>
|
||||
<Link
|
||||
href={login()}
|
||||
className="inline-block rounded-sm border border-transparent px-5 py-1.5 text-sm leading-normal text-[#1b1b18] hover:border-[#19140035] dark:text-[#EDEDEC] dark:hover:border-[#3E3E3A]"
|
||||
>
|
||||
Log in
|
||||
</Link>
|
||||
{/* @chisel-registration */}
|
||||
<Link
|
||||
href={register()}
|
||||
className="inline-block rounded-sm border border-[#19140035] px-5 py-1.5 text-sm leading-normal text-[#1b1b18] hover:border-[#1915014a] dark:border-[#3E3E3A] dark:text-[#EDEDEC] dark:hover:border-[#62605b]"
|
||||
>
|
||||
Register
|
||||
</Link>
|
||||
{/* @end-chisel-registration */}
|
||||
</>
|
||||
)}
|
||||
</nav>
|
||||
</header>
|
||||
<div className="flex w-full items-center justify-center opacity-100 transition-opacity duration-750 lg:grow starting:opacity-0">
|
||||
<main className="flex w-full max-w-[335px] flex-col-reverse lg:max-w-4xl lg:flex-row">
|
||||
<div className="flex-1 rounded-br-lg rounded-bl-lg bg-white p-6 pb-12 text-[13px] leading-[20px] shadow-[inset_0px_0px_0px_1px_rgba(26,26,0,0.16)] lg:rounded-tl-lg lg:rounded-br-none lg:p-20 dark:bg-[#161615] dark:text-[#EDEDEC] dark:shadow-[inset_0px_0px_0px_1px_#fffaed2d]">
|
||||
<h1 className="mb-1 font-medium">
|
||||
Let's get started
|
||||
</h1>
|
||||
<p className="mb-2 text-[#706f6c] dark:text-[#A1A09A]">
|
||||
Laravel has an incredibly rich ecosystem.
|
||||
<br />
|
||||
We suggest starting with the following.
|
||||
</p>
|
||||
<ul className="mb-4 flex flex-col lg:mb-6">
|
||||
<li className="relative flex items-center gap-4 py-2 before:absolute before:top-1/2 before:bottom-0 before:left-[0.4rem] before:border-l before:border-[#e3e3e0] dark:before:border-[#3E3E3A]">
|
||||
<span className="relative bg-white py-1 dark:bg-[#161615]">
|
||||
<span className="flex h-3.5 w-3.5 items-center justify-center rounded-full border border-[#e3e3e0] bg-[#FDFDFC] shadow-[0px_0px_1px_0px_rgba(0,0,0,0.03),0px_1px_2px_0px_rgba(0,0,0,0.06)] dark:border-[#3E3E3A] dark:bg-[#161615]">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#dbdbd7] dark:bg-[#3E3E3A]" />
|
||||
</span>
|
||||
</span>
|
||||
<span>
|
||||
Read the
|
||||
<a
|
||||
href="https://laravel.com/docs"
|
||||
target="_blank"
|
||||
className="ml-1 inline-flex items-center space-x-1 font-medium text-[#f53003] underline underline-offset-4 dark:text-[#FF4433]"
|
||||
>
|
||||
<span>Documentation</span>
|
||||
<svg
|
||||
width={10}
|
||||
height={11}
|
||||
viewBox="0 0 10 11"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="h-2.5 w-2.5"
|
||||
>
|
||||
<path
|
||||
d="M7.70833 6.95834V2.79167H3.54167M2.5 8L7.5 3.00001"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="square"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</span>
|
||||
</li>
|
||||
<li className="relative flex items-center gap-4 py-2 before:absolute before:top-0 before:bottom-1/2 before:left-[0.4rem] before:border-l before:border-[#e3e3e0] dark:before:border-[#3E3E3A]">
|
||||
<span className="relative bg-white py-1 dark:bg-[#161615]">
|
||||
<span className="flex h-3.5 w-3.5 items-center justify-center rounded-full border border-[#e3e3e0] bg-[#FDFDFC] shadow-[0px_0px_1px_0px_rgba(0,0,0,0.03),0px_1px_2px_0px_rgba(0,0,0,0.06)] dark:border-[#3E3E3A] dark:bg-[#161615]">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#dbdbd7] dark:bg-[#3E3E3A]" />
|
||||
</span>
|
||||
</span>
|
||||
<span>
|
||||
Watch video tutorials at
|
||||
<a
|
||||
href="https://laracasts.com"
|
||||
target="_blank"
|
||||
className="ml-1 inline-flex items-center space-x-1 font-medium text-[#f53003] underline underline-offset-4 dark:text-[#FF4433]"
|
||||
>
|
||||
<span>Laracasts</span>
|
||||
<svg
|
||||
width={10}
|
||||
height={11}
|
||||
viewBox="0 0 10 11"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="h-2.5 w-2.5"
|
||||
>
|
||||
<path
|
||||
d="M7.70833 6.95834V2.79167H3.54167M2.5 8L7.5 3.00001"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="square"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className="flex gap-3 text-sm leading-normal">
|
||||
<li>
|
||||
<a
|
||||
href="https://cloud.laravel.com"
|
||||
target="_blank"
|
||||
className="inline-block rounded-sm border border-black bg-[#1b1b18] px-5 py-1.5 text-sm leading-normal text-white hover:border-black hover:bg-black dark:border-[#eeeeec] dark:bg-[#eeeeec] dark:text-[#1C1C1A] dark:hover:border-white dark:hover:bg-white"
|
||||
>
|
||||
Deploy now
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="relative -mb-px aspect-[335/364] w-full shrink-0 overflow-hidden rounded-t-lg bg-[#fff2f2] lg:mb-0 lg:-ml-px lg:aspect-auto lg:w-[438px] lg:rounded-t-none lg:rounded-r-lg dark:bg-[#1D0002]">
|
||||
{/* Laravel Logo */}
|
||||
<svg
|
||||
className="w-full max-w-none translate-y-0 text-[#F53003] opacity-100 transition-all duration-750 dark:text-[#F61500] starting:opacity-0 motion-safe:starting:translate-y-6"
|
||||
viewBox="0 0 438 104"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M17.2036 -3H0V102.197H49.5189V86.7187H17.2036V-3Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M110.256 41.6337C108.061 38.1275 104.945 35.3731 100.905 33.3681C96.8667 31.3647 92.8016 30.3618 88.7131 30.3618C83.4247 30.3618 78.5885 31.3389 74.201 33.2923C69.8111 35.2456 66.0474 37.928 62.9059 41.3333C59.7643 44.7401 57.3198 48.6726 55.5754 53.1293C53.8287 57.589 52.9572 62.274 52.9572 67.1813C52.9572 72.1925 53.8287 76.8995 55.5754 81.3069C57.3191 85.7173 59.7636 89.6241 62.9059 93.0293C66.0474 96.4361 69.8119 99.1155 74.201 101.069C78.5885 103.022 83.4247 103.999 88.7131 103.999C92.8016 103.999 96.8667 102.997 100.905 100.994C104.945 98.9911 108.061 96.2359 110.256 92.7282V102.195H126.563V32.1642H110.256V41.6337ZM108.76 75.7472C107.762 78.4531 106.366 80.8078 104.572 82.8112C102.776 84.8161 100.606 86.4183 98.0637 87.6206C95.5202 88.823 92.7004 89.4238 89.6103 89.4238C86.5178 89.4238 83.7252 88.823 81.2324 87.6206C78.7388 86.4183 76.5949 84.8161 74.7998 82.8112C73.004 80.8078 71.6319 78.4531 70.6856 75.7472C69.7356 73.0421 69.2644 70.1868 69.2644 67.1821C69.2644 64.1758 69.7356 61.3205 70.6856 58.6154C71.6319 55.9102 73.004 53.5571 74.7998 51.5522C76.5949 49.5495 78.738 47.9451 81.2324 46.7427C83.7252 45.5404 86.5178 44.9396 89.6103 44.9396C92.7012 44.9396 95.5202 45.5404 98.0637 46.7427C100.606 47.9451 102.776 49.5487 104.572 51.5522C106.367 53.5571 107.762 55.9102 108.76 58.6154C109.756 61.3205 110.256 64.1758 110.256 67.1821C110.256 70.1868 109.756 73.0421 108.76 75.7472Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M242.805 41.6337C240.611 38.1275 237.494 35.3731 233.455 33.3681C229.416 31.3647 225.351 30.3618 221.262 30.3618C215.974 30.3618 211.138 31.3389 206.75 33.2923C202.36 35.2456 198.597 37.928 195.455 41.3333C192.314 44.7401 189.869 48.6726 188.125 53.1293C186.378 57.589 185.507 62.274 185.507 67.1813C185.507 72.1925 186.378 76.8995 188.125 81.3069C189.868 85.7173 192.313 89.6241 195.455 93.0293C198.597 96.4361 202.361 99.1155 206.75 101.069C211.138 103.022 215.974 103.999 221.262 103.999C225.351 103.999 229.416 102.997 233.455 100.994C237.494 98.9911 240.611 96.2359 242.805 92.7282V102.195H259.112V32.1642H242.805V41.6337ZM241.31 75.7472C240.312 78.4531 238.916 80.8078 237.122 82.8112C235.326 84.8161 233.156 86.4183 230.614 87.6206C228.07 88.823 225.251 89.4238 222.16 89.4238C219.068 89.4238 216.275 88.823 213.782 87.6206C211.289 86.4183 209.145 84.8161 207.35 82.8112C205.554 80.8078 204.182 78.4531 203.236 75.7472C202.286 73.0421 201.814 70.1868 201.814 67.1821C201.814 64.1758 202.286 61.3205 203.236 58.6154C204.182 55.9102 205.554 53.5571 207.35 51.5522C209.145 49.5495 211.288 47.9451 213.782 46.7427C216.275 45.5404 219.068 44.9396 222.16 44.9396C225.251 44.9396 228.07 45.5404 230.614 46.7427C233.156 47.9451 235.326 49.5487 237.122 51.5522C238.917 53.5571 240.312 55.9102 241.31 58.6154C242.306 61.3205 242.806 64.1758 242.806 67.1821C242.805 70.1868 242.305 73.0421 241.31 75.7472Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M438 -3H421.694V102.197H438V-3Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M139.43 102.197H155.735V48.2834H183.712V32.1665H139.43V102.197Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M324.49 32.1665L303.995 85.794L283.498 32.1665H266.983L293.748 102.197H314.242L341.006 32.1665H324.49Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M376.571 30.3656C356.603 30.3656 340.797 46.8497 340.797 67.1828C340.797 89.6597 356.094 104 378.661 104C391.29 104 399.354 99.1488 409.206 88.5848L398.189 80.0226C398.183 80.031 389.874 90.9895 377.468 90.9895C363.048 90.9895 356.977 79.3111 356.977 73.269H411.075C413.917 50.1328 398.775 30.3656 376.571 30.3656ZM357.02 61.0967C357.145 59.7487 359.023 43.3761 376.442 43.3761C393.861 43.3761 395.978 59.7464 396.099 61.0967H357.02Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
{/* 13 */}
|
||||
<svg
|
||||
className="relative -mt-[6.6rem] -ml-8 w-[438px] max-w-none [--stroke-color:#1B1B18] lg:ml-0 dark:[--stroke-color:#FF750F]"
|
||||
viewBox="0 0 440 392"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<g className="text-[#1B1B18] opacity-100 mix-blend-darken transition-all delay-300 duration-750 dark:text-black dark:mix-blend-normal starting:opacity-0">
|
||||
<mask
|
||||
id="path-1-mask"
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="-0.328613"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
fill="black"
|
||||
>
|
||||
<rect
|
||||
fill="white"
|
||||
x="-0.328613"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
/>
|
||||
<path d="M234.936 400.8C204.136 400.8 178.936 392.4 159.336 375.6C140.136 358.8 130.536 337 130.536 310.2H200.736C200.736 318.2 203.736 324.8 209.736 330C215.736 335.2 223.736 337.8 233.736 337.8C243.336 337.8 251.136 335 257.136 329.4C263.536 323.8 266.736 316.6 266.736 307.8C266.736 299.8 263.936 293.2 258.336 288C252.736 282.8 245.536 280.2 236.736 280.2H199.536V218.4H236.736C243.536 218.4 249.336 216 254.136 211.2C258.936 206.4 261.336 200.4 261.336 193.2C261.336 184.8 258.736 178.2 253.536 173.4C248.336 168.6 241.736 166.2 233.736 166.2C226.536 166.2 220.336 168.4 215.136 172.8C210.336 177.2 207.936 182.8 207.936 189.6H141.336C141.336 164.8 150.136 144.6 167.736 129C185.336 113 207.936 105 235.536 105C263.136 105 285.536 112.2 302.736 126.6C320.336 141 329.136 160 329.136 183.6C329.136 200.8 324.536 214.8 315.336 225.6C306.136 236 294.336 243.2 279.936 247.2C297.136 252 310.736 260.2 320.736 271.8C331.136 283.4 336.336 298 336.336 315.6C336.336 340.4 326.936 360.8 308.136 376.8C289.336 392.8 264.936 400.8 234.936 400.8Z" />
|
||||
<path d="M26.8714 167.6H1.67139V105.2H94.6714V400.2H26.8714V167.6Z" />
|
||||
</mask>
|
||||
<path
|
||||
d="M234.936 400.8C204.136 400.8 178.936 392.4 159.336 375.6C140.136 358.8 130.536 337 130.536 310.2H200.736C200.736 318.2 203.736 324.8 209.736 330C215.736 335.2 223.736 337.8 233.736 337.8C243.336 337.8 251.136 335 257.136 329.4C263.536 323.8 266.736 316.6 266.736 307.8C266.736 299.8 263.936 293.2 258.336 288C252.736 282.8 245.536 280.2 236.736 280.2H199.536V218.4H236.736C243.536 218.4 249.336 216 254.136 211.2C258.936 206.4 261.336 200.4 261.336 193.2C261.336 184.8 258.736 178.2 253.536 173.4C248.336 168.6 241.736 166.2 233.736 166.2C226.536 166.2 220.336 168.4 215.136 172.8C210.336 177.2 207.936 182.8 207.936 189.6H141.336C141.336 164.8 150.136 144.6 167.736 129C185.336 113 207.936 105 235.536 105C263.136 105 285.536 112.2 302.736 126.6C320.336 141 329.136 160 329.136 183.6C329.136 200.8 324.536 214.8 315.336 225.6C306.136 236 294.336 243.2 279.936 247.2C297.136 252 310.736 260.2 320.736 271.8C331.136 283.4 336.336 298 336.336 315.6C336.336 340.4 326.936 360.8 308.136 376.8C289.336 392.8 264.936 400.8 234.936 400.8Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M26.8714 167.6H1.67139V105.2H94.6714V400.2H26.8714V167.6Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M234.936 400.8C204.136 400.8 178.936 392.4 159.336 375.6C140.136 358.8 130.536 337 130.536 310.2H200.736C200.736 318.2 203.736 324.8 209.736 330C215.736 335.2 223.736 337.8 233.736 337.8C243.336 337.8 251.136 335 257.136 329.4C263.536 323.8 266.736 316.6 266.736 307.8C266.736 299.8 263.936 293.2 258.336 288C252.736 282.8 245.536 280.2 236.736 280.2H199.536V218.4H236.736C243.536 218.4 249.336 216 254.136 211.2C258.936 206.4 261.336 200.4 261.336 193.2C261.336 184.8 258.736 178.2 253.536 173.4C248.336 168.6 241.736 166.2 233.736 166.2C226.536 166.2 220.336 168.4 215.136 172.8C210.336 177.2 207.936 182.8 207.936 189.6H141.336C141.336 164.8 150.136 144.6 167.736 129C185.336 113 207.936 105 235.536 105C263.136 105 285.536 112.2 302.736 126.6C320.336 141 329.136 160 329.136 183.6C329.136 200.8 324.536 214.8 315.336 225.6C306.136 236 294.336 243.2 279.936 247.2C297.136 252 310.736 260.2 320.736 271.8C331.136 283.4 336.336 298 336.336 315.6C336.336 340.4 326.936 360.8 308.136 376.8C289.336 392.8 264.936 400.8 234.936 400.8Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-1-mask)"
|
||||
/>
|
||||
<path
|
||||
d="M26.8714 167.6H1.67139V105.2H94.6714V400.2H26.8714V167.6Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-1-mask)"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<g className="text-[#F3BEC7] opacity-100 transition-all delay-400 duration-750 dark:text-[#4B0600] starting:opacity-0 motion-safe:starting:-translate-x-[26px]">
|
||||
<mask
|
||||
id="path-2-mask"
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="25.3357"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
fill="black"
|
||||
>
|
||||
<rect
|
||||
fill="white"
|
||||
x="25.3357"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
/>
|
||||
<path d="M260.6 400.8C229.8 400.8 204.6 392.4 185 375.6C165.8 358.8 156.2 337 156.2 310.2H226.4C226.4 318.2 229.4 324.8 235.4 330C241.4 335.2 249.4 337.8 259.4 337.8C269 337.8 276.8 335 282.8 329.4C289.2 323.8 292.4 316.6 292.4 307.8C292.4 299.8 289.6 293.2 284 288C278.4 282.8 271.2 280.2 262.4 280.2H225.2V218.4H262.4C269.2 218.4 275 216 279.8 211.2C284.6 206.4 287 200.4 287 193.2C287 184.8 284.4 178.2 279.2 173.4C274 168.6 267.4 166.2 259.4 166.2C252.2 166.2 246 168.4 240.8 172.8C236 177.2 233.6 182.8 233.6 189.6H167C167 164.8 175.8 144.6 193.4 129C211 113 233.6 105 261.2 105C288.8 105 311.2 112.2 328.4 126.6C346 141 354.8 160 354.8 183.6C354.8 200.8 350.2 214.8 341 225.6C331.8 236 320 243.2 305.6 247.2C322.8 252 336.4 260.2 346.4 271.8C356.8 283.4 362 298 362 315.6C362 340.4 352.6 360.8 333.8 376.8C315 392.8 290.6 400.8 260.6 400.8Z" />
|
||||
<path d="M52.5357 167.6H27.3357V105.2H120.336V400.2H52.5357V167.6Z" />
|
||||
</mask>
|
||||
<path
|
||||
d="M260.6 400.8C229.8 400.8 204.6 392.4 185 375.6C165.8 358.8 156.2 337 156.2 310.2H226.4C226.4 318.2 229.4 324.8 235.4 330C241.4 335.2 249.4 337.8 259.4 337.8C269 337.8 276.8 335 282.8 329.4C289.2 323.8 292.4 316.6 292.4 307.8C292.4 299.8 289.6 293.2 284 288C278.4 282.8 271.2 280.2 262.4 280.2H225.2V218.4H262.4C269.2 218.4 275 216 279.8 211.2C284.6 206.4 287 200.4 287 193.2C287 184.8 284.4 178.2 279.2 173.4C274 168.6 267.4 166.2 259.4 166.2C252.2 166.2 246 168.4 240.8 172.8C236 177.2 233.6 182.8 233.6 189.6H167C167 164.8 175.8 144.6 193.4 129C211 113 233.6 105 261.2 105C288.8 105 311.2 112.2 328.4 126.6C346 141 354.8 160 354.8 183.6C354.8 200.8 350.2 214.8 341 225.6C331.8 236 320 243.2 305.6 247.2C322.8 252 336.4 260.2 346.4 271.8C356.8 283.4 362 298 362 315.6C362 340.4 352.6 360.8 333.8 376.8C315 392.8 290.6 400.8 260.6 400.8Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M52.5357 167.6H27.3357V105.2H120.336V400.2H52.5357V167.6Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M260.6 400.8C229.8 400.8 204.6 392.4 185 375.6C165.8 358.8 156.2 337 156.2 310.2H226.4C226.4 318.2 229.4 324.8 235.4 330C241.4 335.2 249.4 337.8 259.4 337.8C269 337.8 276.8 335 282.8 329.4C289.2 323.8 292.4 316.6 292.4 307.8C292.4 299.8 289.6 293.2 284 288C278.4 282.8 271.2 280.2 262.4 280.2H225.2V218.4H262.4C269.2 218.4 275 216 279.8 211.2C284.6 206.4 287 200.4 287 193.2C287 184.8 284.4 178.2 279.2 173.4C274 168.6 267.4 166.2 259.4 166.2C252.2 166.2 246 168.4 240.8 172.8C236 177.2 233.6 182.8 233.6 189.6H167C167 164.8 175.8 144.6 193.4 129C211 113 233.6 105 261.2 105C288.8 105 311.2 112.2 328.4 126.6C346 141 354.8 160 354.8 183.6C354.8 200.8 350.2 214.8 341 225.6C331.8 236 320 243.2 305.6 247.2C322.8 252 336.4 260.2 346.4 271.8C356.8 283.4 362 298 362 315.6C362 340.4 352.6 360.8 333.8 376.8C315 392.8 290.6 400.8 260.6 400.8Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-2-mask)"
|
||||
/>
|
||||
<path
|
||||
d="M52.5357 167.6H27.3357V105.2H120.336V400.2H52.5357V167.6Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-2-mask)"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<g className="text-[#F8B803] opacity-100 mix-blend-color transition-all delay-400 duration-750 dark:text-[#391800] dark:mix-blend-hard-light starting:opacity-0 motion-safe:starting:-translate-x-[51px]">
|
||||
<mask
|
||||
id="path-3-mask"
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="51"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
fill="black"
|
||||
>
|
||||
<rect
|
||||
fill="white"
|
||||
x="51"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
/>
|
||||
<path d="M286.264 400.8C255.464 400.8 230.264 392.4 210.664 375.6C191.464 358.8 181.864 337 181.864 310.2H252.064C252.064 318.2 255.064 324.8 261.064 330C267.064 335.2 275.064 337.8 285.064 337.8C294.664 337.8 302.464 335 308.464 329.4C314.864 323.8 318.064 316.6 318.064 307.8C318.064 299.8 315.264 293.2 309.664 288C304.064 282.8 296.864 280.2 288.064 280.2H250.864V218.4H288.064C294.864 218.4 300.664 216 305.464 211.2C310.264 206.4 312.664 200.4 312.664 193.2C312.664 184.8 310.064 178.2 304.864 173.4C299.664 168.6 293.064 166.2 285.064 166.2C277.864 166.2 271.664 168.4 266.464 172.8C261.664 177.2 259.264 182.8 259.264 189.6H192.664C192.664 164.8 201.464 144.6 219.064 129C236.664 113 259.264 105 286.864 105C314.464 105 336.864 112.2 354.064 126.6C371.664 141 380.464 160 380.464 183.6C380.464 200.8 375.864 214.8 366.664 225.6C357.464 236 345.664 243.2 331.264 247.2C348.464 252 362.064 260.2 372.064 271.8C382.464 283.4 387.664 298 387.664 315.6C387.664 340.4 378.264 360.8 359.464 376.8C340.664 392.8 316.264 400.8 286.264 400.8Z" />
|
||||
<path d="M78.2 167.6H53V105.2H146V400.2H78.2V167.6Z" />
|
||||
</mask>
|
||||
<path
|
||||
d="M286.264 400.8C255.464 400.8 230.264 392.4 210.664 375.6C191.464 358.8 181.864 337 181.864 310.2H252.064C252.064 318.2 255.064 324.8 261.064 330C267.064 335.2 275.064 337.8 285.064 337.8C294.664 337.8 302.464 335 308.464 329.4C314.864 323.8 318.064 316.6 318.064 307.8C318.064 299.8 315.264 293.2 309.664 288C304.064 282.8 296.864 280.2 288.064 280.2H250.864V218.4H288.064C294.864 218.4 300.664 216 305.464 211.2C310.264 206.4 312.664 200.4 312.664 193.2C312.664 184.8 310.064 178.2 304.864 173.4C299.664 168.6 293.064 166.2 285.064 166.2C277.864 166.2 271.664 168.4 266.464 172.8C261.664 177.2 259.264 182.8 259.264 189.6H192.664C192.664 164.8 201.464 144.6 219.064 129C236.664 113 259.264 105 286.864 105C314.464 105 336.864 112.2 354.064 126.6C371.664 141 380.464 160 380.464 183.6C380.464 200.8 375.864 214.8 366.664 225.6C357.464 236 345.664 243.2 331.264 247.2C348.464 252 362.064 260.2 372.064 271.8C382.464 283.4 387.664 298 387.664 315.6C387.664 340.4 378.264 360.8 359.464 376.8C340.664 392.8 316.264 400.8 286.264 400.8Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M78.2 167.6H53V105.2H146V400.2H78.2V167.6Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M286.264 400.8C255.464 400.8 230.264 392.4 210.664 375.6C191.464 358.8 181.864 337 181.864 310.2H252.064C252.064 318.2 255.064 324.8 261.064 330C267.064 335.2 275.064 337.8 285.064 337.8C294.664 337.8 302.464 335 308.464 329.4C314.864 323.8 318.064 316.6 318.064 307.8C318.064 299.8 315.264 293.2 309.664 288C304.064 282.8 296.864 280.2 288.064 280.2H250.864V218.4H288.064C294.864 218.4 300.664 216 305.464 211.2C310.264 206.4 312.664 200.4 312.664 193.2C312.664 184.8 310.064 178.2 304.864 173.4C299.664 168.6 293.064 166.2 285.064 166.2C277.864 166.2 271.664 168.4 266.464 172.8C261.664 177.2 259.264 182.8 259.264 189.6H192.664C192.664 164.8 201.464 144.6 219.064 129C236.664 113 259.264 105 286.864 105C314.464 105 336.864 112.2 354.064 126.6C371.664 141 380.464 160 380.464 183.6C380.464 200.8 375.864 214.8 366.664 225.6C357.464 236 345.664 243.2 331.264 247.2C348.464 252 362.064 260.2 372.064 271.8C382.464 283.4 387.664 298 387.664 315.6C387.664 340.4 378.264 360.8 359.464 376.8C340.664 392.8 316.264 400.8 286.264 400.8Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-3-mask)"
|
||||
/>
|
||||
<path
|
||||
d="M78.2 167.6H53V105.2H146V400.2H78.2V167.6Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-3-mask)"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<g className="text-[#F3BEC7] opacity-100 mix-blend-multiply transition-all delay-400 duration-750 dark:text-[#733000] dark:mix-blend-normal starting:opacity-0 motion-safe:starting:-translate-x-[78px]">
|
||||
<mask
|
||||
id="path-4-mask"
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="76.6643"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
fill="black"
|
||||
>
|
||||
<rect
|
||||
fill="white"
|
||||
x="76.6643"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
/>
|
||||
<path d="M311.929 400.8C281.129 400.8 255.929 392.4 236.329 375.6C217.129 358.8 207.529 337 207.529 310.2H277.729C277.729 318.2 280.729 324.8 286.729 330C292.729 335.2 300.729 337.8 310.729 337.8C320.329 337.8 328.129 335 334.129 329.4C340.529 323.8 343.729 316.6 343.729 307.8C343.729 299.8 340.929 293.2 335.329 288C329.729 282.8 322.529 280.2 313.729 280.2H276.529V218.4H313.729C320.529 218.4 326.329 216 331.129 211.2C335.929 206.4 338.329 200.4 338.329 193.2C338.329 184.8 335.729 178.2 330.529 173.4C325.329 168.6 318.729 166.2 310.729 166.2C303.529 166.2 297.329 168.4 292.129 172.8C287.329 177.2 284.929 182.8 284.929 189.6H218.329C218.329 164.8 227.129 144.6 244.729 129C262.329 113 284.929 105 312.529 105C340.129 105 362.529 112.2 379.729 126.6C397.329 141 406.129 160 406.129 183.6C406.129 200.8 401.529 214.8 392.329 225.6C383.129 236 371.329 243.2 356.929 247.2C374.129 252 387.729 260.2 397.729 271.8C408.129 283.4 413.329 298 413.329 315.6C413.329 340.4 403.929 360.8 385.129 376.8C366.329 392.8 341.929 400.8 311.929 400.8Z" />
|
||||
<path d="M103.864 167.6H78.6643V105.2H171.664V400.2H103.864V167.6Z" />
|
||||
</mask>
|
||||
<path
|
||||
d="M311.929 400.8C281.129 400.8 255.929 392.4 236.329 375.6C217.129 358.8 207.529 337 207.529 310.2H277.729C277.729 318.2 280.729 324.8 286.729 330C292.729 335.2 300.729 337.8 310.729 337.8C320.329 337.8 328.129 335 334.129 329.4C340.529 323.8 343.729 316.6 343.729 307.8C343.729 299.8 340.929 293.2 335.329 288C329.729 282.8 322.529 280.2 313.729 280.2H276.529V218.4H313.729C320.529 218.4 326.329 216 331.129 211.2C335.929 206.4 338.329 200.4 338.329 193.2C338.329 184.8 335.729 178.2 330.529 173.4C325.329 168.6 318.729 166.2 310.729 166.2C303.529 166.2 297.329 168.4 292.129 172.8C287.329 177.2 284.929 182.8 284.929 189.6H218.329C218.329 164.8 227.129 144.6 244.729 129C262.329 113 284.929 105 312.529 105C340.129 105 362.529 112.2 379.729 126.6C397.329 141 406.129 160 406.129 183.6C406.129 200.8 401.529 214.8 392.329 225.6C383.129 236 371.329 243.2 356.929 247.2C374.129 252 387.729 260.2 397.729 271.8C408.129 283.4 413.329 298 413.329 315.6C413.329 340.4 403.929 360.8 385.129 376.8C366.329 392.8 341.929 400.8 311.929 400.8Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M103.864 167.6H78.6643V105.2H171.664V400.2H103.864V167.6Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M311.929 400.8C281.129 400.8 255.929 392.4 236.329 375.6C217.129 358.8 207.529 337 207.529 310.2H277.729C277.729 318.2 280.729 324.8 286.729 330C292.729 335.2 300.729 337.8 310.729 337.8C320.329 337.8 328.129 335 334.129 329.4C340.529 323.8 343.729 316.6 343.729 307.8C343.729 299.8 340.929 293.2 335.329 288C329.729 282.8 322.529 280.2 313.729 280.2H276.529V218.4H313.729C320.529 218.4 326.329 216 331.129 211.2C335.929 206.4 338.329 200.4 338.329 193.2C338.329 184.8 335.729 178.2 330.529 173.4C325.329 168.6 318.729 166.2 310.729 166.2C303.529 166.2 297.329 168.4 292.129 172.8C287.329 177.2 284.929 182.8 284.929 189.6H218.329C218.329 164.8 227.129 144.6 244.729 129C262.329 113 284.929 105 312.529 105C340.129 105 362.529 112.2 379.729 126.6C397.329 141 406.129 160 406.129 183.6C406.129 200.8 401.529 214.8 392.329 225.6C383.129 236 371.329 243.2 356.929 247.2C374.129 252 387.729 260.2 397.729 271.8C408.129 283.4 413.329 298 413.329 315.6C413.329 340.4 403.929 360.8 385.129 376.8C366.329 392.8 341.929 400.8 311.929 400.8Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-4-mask)"
|
||||
/>
|
||||
<path
|
||||
d="M103.864 167.6H78.6643V105.2H171.664V400.2H103.864V167.6Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-4-mask)"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<g className="text-[#F3BEC7] opacity-100 mix-blend-hard-light transition-all delay-400 duration-750 dark:text-[#4B0600] starting:opacity-0 motion-safe:starting:-translate-x-[102px]">
|
||||
<mask
|
||||
id="path-5-mask"
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="102.329"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
fill="black"
|
||||
>
|
||||
<rect
|
||||
fill="white"
|
||||
x="102.329"
|
||||
y="103"
|
||||
width="338"
|
||||
height="299"
|
||||
/>
|
||||
<path d="M337.593 400.8C306.793 400.8 281.593 392.4 261.993 375.6C242.793 358.8 233.193 337 233.193 310.2H303.393C303.393 318.2 306.393 324.8 312.393 330C318.393 335.2 326.393 337.8 336.393 337.8C345.993 337.8 353.793 335 359.793 329.4C366.193 323.8 369.393 316.6 369.393 307.8C369.393 299.8 366.593 293.2 360.993 288C355.393 282.8 348.193 280.2 339.393 280.2H302.193V218.4H339.393C346.193 218.4 351.993 216 356.793 211.2C361.593 206.4 363.993 200.4 363.993 193.2C363.993 184.8 361.393 178.2 356.193 173.4C350.993 168.6 344.393 166.2 336.393 166.2C329.193 166.2 322.993 168.4 317.793 172.8C312.993 177.2 310.593 182.8 310.593 189.6H243.993C243.993 164.8 252.793 144.6 270.393 129C287.993 113 310.593 105 338.193 105C365.793 105 388.193 112.2 405.393 126.6C422.993 141 431.793 160 431.793 183.6C431.793 200.8 427.193 214.8 417.993 225.6C408.793 236 396.993 243.2 382.593 247.2C399.793 252 413.393 260.2 423.393 271.8C433.793 283.4 438.993 298 438.993 315.6C438.993 340.4 429.593 360.8 410.793 376.8C391.993 392.8 367.593 400.8 337.593 400.8Z" />
|
||||
<path d="M129.529 167.6H104.329V105.2H197.329V400.2H129.529V167.6Z" />
|
||||
</mask>
|
||||
<path
|
||||
d="M337.593 400.8C306.793 400.8 281.593 392.4 261.993 375.6C242.793 358.8 233.193 337 233.193 310.2H303.393C303.393 318.2 306.393 324.8 312.393 330C318.393 335.2 326.393 337.8 336.393 337.8C345.993 337.8 353.793 335 359.793 329.4C366.193 323.8 369.393 316.6 369.393 307.8C369.393 299.8 366.593 293.2 360.993 288C355.393 282.8 348.193 280.2 339.393 280.2H302.193V218.4H339.393C346.193 218.4 351.993 216 356.793 211.2C361.593 206.4 363.993 200.4 363.993 193.2C363.993 184.8 361.393 178.2 356.193 173.4C350.993 168.6 344.393 166.2 336.393 166.2C329.193 166.2 322.993 168.4 317.793 172.8C312.993 177.2 310.593 182.8 310.593 189.6H243.993C243.993 164.8 252.793 144.6 270.393 129C287.993 113 310.593 105 338.193 105C365.793 105 388.193 112.2 405.393 126.6C422.993 141 431.793 160 431.793 183.6C431.793 200.8 427.193 214.8 417.993 225.6C408.793 236 396.993 243.2 382.593 247.2C399.793 252 413.393 260.2 423.393 271.8C433.793 283.4 438.993 298 438.993 315.6C438.993 340.4 429.593 360.8 410.793 376.8C391.993 392.8 367.593 400.8 337.593 400.8Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M129.529 167.6H104.329V105.2H197.329V400.2H129.529V167.6Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M337.593 400.8C306.793 400.8 281.593 392.4 261.993 375.6C242.793 358.8 233.193 337 233.193 310.2H303.393C303.393 318.2 306.393 324.8 312.393 330C318.393 335.2 326.393 337.8 336.393 337.8C345.993 337.8 353.793 335 359.793 329.4C366.193 323.8 369.393 316.6 369.393 307.8C369.393 299.8 366.593 293.2 360.993 288C355.393 282.8 348.193 280.2 339.393 280.2H302.193V218.4H339.393C346.193 218.4 351.993 216 356.793 211.2C361.593 206.4 363.993 200.4 363.993 193.2C363.993 184.8 361.393 178.2 356.193 173.4C350.993 168.6 344.393 166.2 336.393 166.2C329.193 166.2 322.993 168.4 317.793 172.8C312.993 177.2 310.593 182.8 310.593 189.6H243.993C243.993 164.8 252.793 144.6 270.393 129C287.993 113 310.593 105 338.193 105C365.793 105 388.193 112.2 405.393 126.6C422.993 141 431.793 160 431.793 183.6C431.793 200.8 427.193 214.8 417.993 225.6C408.793 236 396.993 243.2 382.593 247.2C399.793 252 413.393 260.2 423.393 271.8C433.793 283.4 438.993 298 438.993 315.6C438.993 340.4 429.593 360.8 410.793 376.8C391.993 392.8 367.593 400.8 337.593 400.8Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-5-mask)"
|
||||
/>
|
||||
<path
|
||||
d="M129.529 167.6H104.329V105.2H197.329V400.2H129.529V167.6Z"
|
||||
stroke="var(--stroke-color)"
|
||||
strokeWidth="2.4"
|
||||
mask="url(#path-5-mask)"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
<div className="absolute inset-0 rounded-t-lg shadow-[inset_0px_0px_0px_1px_rgba(26,26,0,0.16)] lg:rounded-t-none lg:rounded-r-lg dark:shadow-[inset_0px_0px_0px_1px_#fffaed2d]"></div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div className="hidden h-14.5 lg:block"></div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user