'use client'; import { useRouter } from 'next/navigation'; import type { ProductDetailData } from '@/types'; import Link from 'next/link'; import { BoxPrice } from './BoxPrice'; import { BoxBought } from './BoxBought'; // thêm giỏ hàng import { addToCart } from '@/lib/ButtonCart'; export const BoxInfoRight = (item: ProductDetailData) => { const router = useRouter(); const handleBuyNow = () => { router.push('/cart'); addToCart(item.product_info.productId); }; return ( <>

{item.product_info.productName}

Mã SP: {item.product_info.productSKU}
Đánh giá: {item.product_info.review.summary.total}
Bình luận:{' '} {item.product_info.comment.summary.total}
Lượt xem: {item.product_info.visit}
{item.product_info.extend.buy_count?.length > 0 && (
Đã bán: {item.product_info.extend.buy_count}
)}
{/* tình trạng */}
Bảo hành: {item.product_info.warranty}
{item.product_info.quantity > '0' && (
Tình trạng: Còn hàng
)}
{/* giá */} {item.product_info.specialOffer.all.length > 0 && (

Khuyến mãi

{item.product_info.specialOffer.all.map((_item, idx) => (
))}
)} {/* mua hàng */} {(item.product_info.quantity > '0' || item.product_info.price > '0') && ( <>

Số lượng:

{' '} −{' '}

{' '} +{' '}

handleBuyNow()} >
)} {/* yên tâm mua hàng */}

Yên tâm mua hàng

Cam kết giá tốt nhất thị trường.

Sản phẩm mới 100%.

Lỗi 1 đổi 1 ngay lập tức.

Hỗ trợ trả góp - Thủ tục nhanh gọn.

); };