2026-02-03 17:20:38 +07:00
|
|
|
import { CartData } from "@/data/cart"
|
|
|
|
|
import EmptyCart from "./EmptyCart";
|
|
|
|
|
import Form from "../form";
|
|
|
|
|
import CartItem from "@/components/shared/CartItem"
|
|
|
|
|
import { formatPrice } from "@/lib/utils";
|
|
|
|
|
|
2025-12-30 18:05:53 +07:00
|
|
|
export default function Home() {
|
2026-02-03 17:20:38 +07:00
|
|
|
console.log(CartData);
|
|
|
|
|
|
|
|
|
|
const hasCart = CartData.data.length;
|
|
|
|
|
if (hasCart == 0 ) {
|
|
|
|
|
return <EmptyCart />
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
return (
|
2025-12-29 17:43:31 +07:00
|
|
|
<div className="cart-page container">
|
2026-02-03 17:20:38 +07:00
|
|
|
<h1 className="text-[#004BA4] leading-10 text-[32px] font-600 mb-6"> Giỏ hàng của tôi </h1>
|
|
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
<div className="lg:flex flex-wrap items-start justify-between gap-6">
|
|
|
|
|
<div className="col-left w-[calc(100%-464px)]">
|
|
|
|
|
<div className="hidden lg:flex flex-wrap items-center justify-between gap-4 bg-white rounded-[12px] mb-3 py-3 px-4 lg:text-[16px] font-500 leading-10">
|
2026-02-03 17:20:38 +07:00
|
|
|
<p className="m-0 text-16 lg:text-[18px]"> {hasCart} sản phẩm </p>
|
|
|
|
|
|
|
|
|
|
<button type="button" aria-label="Xóa sản phẩm"
|
2026-01-31 12:00:43 +07:00
|
|
|
className="h-10 border border-[#0678DB] bg-white rounded-[40px] text-[#0678DB] px-6 transition-all duration-100 hover:bg-[#0678DB] hover:text-white"
|
2026-02-03 17:20:38 +07:00
|
|
|
> LÀM TRỐNG GIỎ HÀNG </button>
|
2026-01-31 12:00:43 +07:00
|
|
|
</div>
|
2026-02-03 17:20:38 +07:00
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
<div className="bg-white rounded-[16px] lg:rounded-[12px] mb-3 p-4">
|
2026-02-03 17:20:38 +07:00
|
|
|
{ CartData.data.map((item:any) =>
|
|
|
|
|
<CartItem item={item} key={item.item_id} />
|
|
|
|
|
)}
|
2026-01-31 12:00:43 +07:00
|
|
|
</div>
|
2026-02-03 17:20:38 +07:00
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
<div className="bg-white p-4 lg:pt-5 rounded-[16px] lg:rounded-[12px]">
|
|
|
|
|
<p className="font-600 text-16 lg:text-[18px] mb-2 lg:mb-4 leading-5 lg:leading-6">
|
2026-02-03 17:20:38 +07:00
|
|
|
Thông tin đơn hàng
|
2026-01-31 12:00:43 +07:00
|
|
|
</p>
|
2026-02-03 17:20:38 +07:00
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
<div className="flex items-center justify-between gap-3 border-b border-[#D2DAE3] border-dashed pb-4 mb-3 lg:mb-5 leading-5 lg:leading-6 lg:text-[16px]">
|
|
|
|
|
<p className="m-0"> Tổng tiền </p>
|
2026-02-03 17:20:38 +07:00
|
|
|
<p className="m-0 font-500 text-15 lg:text-[18px]">
|
|
|
|
|
{formatPrice(CartData.cart_summary.total_value)} đ
|
|
|
|
|
</p>
|
2026-01-31 12:00:43 +07:00
|
|
|
</div>
|
2026-02-03 17:20:38 +07:00
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
<div className="flex items-center justify-between gap-3 leading-5 lg:leading-6">
|
|
|
|
|
<p className="m-0 flex items-center gap-2">
|
|
|
|
|
<i className="bx bxs-credit-card-alt text-20 text-[#B5BAC1]" />
|
|
|
|
|
<span> Tổng thanh toán </span>
|
|
|
|
|
</p>
|
2026-02-03 17:20:38 +07:00
|
|
|
|
2026-01-31 12:00:43 +07:00
|
|
|
<p className="m-0 text-16 text-[#FF4E2A] font-bold lg:text-[20px]">
|
2026-02-03 17:20:38 +07:00
|
|
|
{formatPrice(CartData.cart_summary.total_value)} <u>đ</u>
|
2026-01-31 12:00:43 +07:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-02-03 17:20:38 +07:00
|
|
|
|
|
|
|
|
<Form />
|
2025-12-29 17:43:31 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|