diff --git a/app/(main)/payment/page.tsx b/app/(main)/payment/page.tsx index 5316216..8d0229b 100644 --- a/app/(main)/payment/page.tsx +++ b/app/(main)/payment/page.tsx @@ -1,7 +1,10 @@ "use client"; +import ReviewModal from "@/components/ReviewModal"; +import { useAuth } from "@/lib/auth-context"; import { useCart } from "@/lib/cart-context"; import Link from "next/link"; +import { useState } from "react"; const formatPrice = (value: number) => value.toLocaleString("vi-VN", { style: "currency", currency: "VND" }); @@ -15,140 +18,173 @@ export default function PaymentPage() { removeFromCart, setQuantity, } = useCart(); + const { user } = useAuth(); + + const [isReviewOpen, setIsReviewOpen] = useState(false); + const isCustomer = user?.role === "customer"; + + const handlePayment = () => { + // UI-only: open review modal after "payment" + if (isCustomer) { + setIsReviewOpen(true); + } + }; return ( -
| Tên sản phẩm | -Giá tiền | -Mô tả | -Số lượng | -- Xóa - | -|||||
|---|---|---|---|---|---|---|---|---|---|
| - {item.name} - | -- {formatPrice(item.price)} - | -
- {item.description} - |
-
-
-
-
- setQuantity(item.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"
- />
-
-
- |
- - - | + + {items.length === 0 ? ( +
| + Tên sản phẩm + | +Giá tiền | +Mô tả | +Số lượng | ++ Xóa + |
|---|
+ Chúng tôi trân trọng đánh giá của bạn! +
+ ++ Hãy cho chúng tôi biết trải nghiệm của bạn hôm nay +
+ + {/* Star rating */} ++ Mức độ hài lòng +
++ { + ["", "Rất tệ", "Tệ", "Bình thường", "Tốt", "Xuất sắc"][ + rating + ] + } +
+ )} +