fix: final commit (#46)
Release package / release (push) Successful in 8m30s

Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #46
This commit was merged in pull request #46.
This commit is contained in:
2026-05-15 13:22:12 +00:00
parent 7b4e46c4e4
commit 2376d57cbb
5 changed files with 103 additions and 36 deletions
+22 -4
View File
@@ -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<HTMLFormElement>) => {
@@ -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 }) => (
<div key={id}>
<label
+2 -11
View File
@@ -2,7 +2,6 @@
import Button from "@/components/atoms/buttons/Button";
import PaymentSummaryCard from "@/components/molecules/cards/PaymentSummaryCard";
import { useAuth } from "@/lib/auth-context";
import { useCart } from "@/lib/cart-context";
import { useManager } from "@/lib/manager-context";
import { MenuItemEntity } from "@/lib/types";
@@ -20,7 +19,7 @@ export default function PaymentPage() {
removeFromCart,
setQuantity,
} = useCart();
const { user } = useAuth();
const { products } = useManager();
const findProduct = (id: string): MenuItemEntity =>
@@ -31,8 +30,6 @@ export default function PaymentPage() {
price: 0,
} as MenuItemEntity);
const isCustomer = user?.role === "customer";
return (
<div>
<div className="mx-auto w-full max-w-screen-2xl px-4 py-6 md:px-6 md:py-8 lg:px-8">
@@ -82,7 +79,6 @@ export default function PaymentPage() {
quantity,
}) => {
const { name, description } = findProduct(id);
return (
<tr
key={id}
@@ -102,24 +98,20 @@ export default function PaymentPage() {
<button
onClick={() => decreaseQty(id)}
className="inline-flex h-8 w-8 items-center justify-center rounded-lg border border-(--color-border) hover:bg-(--color-border-light)"
aria-label={`Decrease quantity of ${name}`}
>
-
</button>
<input
type="number"
min={1}
value={quantity}
onChange={(e) =>
setQuantity(id, Number(e.target.value))
}
className="h-8 w-16 rounded-lg border border-(--color-border) bg-transparent text-center"
title="Enter quantity"
/>
<button
onClick={() => increaseQty(id)}
className="inline-flex h-8 w-8 items-center justify-center rounded-lg border border-(--color-border) hover:bg-(--color-border-light)"
aria-label={`Increase quantity of ${name}`}
>
+
</button>
@@ -131,7 +123,6 @@ export default function PaymentPage() {
variant="danger"
size="md"
style="payment"
aria-label={`Remove ${name} from cart`}
>
Delete product
</Button>
@@ -149,7 +140,7 @@ export default function PaymentPage() {
<PaymentSummaryCard
totalPrice={totalPrice}
isCustomer={isCustomer}
isCustomer={true}
backHref="/"
eateryId={eateryId}
/>