}
public function shortcode_handler($atts) {
errorContainer.style.display = 'block';
} else {
errorContainer.style.display = 'none';
}
return isValid;
}
function showValidationErrors() {
const errors = [];
if (!document.getElementById('monthlyIncome').value || parseFloat(document.getElementById('monthlyIncome').value) <= 0) {
errors.push(tStrings.error_income);
}
if (!document.getElementById('monthlyExpenses').value || parseFloat(document.getElementById('monthlyExpenses').value) <= 0) {
errors.push(tStrings.error_expenses);
}
if (!document.getElementById('currentSavings').value || parseFloat(document.getElementById('currentSavings').value) < 0) {
errors.push(tStrings.error_savings);
}
if (!document.getElementById('expectedReturn').value || parseFloat(document.getElementById('expectedReturn').value) <= 0) {
errors.push(tStrings.error_return);
}
if (errors.length > 0 && validationErrorsContainer) {
const errorsList = errors.map(error => `
${tStrings.error_headline}
- ${errorsList}
${tip}
`
).join(''); // FIRE-Interpretation aktualisieren
const interpretation = document.getElementById('fire-interpretation');
let interpretationText = '';
let alertClass = 'alert-secondary';
if (results.yearsToFire <= 0) {
interpretationText = 'Exzellent! Sie haben die finanzielle Unabhängigkeit bereits erreicht. Fokussieren Sie sich nun auf den Erhalt und das Management Ihres Vermögens.';
alertClass = 'alert-success';
} else if (results.yearsToFire <= 15) {
interpretationText = `Sehr gut! Mit ${Math.round(results.yearsToFire)} Jahren bis zur FIRE sind Sie auf einem ausgezeichneten Weg. Ihre Sparquote von ${results.savingsRate.toFixed(1)}% ist beeindruckend.`;
alertClass = 'alert-success';
} else if (results.yearsToFire <= 25) {
interpretationText = `Gut! ${Math.round(results.yearsToFire)} Jahre bis zur FIRE ist ein realistisches Ziel. Überprüfen Sie regelmäßig Ihre Strategie und passen Sie sie bei Bedarf an.`;
alertClass = 'alert-info';
} else if (results.yearsToFire <= 40) {
interpretationText = `Solide Basis! Mit ${Math.round(results.yearsToFire)} Jahren haben Sie noch Zeit für Optimierungen. Erhöhen Sie schrittweise Ihre Sparrate oder reduzieren Sie Ausgaben.`;
alertClass = 'alert-warning';
} else {
interpretationText = `Herausforderung! ${Math.round(results.yearsToFire)} Jahre sind sehr lang. Überdenken Sie grundlegend Ihre Einnahmen- und Ausgabenstruktur. Professionelle Beratung kann hilfreich sein.`;
alertClass = 'alert-danger';
}
interpretation.className = `alert ${alertClass}`;
interpretation.textContent = interpretationText; // Eingaben-Übersicht aktualisieren
document.getElementById('einkommen-result').textContent = formatCurrency(parseFloat(document.getElementById('monthlyIncome').value) || 0);
document.getElementById('ausgaben-result').textContent = formatCurrency(parseFloat(document.getElementById('monthlyExpenses').value) || 0);
document.getElementById('ersparnisse-result').textContent = formatCurrency(parseFloat(document.getElementById('currentSavings').value) || 0);
document.getElementById('rendite-result').textContent = (parseFloat(document.getElementById('expectedReturn').value) || 0) + '%';
document.getElementById('fire-typ-result').textContent = document.querySelector('select[name="fireType"] option:checked').textContent || '-';
document.getElementById('land-result').textContent = results.selectedCountry.charAt(0).toUpperCase() + results.selectedCountry.slice(1);
document.getElementById('alter-result').textContent = (parseFloat(document.getElementById('currentAge').value) || 0) + ' Jahre';
document.getElementById('sparquote-result').textContent = results.savingsRate.toFixed(1) + '%';
resultContainer.style.display = 'block';
if (validationErrorsContainer) validationErrorsContainer.style.display = 'none';
}
// Tooltips aktivieren
if (typeof $ !== 'undefined' && $.fn.tooltip) {
$('[data-toggle="tooltip"]').tooltip();
}
});