Prometheus Nest Faucet Care

Course selection

Your cart

Total: $0.00

`; document.querySelector('header').innerHTML=headerHTML; document.querySelector('footer').innerHTML=footerHTML; })(); let products=[]; let cart=JSON.parse(localStorage.getItem('pnc-cart')||'[]'); const cartList=document.getElementById('cartList'); const cartTotal=document.getElementById('cartTotal'); const checkoutBtn=document.getElementById('checkout'); const confirmModal=document.getElementById('confirmModal'); const confirmClose=document.getElementById('confirmClose'); async function renderCart(){ products=products.length?products:await(await fetch('./catalog.json')).json(); const rows=cart.map(row=>({...products.find(x=>x.id===row.id),quantity:row.quantity})).filter(x=>x&&x.title); cartList.innerHTML=rows.length?rows.map(x=>`

${x.title}

$${x.price.toFixed(2)} each

`).join(''):'

Your cart is empty. Select a practical course from the catalog.

'; cartTotal.textContent='$'+rows.reduce((sum,x)=>sum+x.price*x.quantity,0).toFixed(2); } cartList.addEventListener('change',function(e){ if(e.target.dataset.qty){ const row=cart.find(x=>x.id===e.target.dataset.qty); if(row){row.quantity=Math.max(1,Number(e.target.value)||1);localStorage.setItem('pnc-cart',JSON.stringify(cart));renderCart();} } }); cartList.addEventListener('click',function(e){ if(e.target.dataset.remove){ cart=cart.filter(x=>x.id!==e.target.dataset.remove); localStorage.setItem('pnc-cart',JSON.stringify(cart)); renderCart(); } }); checkoutBtn.addEventListener('click',function(){ confirmModal.classList.remove('hidden'); confirmModal.classList.add('flex'); }); confirmClose.addEventListener('click',function(){ confirmModal.classList.remove('flex'); confirmModal.classList.add('hidden'); }); confirmModal.addEventListener('click',function(e){ if(e.target===confirmModal){confirmModal.classList.remove('flex');confirmModal.classList.add('hidden');} }); document.addEventListener('DOMContentLoaded',renderCart); // theme & nav logic (same as other pages) const html=document.documentElement; const themeBtn=document.getElementById('themeToggle'); if(localStorage.getItem('theme')==='dark'){html.classList.add('dark');} themeBtn.addEventListener('click',function(){html.classList.toggle('dark');localStorage.setItem('theme',html.classList.contains('dark')?'dark':'light');}); const menuBtn=document.getElementById('menuToggle'); const nav=document.getElementById('siteNav'); menuBtn.addEventListener('click',function(){nav.classList.toggle('hidden');}); const loginBtn=document.getElementById('loginOpen'); const regBtn=document.getElementById('registerOpen'); function createLoginModal(){const m=document.createElement('div');m.className='fixed inset-0 z-50 flex items-center justify-center bg-slate-950/70 p-4';m.innerHTML=`

Sign in

`;document.body.appendChild(m);m.querySelector('button:last-child').onclick=()=>m.remove();m.querySelector('form').onsubmit=e=>{e.preventDefault();m.remove();alert('Signed in (demo)');};}loginBtn.onclick=createLoginModal; function createRegModal(){const m=document.createElement('div');m.className='fixed inset-0 z-50 flex items-center justify-center bg-slate-950/70 p-4';m.innerHTML=`

Register

`;document.body.appendChild(m);m.querySelector('button:last-child').onclick=()=>m.remove();m.querySelector('form').onsubmit=e=>{e.preventDefault();m.remove();alert('Account created (demo)');};}regBtn.onclick=createRegModal;