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 = { 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 = { data: T[]; prev_page_url: string | null; next_page_url: string | null; total: number; }; type Props = { section: string; filters?: Record; 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; categories?: string[]; topics?: string[]; partnerships?: Page; 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 = { 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 }) { return ( ); } 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 (
{ 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) }); }} >

{kind === "company" ? "Dados da empresa e do representante" : "Enviar pedido"}

{!auth.user && (

Pode enviar sem conta. Para acompanhar no Balcão Virtual,{" "} entre antes de enviar .

)} {( [ "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 ( ); })}