Co-authored-by: Thanh Quy - wolf <524H0124@student.tdtu.edu.vn> Co-authored-by: Thanh Quy- wolf <524H0124@student.tdtu.edu.vn> Reviewed-on: #43
This commit was merged in pull request #43.
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
|
||||
import Button from "@/components/atoms/buttons/Button";
|
||||
import PaymentSummaryCard from "@/components/molecules/cards/PaymentSummaryCard";
|
||||
import ReviewModal from "@/components/organisms/modals/ReviewModal";
|
||||
import { useAuth } from "@/lib/auth-context";
|
||||
import { useCart } from "@/lib/cart-context";
|
||||
import { useManager } from "@/lib/manager-context";
|
||||
import { MenuItemEntity } from "@/lib/types";
|
||||
import { useState } from "react";
|
||||
|
||||
export const formatPrice = (value?: number) =>
|
||||
(value ?? 0).toLocaleString("vi-VN", { style: "currency", currency: "VND" });
|
||||
@@ -16,6 +14,7 @@ export default function PaymentPage() {
|
||||
const {
|
||||
items,
|
||||
totalPrice,
|
||||
eateryId,
|
||||
increaseQty,
|
||||
decreaseQty,
|
||||
removeFromCart,
|
||||
@@ -32,7 +31,6 @@ export default function PaymentPage() {
|
||||
price: 0,
|
||||
} as MenuItemEntity);
|
||||
|
||||
const [isReviewOpen, setIsReviewOpen] = useState(false);
|
||||
const isCustomer = user?.role === "customer";
|
||||
|
||||
return (
|
||||
@@ -43,13 +41,13 @@ export default function PaymentPage() {
|
||||
<div className="bg-card overflow-hidden rounded-2xl border border-(--color-border-light)">
|
||||
<div className="border-b border-(--color-border-light) px-4 py-3">
|
||||
<h1 className="text-foreground text-lg font-bold md:text-xl">
|
||||
Trang thanh toán
|
||||
Payment
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{items?.length === 0 ? (
|
||||
<div className="px-4 py-10 text-center text-(--color-text-muted)">
|
||||
Chưa có sản phẩm nào trong giỏ hàng.
|
||||
Your cart is empty.
|
||||
</div>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
@@ -104,7 +102,7 @@ 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={`Giảm số lượng ${name}`}
|
||||
aria-label={`Decrease quantity of ${name}`}
|
||||
>
|
||||
-
|
||||
</button>
|
||||
@@ -116,12 +114,12 @@ export default function PaymentPage() {
|
||||
setQuantity(id, Number(e.target.value))
|
||||
}
|
||||
className="h-8 w-16 rounded-lg border border-(--color-border) bg-transparent text-center"
|
||||
title="Nhập số lượng"
|
||||
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={`Tăng số lượng ${name}`}
|
||||
aria-label={`Increase quantity of ${name}`}
|
||||
>
|
||||
+
|
||||
</button>
|
||||
@@ -133,7 +131,7 @@ export default function PaymentPage() {
|
||||
variant="danger"
|
||||
size="md"
|
||||
style="payment"
|
||||
aria-label={`Xóa ${name} khỏi giỏ hàng`}
|
||||
aria-label={`Remove ${name} from cart`}
|
||||
>
|
||||
Delete product
|
||||
</Button>
|
||||
@@ -153,14 +151,11 @@ export default function PaymentPage() {
|
||||
totalPrice={totalPrice}
|
||||
isCustomer={isCustomer}
|
||||
backHref="/"
|
||||
eateryId={eateryId}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ReviewModal
|
||||
isOpen={isReviewOpen}
|
||||
onClose={() => setIsReviewOpen(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user