This commit is contained in:
2026-05-19 12:48:41 +07:00
parent 208a91b971
commit 55a0133ed4
23 changed files with 3781 additions and 22 deletions
+14 -11
View File
@@ -40,20 +40,26 @@ export default function RegistrationForm({
setSubmitState("sending");
const industryLabel = industries.find((o) => o.value === form.industry)?.label ?? "";
try {
const res = await fetch("/ipv6/api/submissions", {
const res = await fetch("/ipv6/api/payments/create-order/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "registration",
...form,
fullName: form.fullName,
phone: form.phone,
email: form.email,
company: form.company,
jobTitle: form.jobTitle,
industry: form.industry,
industryLabel,
notes: form.notes,
}),
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(typeof err?.error === "string" ? err.error : res.statusText);
}
setSubmitState("ok");
const { approvalUrl } = await res.json();
window.location.href = approvalUrl;
} catch {
setSubmitState("error");
}
@@ -69,6 +75,7 @@ export default function RegistrationForm({
<input
className="w-full bg-surface-container-low border border-white/10 rounded-lg px-4 py-3 text-on-surface placeholder:text-outline/40 transition-all"
placeholder="John Doe"
required
value={form.fullName}
onChange={(e) => setForm((s) => ({ ...s, fullName: e.target.value }))}
/>
@@ -88,6 +95,7 @@ export default function RegistrationForm({
className="w-full bg-surface-container-low border border-white/10 rounded-lg px-4 py-3 text-on-surface placeholder:text-outline/40 transition-all"
placeholder="john.doe@company.com"
type="email"
required
value={form.email}
onChange={(e) => setForm((s) => ({ ...s, email: e.target.value }))}
/>
@@ -177,17 +185,12 @@ export default function RegistrationForm({
type="submit"
disabled={submitState === "sending"}
>
{submitState === "sending" ? "Submitting…" : data.submit.label}
{submitState === "sending" ? "Đang xử lý..." : data.submit.label}
</button>
<SubmitToast
state={submitState}
successTitle="Registration received"
successMessage="Thank you. Your registration was saved and will appear in the admin console under Pending."
onDismiss={() => {
setSubmitState("idle");
setForm({ ...emptyRegistration });
}}
onDismiss={() => setSubmitState("idle")}
/>
<p className="mt-[16px] text-center text-outline text-[11px] tracking-widest opacity-60 uppercase">