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 ---
|
// --- state ---
|
||||||
let balance = loan;
|
let balance = loan;
|
||||||
let home_value = p.home_price;
|
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 monthly_rent = p.monthly_rent;
|
||||||
|
|
||||||
let cum_buy_cost = upfront_buy; // running cash spent on buying
|
let cum_buy_cost = upfront_buy; // running cash spent on buying
|
||||||
|
|||||||
@@ -171,6 +171,14 @@
|
|||||||
<section class="card inputs-rent">
|
<section class="card inputs-rent">
|
||||||
<h2 class="col-header rent-header">Mieten</h2>
|
<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">
|
<div class="input-group">
|
||||||
<label for="monthly_rent">Kaltmiete (monatlich)</label>
|
<label for="monthly_rent">Kaltmiete (monatlich)</label>
|
||||||
<div class="num-unit euro-input">
|
<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,
|
monthly_rent: +document.getElementById('monthly_rent').value,
|
||||||
rent_increase: +document.getElementById('rent_increase').value,
|
rent_increase: +document.getElementById('rent_increase').value,
|
||||||
renters_ins: +document.getElementById('renters_ins').value,
|
renters_ins: +document.getElementById('renters_ins').value,
|
||||||
|
start_capital: +document.getElementById('start_capital').value,
|
||||||
});
|
});
|
||||||
|
|
||||||
// ===== Charts =====
|
// ===== Charts =====
|
||||||
@@ -227,7 +228,7 @@ const SLIDER_IDS = [
|
|||||||
SLIDER_IDS.forEach(wire_slider);
|
SLIDER_IDS.forEach(wire_slider);
|
||||||
|
|
||||||
// wire plain number inputs (no 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);
|
document.getElementById(id).addEventListener('input', recalc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user