/* global React, Icon, Button, Badge, Field, QtyStepper, useState */
/* ============================ CARRITO ============================ */
function CartScreen({ cart, setQty, removeItem, go }) {
const NOGO = window.NOGO;
const subtotal = cart.reduce((s, i) => s + i.price * i.qty, 0);
const hasPaint = cart.some((i) => i.color !== null);
if (cart.length === 0) {
return (
Tu carrito está vacío
Sumá productos y te ayudamos a calcular la cantidad justa.
);
}
return (
{cart.map((it, idx) => (
{!it.color && }
{it.name}
{it.presLabel}{it.color ? ` · ${it.color.name}` : ""}
setQty(idx, q)} />
{NOGO.fmt(it.price * it.qty)}
))}
{hasPaint && (
Cantidades calculadas por nuestro asesor según tus m².
)}
Subtotal
{NOGO.fmt(subtotal)}
);
}
/* ============================ CHECKOUT ============================ */
function CheckoutScreen({ cart, go, onPlace }) {
const NOGO = window.NOGO;
const subtotal = cart.reduce((s, i) => s + i.price * i.qty, 0);
const [delivery, setDelivery] = useState("envio");
const [branch, setBranch] = useState("Chivilcoy");
const [pay, setPay] = useState("mp");
const freeShip = delivery === "retiro" || branch === "Chivilcoy";
const shipCost = delivery === "envio" && !freeShip ? 4500 : 0;
const total = subtotal + shipCost;
const Radio = ({ name, value, cur, set, title, desc, right, icon }) => (
);
return (
Entrega
Gratis : {NOGO.fmt(4500)}} />
{delivery === "envio" && (
)}
{delivery === "envio" && branch === "Chivilcoy" && (
¡Envío gratis en Chivilcoy!
)}
{delivery === "retiro" && (
)}
Resumen
Subtotal ({cart.length} ítems){NOGO.fmt(subtotal)}
Envío{shipCost === 0 ? "Gratis" : NOGO.fmt(shipCost)}
Total{NOGO.fmt(total)}
);
}
/* ============================ SERVICIOS ============================ */
function ServicesScreen() {
const [tab, setTab] = useState("asesoria");
const [sent, setSent] = useState(false);
const services = [
{ id: "asesoria", title: "Asesoramiento sin cargo", icon: "spark", desc: "A domicilio o virtual. Un experto te ayuda a elegir productos, colores y cantidades.", price: "Gratis" },
{ id: "obra", title: "Mano de obra", icon: "brush", desc: "Pintores matriculados de confianza. Presupuesto sin compromiso.", price: "A presupuestar" },
];
return (
Servicios
Te acompañamos antes, durante y después de pintar.
{services.map((s) => (
))}
);
}
/* ============================ CONTACTO MAYORISTA ============================ */
function WholesaleScreen() {
const [sent, setSent] = useState(false);
return (
B2B
Cuenta mayorista
Precios especiales para pintores, corralones y empresas constructoras.
);
}
/* ============================ FILTROS (sheet) ============================ */
function FilterContent({ filters, setFilters, onClose }) {
const NOGO = window.NOGO;
const fams = Object.keys(NOGO.palette);
return (
Uso
{[["", "Todos"], ["interior", "Interior"], ["exterior", "Exterior"]].map(([v, l]) => (
))}
Familia de color
{fams.map((f) => (
))}
);
}
Object.assign(window, { CartScreen, CheckoutScreen, ServicesScreen, WholesaleScreen, FilterContent });