@@ -1,16 +1,17 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { Link } from "@inertiajs/react";
|
||||
import type { FormEvent } from "react";
|
||||
import { newSubmissionKey } from "@/lib/portal-api";
|
||||
import { Frame, Field, button, card, input } from "./shared";
|
||||
|
||||
type Opportunity = { id: string; slug: string; title: string; sector?: { name: string } | null };
|
||||
type Props = { record: Opportunity; modalities: string[] };
|
||||
type Props = { record: Opportunity; modalities: string[]; returnUrl?: string };
|
||||
type Form = {
|
||||
fullName: string; email: string; phone: string; investorType: string; country: string;
|
||||
sectorInterest: string; modality: string; investmentRange: string; message: string; privacyConsent: boolean; shareWithProponent: boolean;
|
||||
};
|
||||
|
||||
export default function BusinessInterest({ record, modalities }: Props) {
|
||||
export default function BusinessInterest({ record, modalities, returnUrl = "/negocios" }: Props) {
|
||||
const [form, setForm] = useState<Form>({ fullName: "", email: "", phone: "", investorType: "empresa", country: "MZ", sectorInterest: record.sector?.name ?? "", modality: modalities[0] ?? "", investmentRange: "", message: "", privacyConsent: false, shareWithProponent: false });
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
@@ -38,6 +39,7 @@ export default function BusinessInterest({ record, modalities }: Props) {
|
||||
};
|
||||
return (
|
||||
<Frame title="Manifestar interesse">
|
||||
<Link href={returnUrl} className="underline">Voltar à oportunidade</Link>
|
||||
<p>Oportunidade: <strong>{record.title}</strong></p>
|
||||
{receipt ? <section className={card} role="status"><h2 className="text-xl font-bold">Pedido recebido</h2><p>Referência: {receipt}</p><p>A equipa fará a triagem antes de qualquer partilha com o proponente.</p></section> : (
|
||||
<form className={`${card} space-y-4`} onSubmit={submit}>
|
||||
|
||||
Reference in New Issue
Block a user