multi-currency support in roi calculator

This commit is contained in:
Tobias Brunner 2025-07-23 14:50:53 +02:00
parent adc3a6b905
commit 5cc6b779c5
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
7 changed files with 231 additions and 45 deletions

View file

@ -35,6 +35,11 @@ function updateServalaShare(value) { window.ROICalculatorApp?.updateServalaShare
function updateGracePeriod(value) { window.ROICalculatorApp?.updateGracePeriod(value); }
function updateLoanRate(value) { window.ROICalculatorApp?.updateLoanRate(value); }
function updateCoreServiceRevenue(value) { window.ROICalculatorApp?.updateCoreServiceRevenue(value); }
function updateCurrency() {
const currencyElement = document.getElementById('currency');
const value = currencyElement ? currencyElement.value : 'CHF';
window.ROICalculatorApp?.updateCurrency(value);
}
function updateScenarioChurn(scenarioKey, churnRate) { window.ROICalculatorApp?.updateScenarioChurn(scenarioKey, churnRate); }
function updateScenarioPhase(scenarioKey, phaseIndex, newInstancesPerMonth) { window.ROICalculatorApp?.updateScenarioPhase(scenarioKey, phaseIndex, newInstancesPerMonth); }
function resetAdvancedParameters() { window.ROICalculatorApp?.resetAdvancedParameters(); }
@ -137,7 +142,7 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="mb-4">
<label class="form-label fw-semibold mb-2">Initial Investment</label>
<div class="input-group input-group-lg">
<span class="input-group-text">CHF</span>
<span class="input-group-text" id="investment-currency-prefix">CHF</span>
<input type="text" class="form-control" id="investment-amount"
data-value="500000" value="500,000"
oninput="handleInvestmentAmountInput(this)"
@ -149,14 +154,21 @@ document.addEventListener('DOMContentLoaded', function() {
min="100000" max="2000000" step="50000" value="500000"
onchange="updateInvestmentAmount(this.value)">
<div class="d-flex justify-content-between mt-1">
<small class="text-muted">CHF 100K</small>
<small class="text-muted">CHF 2M</small>
<small class="text-muted" id="investment-min-label">CHF 100K</small>
<small class="text-muted" id="investment-max-label">CHF 2M</small>
</div>
</div>
<!-- Analysis Period & Service Revenue Row -->
<!-- Currency, Analysis Period & Service Revenue Row -->
<div class="row mb-4">
<div class="col-md-6">
<div class="col-md-3">
<label class="form-label fw-semibold mb-2">Currency</label>
<select class="form-select form-select-lg" id="currency" onchange="updateCurrency()">
<option value="CHF" selected>CHF (Swiss Franc)</option>
<option value="EUR">EUR (Euro)</option>
</select>
</div>
<div class="col-md-3">
<label class="form-label fw-semibold mb-2">Analysis Period</label>
<select class="form-select form-select-lg" id="timeframe" onchange="updateCalculations()">
<option value="1">1 Year</option>
@ -171,14 +183,14 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="input-group input-group-lg">
<input type="number" class="form-control" id="revenue-per-instance"
min="20" max="200" step="5" value="50" onchange="updateCalculations()">
<span class="input-group-text">CHF/month</span>
<span class="input-group-text" id="revenue-currency-suffix">CHF/month</span>
</div>
<input type="range" class="form-range mt-3" id="revenue-slider"
min="20" max="200" step="5" value="50"
onchange="updateRevenuePerInstance(this.value)">
<div class="d-flex justify-content-between mt-1">
<small class="text-muted">CHF 20</small>
<small class="text-muted">CHF 200</small>
<small class="text-muted" id="revenue-min-label">CHF 20</small>
<small class="text-muted" id="revenue-max-label">CHF 200</small>
</div>
</div>
</div>