add Startkapital input for renter initial savings
This commit is contained in:
2
calc.js
2
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
|
||||
|
||||
@@ -171,6 +171,14 @@
|
||||
<section class="card inputs-rent">
|
||||
<h2 class="col-header rent-header">Mieten</h2>
|
||||
|
||||
<div class="input-group">
|
||||
<label for="start_capital">Startkapital <span class="hint">(zusätzl. Ersparnisse)</span></label>
|
||||
<div class="num-unit euro-input">
|
||||
<span class="unit prefix">€</span>
|
||||
<input type="number" id="start_capital" min="0" max="10000000" step="1000" value="0" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<label for="monthly_rent">Kaltmiete (monatlich)</label>
|
||||
<div class="num-unit euro-input">
|
||||
|
||||
3
ui.js
3
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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user