Calculateur de capacité

Combien d'équivalents-habitants (EH) faut-il prévoir pour votre installation d'assainissement ?

Quelques questions suffisent. Nous appliquons la règle réglementaire 1 pièce principale = 1 Equivalent-Habitant (EH), vous montrons le calcul, indiquons le modèle Tricel correspondant, identifions votre SPANC et préparons votre demande de devis.

'; var w = window.open("", "_blank"); if (!w) { statusMsg("Votre navigateur a bloqué l'ouverture du récapitulatif. Autorisez les fenêtres surgissantes pour ce site, puis réessayez.", false); return; } w.document.open(); w.document.write(doc); w.document.close(); try { w.focus(); } catch (e) { /* no-op */ } setTimeout(function () { try { w.print(); } catch (e) { /* no-op */ } }, 400); } /* =================================================================== 21. Rendu et navigation =================================================================== */ function trackingParams(c, novo, filtro) { return { calc_mode: state.mode, eh_result: c.eh, pieces_principales: state.mode === "autre" ? null : c.pp, housing_type: state.housing, novo_model: novo ? novo.models[0] : "hors gamme", filtro_model: filtro && !filtro.gap ? filtro.models[0] : "hors gamme", combi_model: (function () { var cb = pickCombi(c.eh); return cb && cb.model ? cb.model : null; })() }; } function renderProgress() { var list = stepList(), i = stepIndex(); progressFill.style.width = Math.round(((i + 1) / list.length) * 100) + "%"; if (headBadge) headBadge.textContent = "Étape " + (i + 1) + " / " + list.length; progressLabels.innerHTML = list.map(function (s, idx) { var cls = idx === i ? "is-active" : (idx < i ? "is-done" : ""); return ''; }).join(""); } function render() { renderProgress(); // Le chapeau n'a plus d'utilité passé la première étape : le masquer // rend les étapes suivantes plus lisibles, surtout sur mobile. var lede = document.getElementById("tec-lede"); if (lede) lede.classList.toggle("tec-hidden", stepIndex() > 0); var html; switch (state.step) { case "projet": html = screenProjet(); break; case "habitation": html = screenHabitation(); break; case "pieces": html = screenPieces(); break; case "resultat": html = screenResultat(); break; case "spanc": html = screenSpanc(); break; case "devis": html = screenDevis(); break; default: html = screenProjet(); } screenEl.innerHTML = html; if (state.step === "spanc") renderSpanc(); if (state.step === "devis" && !state.sent && hubspotReady()) buildHubspotForm(); if (state.step === "resultat") { var c = compute(); trackEvent("eh_calculator_result", trackingParams(c, pickNovo(c.eh), pick(FILTRO, c.eh))); } } function restart() { ROOMS.forEach(function (r) { state.rooms[r.id] = 0; }); ACTIVITIES.forEach(function (a) { state.activities[a.id] = 0; }); state.mode = null; state.housing = null; state.moisOccupation = ""; state.housingAutre = ""; state.sent = false; state.spanc = { cp: "", loading: false, error: null, communes: null, selected: null }; goTo("projet"); } /* ---------- Délégation des clics ---------- */ screenEl.addEventListener("click", function (e) { var t = e.target; if (!t || !t.closest) return; var modeBtn = t.closest("[data-choose-mode]"); if (modeBtn) { var m = modeBtn.getAttribute("data-choose-mode"); state.mode = m; if (m === "autre") state.housing = null; trackEvent("eh_calculator_mode", { calc_mode: m }); goTo(m === "autre" ? "pieces" : "habitation"); return; } var houseBtn = t.closest("[data-choose-housing]"); if (houseBtn) { state.housing = houseBtn.getAttribute("data-choose-housing"); trackEvent("eh_calculator_housing", { housing_type: state.housing }); render(); return; } var stepBtn = t.closest(".tec-step-btn"); if (stepBtn) { var kind = stepBtn.getAttribute("data-kind"); var id = stepBtn.getAttribute("data-id"); var next = Math.max(0, Math.min(9999, state[kind][id] + (stepBtn.getAttribute("data-act") === "inc" ? 1 : -1))); state[kind][id] = next; var input = screenEl.querySelector('.tec-step-val[data-kind="' + kind + '"][data-id="' + id + '"]'); if (input) input.value = next; refreshRunning(); return; } var act = t.closest("[data-action]"); if (!act) return; var action = act.getAttribute("data-action"); if (action === "next") { readEnquiryFields(); goNext(); return; } if (action === "back") { readEnquiryFields(); goPrev(); return; } if (action === "skip-spanc") { goTo("devis"); return; } if (action === "restart") { restart(); return; } if (action === "print") { readEnquiryFields(); trackEvent("eh_calculator_print", trackingParams(compute(), pickNovo(compute().eh), pick(FILTRO, compute().eh))); printSummary(); return; } if (action === "copy-link") { var cl = compute(); trackEvent("eh_calculator_share_link", trackingParams(cl, pickNovo(cl.eh), pick(FILTRO, cl.eh))); copyText(shareUrl(), "Lien copié. Vous pourrez revenir à ce calcul, ou l'envoyer à votre installateur."); return; } if (action === "phone") { var cp2 = compute(); trackEvent("eh_calculator_quote_click", trackingParams(cp2, pickNovo(cp2.eh), pick(FILTRO, cp2.eh))); return; } }); /* ---------- Saisies clavier ---------- */ screenEl.addEventListener("input", function (e) { var el = e.target; if (!el) return; if (el.classList && el.classList.contains("tec-step-val")) { var v = parseInt(el.value, 10); if (isNaN(v) || v < 0) v = 0; if (v > 9999) v = 9999; state[el.getAttribute("data-kind")][el.getAttribute("data-id")] = v; refreshRunning(); return; } if (el.id === "tec-mois") { var m = parseInt(el.value, 10); state.moisOccupation = (isNaN(m) || m < 1) ? "" : String(Math.min(12, m)); return; } if (el.id === "tec-house-autre") { state.housingAutre = el.value; return; } }); screenEl.addEventListener("change", function (e) { var el = e.target; if (el && el.name === "tec-type") readEnquiryFields(); }); // Entrée valide l'étape en cours depuis un champ texte. screenEl.addEventListener("keydown", function (e) { if (e.key !== "Enter") return; var el = e.target; if (!el || el.tagName === "TEXTAREA" || el.id === "tec-spanc-cp") return; var next = screenEl.querySelector('[data-action="next"]:not([disabled])'); var send = screenEl.querySelector('[data-action="send-enquiry"]'); if (el.tagName === "INPUT" && (next || send)) { e.preventDefault(); (send || next).click(); } }); /* ---------- Progression cliquable vers les étapes déjà faites ---------- */ progressLabels.addEventListener("click", function (e) { var b = e.target && e.target.closest ? e.target.closest("[data-goto]") : null; if (!b || b.getAttribute("aria-disabled") === "true") return; readEnquiryFields(); goTo(b.getAttribute("data-goto")); }); /* =================================================================== 22. Init =================================================================== */ var prefilled = readParams(); if (prefilled) { state.step = "resultat"; } else if (state.mode) { state.step = state.mode === "autre" ? "pieces" : "habitation"; } render(); trackEvent("eh_calculator_view", { calc_mode: state.mode, step: state.step }); })();