"use client"; 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"; export const formatPrice = (value?: number) => (value ?? 0).toLocaleString("vi-VN", { style: "currency", currency: "VND" }); export default function PaymentPage() { const { items, totalPrice, eateryId, increaseQty, decreaseQty, removeFromCart, setQuantity, } = useCart(); const { user } = useAuth(); const { products } = useManager(); const findProduct = (id: string): MenuItemEntity => products.find((i) => i.id == id) ?? ({ name: "Unknown product", description: "", price: 0, } as MenuItemEntity); const isCustomer = user?.role === "customer"; return (
| Product name | Price | Description | Quantity | Delete |
|---|---|---|---|---|
| {name} | {formatPrice(price)} |
{description} |
setQuantity(id, Number(e.target.value))
}
className="h-8 w-16 rounded-lg border border-(--color-border) bg-transparent text-center"
title="Enter quantity"
/>
|