/* ---------------------------
Schritt-Navigation
---------------------------- */
function nextStep() {
const steps = document.querySelectorAll(".wizard-step");
const active = document.querySelector(".wizard-step.active");
const index = Array.from(steps).indexOf(active);
if (index < steps.length - 1) {
active.classList.remove("active");
steps[index + 1].classList.add("active");
// Wenn wir in Schritt 3 wechseln → Ergebnis berechnen
if (index + 1 === 2) {
calculateResult();
}
}
}
function prevStep() {
const steps = document.querySelectorAll(".wizard-step");
const active = document.querySelector(".wizard-step.active");
const index = Array.from(steps).indexOf(active);
if (index > 0) {
active.classList.remove("active");
steps[index - 1].classList.add("active");
}
}
/* ---------------------------
Schritt 1 – Infobox
---------------------------- */
function updateInfobox() {
const invest = parseFloat(document.getElementById("invest").value) || 0;
const box = document.getElementById("infobox");
if (invest > 0) {
box.textContent = "Die Investitionskosten werden in Schritt 3 berücksichtigt.";
box.classList.remove("hidden");
} else {
box.classList.add("hidden");
}
}
/* ---------------------------
Schritt 2 – Gebäudetyp
---------------------------- */
function onTypeChange() {
const typ = document.getElementById("gebaeudetyp").value;
document.getElementById("wohnblock").classList.add("hidden");
document.getElementById("nwgblock").classList.add("hidden");
if (typ === "wohn") {
document.getElementById("wohnblock").classList.remove("hidden");
}
if (typ === "nwg") {
document.getElementById("nwgblock").classList.remove("hidden");
}
updateBoniHinweis();
}
/* ---------------------------
Schritt 2 – WEG-Block
---------------------------- */
function updateWEGBlock() {
const we = parseInt(document.getElementById("we").value) || 0;
const typ = document.querySelector('input[name="eigentuemerTyp"]:checked')?.value;
const wegBlock = document.getElementById("wegBlock");
const einBlock = document.getElementById("einEigentuemerBlock");
if (typ === "weg" && we > 1) {
wegBlock.classList.remove("hidden");
einBlock.classList.add("hidden");
} else if (typ === "einEigentuemer") {
einBlock.classList.remove("hidden");
wegBlock.classList.add("hidden");
} else {
wegBlock.classList.add("hidden");
einBlock.classList.add("hidden");
}
updateBoniHinweis();
}
/* ---------------------------
Schritt 2 – Boni-Logik
---------------------------- */
function updateBoniHinweis() {
const typ = document.querySelector('input[name="eigentuemerTyp"]:checked')?.value;
const wohntSelbst = document.getElementById("eigentuemerWohntSelbst")?.checked;
const we = parseInt(document.getElementById("we").value) || 0;
const ekb = document.getElementById("einkommensbonus");
const kgb = document.getElementById("klimageschwindigkeitsbonus");
let text = "";
/* Ein-Eigentümer */
if (typ === "einEigentuemer") {
if (wohntSelbst) {
// selbst bewohnt → EKB erlaubt
ekb.disabled = false;
kgb.disabled = false;
text = "";
} else {
// nicht selbst bewohnt → EKB ausgeschlossen
ekb.checked = false;
ekb.disabled = true;
text = "Beim Ein-Eigentümer ohne Hauptwohnsitz ist der Einkommensbonus ausgeschlossen.";
}
}
/* WEG */
if (typ === "weg" && we > 1) {
text = "Bei WEG-Strukturen ist der Einkommensbonus nur für selbstgenutzte Wohneinheiten möglich.";
}
document.getElementById("boniHinweis").textContent = text;
}
/* ---------------------------
Schritt 3 – Ergebnis
---------------------------- */
function calculateResult() {
const invest = parseFloat(document.getElementById("invest").value) || 0;
const output = document.getElementById("output");
output.innerHTML = `
Investitionskosten: ${invest.toLocaleString("de-DE")} €
Weitere Berechnungen folgen hier…
`;
}
