import Image from 'next/image' import PropTypes from 'prop-types' import React from 'react' import styles from './Bill.module.css' /** * Componente Ticket * @param {Object} props - Propiedades del componente. * @param {Object} props.client - Datos del client?. * @param {Array} props.products - Lista de products. * @param {Object} props.restaurant - Datos del restaurant?. * @returns {JSX.Element} Elemento JSX del ticket. */ export const Bill = ({ client, urlStore = null, bill = {}, products = [], restaurant = {}, total = 0, discount = { discount: 0 }, numberFormat = () => { } }) => { const iva = 0 * 0.19 const definedValue = 'SIN DEFINIR' return (

{process.env.BUSINESS_TITLE}

No dejes de comprar {/* {urlStore && } */}
{restaurant?.storeName

{restaurant?.storeName}

{!!restaurant?.ref &&

Ref compra: {restaurant?.ref}

} {!!bill?.date &&

Fecha {bill?.date}

}

NIT: {restaurant?.NitStore ?? definedValue}

Forma de pago: {restaurant?.paymentMethod ?? definedValue}

Direccion: {restaurant?.address ?? definedValue}

Telefono: {restaurant?.tlf ?? definedValue}

Cliente: {client?.clientName} {client.clientLastName}

Direccion: {client?.ClientAddress ?? definedValue}

Telefono: {client?.clientNumber ?? definedValue}

{/* Encabezado de columnas */}
Producto Cant Precio
{/* Lista de productos */}
) })} {producto?.dataExtra?.map((extra, eIndex) => { return (
  • {extra.extraName} {extra.quantity} {numberFormat(extra.newExtraPrice)}
  • ) })} ) })}

    Valor Inicial Fact: {total || 0}

    IVA: ${iva || 0}

    DESCUENTO: {numberFormat(discount?.discount) || 0}

    CAMBIO: {numberFormat(restaurant?.change) || 0}

    Total Factura: {total || 0}

    Gracias por su compra

    ) } Bill.propTypes = { bill: PropTypes.object, client: PropTypes.shape({ ClientAddress: PropTypes.any, address: PropTypes.any, clientLastName: PropTypes.any, clientName: PropTypes.any, clientNumber: PropTypes.any, name: PropTypes.any, tlf: PropTypes.any }), discount: PropTypes.shape({ discount: PropTypes.number }), numberFormat: PropTypes.func, products: PropTypes.shape({ map: PropTypes.func, reduce: PropTypes.func }), restaurant: PropTypes.shape({ address: PropTypes.any, name: PropTypes.any, tlf: PropTypes.any }), total: PropTypes.number, urlStore: PropTypes.any }