From 1bf69a60438fd834550c0f8dc9a2a38d8ee58bb5 Mon Sep 17 00:00:00 2001 From: Johannes Date: Fri, 20 Mar 2026 02:05:41 +0100 Subject: [PATCH] add Startkapital input for renter initial savings --- calc.js | 2 +- index.html | 8 ++++++++ ui.js | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/calc.js b/calc.js index 87f0166..5b469af 100644 --- a/calc.js +++ b/calc.js @@ -30,7 +30,7 @@ function run_simulation(p) { // --- state --- let balance = loan; let home_value = p.home_price; - let portfolio = upfront_buy; // renter invests this lump sum + let portfolio = upfront_buy + (p.start_capital || 0); // renter invests this lump sum + any extra savings let monthly_rent = p.monthly_rent; let cum_buy_cost = upfront_buy; // running cash spent on buying diff --git a/index.html b/index.html index 9fc6d8c..38cd209 100644 --- a/index.html +++ b/index.html @@ -171,6 +171,14 @@

Mieten

+
+ +
+ + +
+
+
diff --git a/ui.js b/ui.js index a43a192..ffbe555 100644 --- a/ui.js +++ b/ui.js @@ -24,6 +24,7 @@ const get_params = () => ({ monthly_rent: +document.getElementById('monthly_rent').value, rent_increase: +document.getElementById('rent_increase').value, renters_ins: +document.getElementById('renters_ins').value, + start_capital: +document.getElementById('start_capital').value, }); // ===== Charts ===== @@ -227,7 +228,7 @@ const SLIDER_IDS = [ SLIDER_IDS.forEach(wire_slider); // wire plain number inputs (no slider) -['home_price', 'insurance', 'monthly_rent', 'renters_ins'].forEach((id) => { +['home_price', 'insurance', 'monthly_rent', 'renters_ins', 'start_capital'].forEach((id) => { document.getElementById(id).addEventListener('input', recalc); });