802 lines
36 KiB
TypeScript
802 lines
36 KiB
TypeScript
import { Head, Link, useForm, usePage } from "@inertiajs/react";
|
||
import { useState } from "react";
|
||
import { PortalMenu } from "@/layouts/portal-navigation";
|
||
import { newSubmissionKey } from "@/lib/portal-api";
|
||
import { ProvinceSelect } from "@/components/investment-territory";
|
||
|
||
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]
|
||
}
|
||
{key === "province" ? (
|
||
<ProvinceSelect
|
||
value={form.data.province}
|
||
onChange={(province) => form.setData("province", province)}
|
||
className={input}
|
||
required
|
||
placeholder="Seleccione uma província"
|
||
label="Província"
|
||
/>
|
||
) : (
|
||
<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
|
||
]
|
||
}
|
||
{key === "province" ? (
|
||
<ProvinceSelect
|
||
value={filter.data.province}
|
||
onChange={(province) =>
|
||
filter.setData("province", province)
|
||
}
|
||
className={input}
|
||
placeholder="Todas as províncias"
|
||
label="Filtrar por província"
|
||
/>
|
||
) : (
|
||
<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>
|
||
);
|
||
}
|