diff --git a/app/(main)/manager-signup/page.tsx b/app/(main)/manager-signup/page.tsx index faead35..66395b4 100644 --- a/app/(main)/manager-signup/page.tsx +++ b/app/(main)/manager-signup/page.tsx @@ -19,12 +19,14 @@ export default function ManagerSignupPage() { phone: "", password: "", eateryName: "", + bankAccount: "", // 1. Thêm bankAccount vào state }); const [errors, setErrors] = useState({ name: "", phone: "", password: "", eateryName: "", + bankAccount: "", // 2. Thêm bankAccount vào errors state submit: "", }); @@ -32,9 +34,6 @@ export default function ManagerSignupPage() { fetch("/api/manager/signup") .then((res) => { setPageState("available"); - // if (res.ok) ; - // else if (res.status === 403) setPageState("closed"); - // else setPageState("error"); }) .catch(() => setPageState("error")); }, []); @@ -54,6 +53,7 @@ export default function ManagerSignupPage() { phone: "", password: "", eateryName: "", + bankAccount: "", submit: "", }; if (!form.name.trim()) next.name = "Please enter your full name"; @@ -65,8 +65,18 @@ export default function ManagerSignupPage() { next.password = "Password must be at least 6 characters"; if (!form.eateryName.trim()) next.eateryName = "Please enter the restaurant name"; + + if (!form.bankAccount.trim()) + next.bankAccount = "Please enter your bank account number"; + setErrors(next); - return !next.name && !next.phone && !next.password && !next.eateryName; + return ( + !next.name && + !next.phone && + !next.password && + !next.eateryName && + !next.bankAccount + ); }; const handleSubmit = async (e: FormEvent) => { @@ -232,6 +242,14 @@ export default function ManagerSignupPage() { field: "eateryName" as const, type: "text", }, + { + id: "bankAccount", + label: "Bank account number (example: acb-44359797)", + icon: "fa-credit-card", + placeholder: "Enter account number (for QR payment)", + field: "bankAccount" as const, + type: "text", + }, ].map(({ id, label, icon, placeholder, field, type }) => (