import { useState } from 'react' import VariantCard from './VariantCard' import Image from '@/core/components/elements/Image/Image' import currencyFormat from '@/core/utils/currencyFormat' const VariantGroupCard = ({ variants, ...props }) => { console.log('variant', variants) const [showAll, setShowAll] = useState(false) const variantsToShow = showAll ? variants : variants.slice(0, 2) return ( <> {variantsToShow?.map((variant, index) => ( <> {variant.program && variant.program.items && variant.program.items.map((item) => (
{item.name}

{item.name}

{/* {product.code || '-'} {product.attributes.length > 0 ? ` ・ ${product.attributes.join(', ')}` : ''} */}

Berat Item : {item.weight} Kg

{item.price.discountPercentage > 0 && ( <>

{currencyFormat(item.price.price)}

{item.price.discountPercentage}% )}

{item.price.priceDiscount > 0 ? currencyFormat(item.price.priceDiscount) + ' × ' + item.quantity + ' Barang' : ''}

{item.price.priceDiscount > 0 ? ( currencyFormat(item.quantity * item.price.priceDiscount) ) : ( Call For Price{' '} )}

))} ))} {variants.length > 2 && ( )} ) } export default VariantGroupCard