function updateSummary() { const w = parseFloat(document.getElementById("product_width")?.value); const h = parseFloat(document.getElementById("product_height")?.value); const qty = parseInt(document.getElementById("product_quantity")?.value); const ppm = parseFloat(document.getElementById("product_price")?.value); const fit = !document.getElementById("product_fitting")?.checked; if (!w || !h || !qty || !ppm) return; let ww = w * 10, hh = h * 10; let dw = fit ? ww + 2 : ww; let dh = fit ? hh + 2 : hh; let per = 2 * (ww + hh); let len = ((per / 10) + 30) / 100 * qty; let price = len * ppm; document.getElementById("product_frameSize").textContent = `${dw} mm × ${dh} mm`; document.getElementById("product_totalPrice").textContent = price.toFixed(2) + ' ₺'; } document.addEventListener("input", (e) => { if ( ["product_width", "product_height", "product_quantity", "product_price", "product_fitting"] .includes(e.target.id) ) updateSummary(); });