import { Card } from "react-bootstrap"; // public enum States { // Available, // BackOrder, // Unavailable, // Clearance, // Promotion, // Discontinued // } function renderStatus(statusCode) { if (statusCode !== undefined) { switch (statusCode) { case 0: return ( Disponible ); case 1: return ( En commande ); case 2: return ( Indisponible ); case 3: return ( Liquidation ); case 4: return ( Promotion ); case 5: return ( Discontinué ); default: return ( <> ); } } } function renderPrice(price, newPrice, status) { if (price !== undefined) { if (status != 3 && status != 4) { return ( {price.toFixed(2).toString().replace(".", ",")} $ CA ); } else { return ( {price.toFixed(2).toString().replace(".", ",")} $ CA {newPrice.toFixed(2).toString().replace(".", ",")} $ CA ); } } } const Item = ({ imageUrl, name, price, newPrice, status }) => { if (name !== undefined) { return (
{name}
{renderStatus(status)}
{renderPrice(price, newPrice, status)}
); } else { return (<>); } } export default Item;