// Klientská sekce „Můj účet" — levá navigace + sekce (profil, adresy, // objednávky, předobjednávky, oblíbené, hlídací psi, platby, heslo). // Vizuální základ, který se natáhne na WooCommerce „Můj účet". (function () { if (typeof React === "undefined") return; const DS = window.VElaStvNajmanDesignSystem_bc3fc2; const { Button, Input } = DS; const Icon = window.VNIcon; const SECTIONS = [ { id: "profil", label: "Profil", icon: "user" }, { id: "adresy", label: "Adresy", icon: "pin" }, { id: "objednavky", label: "Historie objednávek", icon: "fileText" }, { id: "predobjednavky", label: "Mé předobjednávky", icon: "spark" }, { id: "upozorneni", label: "Hlídací psi", icon: "bell" }, { id: "heslo", label: "Změna hesla", icon: "lock" }, ]; const ORDER_STATUS = { received: { label: "Přijatá", cls: "received" }, shipped: { label: "Odeslaná", cls: "shipped" }, delivered: { label: "Doručená", cls: "delivered" }, }; // ---- malý přepínač (toggle) ---- function Switch({ checked, onChange, label }) { return ( ); } function PanelHead({ title, desc }) { return (

{title}

{desc &&

{desc}

}
); } // ============================ PROFIL ============================ function ProfilPanel({ user }) { const [name, setName] = React.useState(`${user.firstName} ${user.lastName}`); const [email, setEmail] = React.useState(user.email); const [phone, setPhone] = React.useState(user.phone); const [news, setNews] = React.useState(user.newsletter); return (
setName(e.target.value)} icon={} />
setEmail(e.target.value)} icon={} /> setPhone(e.target.value)} icon={} />
Odebírat newsletter Dáme vědět, jakmile otevřeme příjem objednávek nebo naskladníme volné matky.
); } // ============================ ADRESY ============================ function AddressCard({ kind, addr }) { return (
{kind === "shipping" ? "Doručovací adresa" : "Fakturační adresa"}
{addr.name} {addr.street}
{addr.zip} {addr.city}
{addr.country}
); } function AdresyPanel({ addresses }) { return (
); } // ====================== HISTORIE OBJEDNÁVEK ====================== function OrderRow({ order, products, onReorder, go }) { const items = order.items .map((it) => { const p = products.find((x) => x.id === it.id); return p ? `${p.name}${it.qty > 1 ? ` (${it.qty}×)` : ""}` : null; }) .filter(Boolean).join(", "); const st = ORDER_STATUS[order.status] || ORDER_STATUS.received; return (
Objednávka č. {order.number} {order.date}
{st.label}

{items}

{order.total} Kč
); } function ObjednavkyPanel({ orders, products, onReorder, go }) { return (
{orders.map((o) => )}
); } // ===================== MÉ PŘEDOBJEDNÁVKY ===================== const PRE_STATUS = { preparing: "Přijato — připravujeme", fermenting: "Kvasí — dozrává", }; function PredobjednavkyPanel({ preorders }) { return (
{preorders.length === 0 ? ( ) : (
{preorders.map((pre) => (
{pre.name} {pre.weight}

{pre.note}

{PRE_STATUS[pre.status] || "Rezervováno"} Naskladnění: {pre.restock}
))}
)}
); } // ========================= OBLÍBENÉ ========================= // Kompaktní mini-karta — malý náhled, název, cena, rychlé přidání. function FavCard({ p, onOpen, onAdd, onNotify, onPreorder, onRemove }) { const { Photo } = DS; const soldOut = p.stock === "out"; const minPrice = p.variants && p.variants.length ? Math.min.apply(null, p.variants.map((v) => v.price)) : p.price; return (
onOpen && onOpen(p)}>
{p.region && {p.region}}

onOpen && onOpen(p)}>{p.name}

{p.variants && p.variants.length ? "od " : ""}{minPrice} Kč {soldOut ? ( p.restock ? ( ) : ( ) ) : ( )}
); } function OblibenePanel({ favorites, products, shared }) { const [favs, setFavs] = React.useState(favorites); const items = favs.map((id) => products.find((p) => p.id === id)).filter(Boolean); if (items.length === 0) return (
); return (
{items.map((p) => ( shared.addToCart(p)} onNotify={shared.onNotify} onPreorder={shared.onPreorder} onRemove={() => setFavs((f) => f.filter((x) => x !== p.id))} /> ))}
); } // =================== HLÍDACÍ PSI / UPOZORNĚNÍ =================== function UpozorneniPanel({ watches }) { const [list, setList] = React.useState(watches); return (
{list.length === 0 ? ( ) : (
{list.map((w) => (
{w.name} {w.weight} · {w.restock ? <>očekáváme {w.restock} : "termín upřesníme"}
))}
)}
); } // ====================== PLATEBNÍ METODY ====================== function PlatbyPanel({ paymentMethods, supportedMethods }) { const [cards, setCards] = React.useState(paymentMethods); const [gate, setGate] = React.useState(false); return (
{cards.map((c) => (
{c.brand} •••• {c.last4} platnost {c.exp}
))}
Podporované způsoby platby
{supportedMethods.map((m) => ( {m.label} ))}
{gate && (
setGate(false)}>
e.stopPropagation()}>

Zabezpečená platební brána

Tady se otevře brána (GoPay / Stripe), kde bezpečně zadáte údaje o kartě. Číslo karty nikdy neprochází naším webem.

)}
); } // ======================== ZMĚNA HESLA ======================== function HesloPanel() { return (
} autoComplete="current-password" /> } autoComplete="new-password" hint="Alespoň 8 znaků." /> } autoComplete="new-password" />
); } function EmptyState({ icon, text }) { return (

{text}

); } // ============================ SHELL ============================ function Account({ go, section, user, onLogout, addToCart, onQuickView, onNotify, onPreorder }) { const D = window.SHOP_DATA; const acc = D.account; const [active, setActive] = React.useState(section || "profil"); React.useEffect(() => { if (section) setActive(section); }, [section]); const navRef = React.useRef(null); React.useEffect(() => { const nav = navRef.current; if (!nav || nav.scrollWidth <= nav.clientWidth + 4) return; const el = nav.querySelector('[aria-current="true"]'); if (!el) return; const to = el.offsetLeft - nav.clientWidth / 2 + el.offsetWidth / 2; nav.scrollTo({ left: Math.max(0, to), behavior: "smooth" }); }, [active]); const reorder = (order) => { order.items.forEach((it) => { const p = D.products.find((x) => x.id === it.id); if (p) addToCart(p, it.qty); }); }; const shared = { onOpen: (p) => go("product", p.id), addToCart, onQuickView, onNotify, onPreorder }; let panel; switch (active) { case "adresy": panel = ; break; case "objednavky": panel = ; break; case "predobjednavky": panel = ; break; case "upozorneni": panel = ; break; case "heslo": panel = ; break; default: panel = ; } const u = user || acc.user; const initials = (u.firstName[0] || "") + (u.lastName[0] || ""); return (
{initials}

Můj účet

Vítejte zpět, {u.firstName}. Spravujte své objednávky, adresy a oblíbené produkty.

{panel}
); } window.VNAccount = Account; })();