/* global React, Icon, Button, Badge, Field, QtyStepper, useState */
/* ============================ CARRITO ============================ */
function DtCart({ 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 para tu proyecto.
);
}
return (
Tu carrito
{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 && (
Las cantidades fueron calculadas por nuestro asesor según los m² de tu proyecto.
)}
Resumen
Subtotal ({cart.reduce((n, i) => n + i.qty, 0)} ítems){NOGO.fmt(subtotal)}
EnvíoA calcular
Total{NOGO.fmt(subtotal)}
Compra protegida
);
}
/* ============================ CHECKOUT ============================ */
function DtCheckout({ 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 = ({ value, cur, set, title, desc, right, icon }) => (
);
return (
Checkout
Finalizar compra
Entrega
Gratis : {NOGO.fmt(4500)}} />
{delivery === "envio" ? (
) : (
)}
{delivery === "envio" && branch === "Chivilcoy" && ¡Envío gratis en Chivilcoy!
}
Tu pedido
{cart.map((it, i) => (
{it.qty}× {it.name}
{it.presLabel}
{NOGO.fmt(it.price * it.qty)}
))}
Subtotal{NOGO.fmt(subtotal)}
Envío{shipCost === 0 ? "Gratis" : NOGO.fmt(shipCost)}
Total{NOGO.fmt(total)}
);
}
/* ============================ SERVICIOS ============================ */
function DtServices() {
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 calcular cantidades.", price: "Gratis" },
{ id: "obra", title: "Mano de obra", icon: "brush", desc: "Pintores matriculados de confianza. Presupuesto detallado sin compromiso.", price: "A presupuestar" },
];
return (
Servicios
Te acompañamos antes, durante y después de pintar. Elegí el servicio y dejanos tus datos.
{services.map((s) => (
))}
Solicitar {tab === "asesoria" ? "asesoramiento" : "presupuesto"}
{sent ? (
¡Solicitud enviada!
Te contactamos dentro de las 24 h hábiles.
) : (
<>
>
)}
);
}
/* ============================ MAYORISTA ============================ */
function DtWholesale() {
const [sent, setSent] = useState(false);
return (
B2B
Cuenta mayorista
Precios especiales para pintores, corralones, estudios y empresas constructoras. Atención comercial dedicada.
{[["card", "Lista de precios mayorista"], ["truck", "Logística para grandes volúmenes"], ["user", "Asesor comercial asignado"]].map(([ic, txt]) => (
{txt}
))}
);
}
Object.assign(window, { DtCart, DtCheckout, DtServices, DtWholesale });