import Image from 'next/image' import React from 'react' import { PColor } from './../../../assets/colors/index' import { CardProductsContent, CtnBox, TooltipCardProduct, WrapperCard } from './styled' import { IconEdit, IconDelete } from '../../../assets' import { numberFormat } from '../../../utils' import { type ProductFood } from '../../pages/GenerateSales/types' import { PercentBadge } from '../../molecules' import styles from './styles.module.css' interface CardProductsProps { isVisible?: boolean image?: string | React.ReactNode | null food?: ProductFood setRef?: any isEdit?: boolean showDiscount?: boolean loading?: boolean onClick?: () => void redirect?: () => void handleDelete?: (food?: ProductFood) => void } export const CardProductsComponent: React.FC = ({ isVisible = false, image = null, food = { ProDescription: '', ProDescuento: 0, ProImage: '', ProPrice: 0, pName: '', pId: null }, setRef = null, isEdit = true, showDiscount = true, loading = false, onClick = () => { }, redirect = () => { }, handleDelete = (food: ProductFood) => { return food } }) => { return (
{ {isEdit && ( <> )} {isVisible && ( <>

{food?.pName}

{((food?.ProDescription)?.length > 0) || ''}

0 ? 'card__price' : 'card__price free'}> {Number(food?.ProPrice) > 0 ? `${numberFormat(food?.ProPrice)}` : 'Gratis'} {food?.ProDescuento > 0 ? `${numberFormat(food?.ProDescuento)}` : null} {showDiscount && food?.ProDescuento > 0 && ( ) }
)}
{image === null && isVisible && {food?.ProDescription?.length 0 ? food.ProDescription : 'img'} blurDataURL='/images/default-banner.png' height={300} layout='fill' objectFit='cover' src={typeof food.ProImage === 'string' && food.ProImage.trim() !== '' ? food.ProImage : '/images/default-banner.png'} width={300} />} {image}
}
) } export const CardProducts = React.memo(CardProductsComponent)