updated help and advanced table

This commit is contained in:
Tobias Brunner 2025-07-23 11:42:22 +02:00
parent 4746cfac25
commit 4f8fb0a448
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
5 changed files with 238 additions and 36 deletions

View file

@ -495,4 +495,80 @@
.table th, .table td {
padding: 0.5rem 0.25rem;
}
}
/* Monthly Breakdown Filter Controls */
.breakdown-filters {
background: #f8f9fa;
border-radius: 6px;
padding: 1rem;
margin-bottom: 1rem;
}
.breakdown-filters .form-check {
margin-bottom: 0.25rem;
}
.breakdown-filters .form-check-input:checked {
background-color: #0d6efd;
border-color: #0d6efd;
}
.breakdown-filters .form-check-label {
cursor: pointer;
user-select: none;
font-size: 0.875rem;
}
/* Responsive breakdown filters */
@media (max-width: 768px) {
.breakdown-filters {
padding: 0.75rem;
}
.breakdown-filters .d-flex {
flex-direction: column;
gap: 0.5rem !important;
}
}
/* Enhanced sticky header for monthly breakdown table */
.table-responsive {
position: relative;
}
.table-responsive .sticky-top {
position: sticky;
top: 0;
z-index: 10;
background-color: #212529 !important; /* Ensure dark background stays */
}
.table-responsive .sticky-top th {
background-color: #212529 !important;
border-color: #454d55 !important;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* Ensure sticky header works in scrollable containers */
.table-responsive[style*="max-height"] .sticky-top {
position: sticky;
top: 0;
z-index: 20;
}
/* Additional styling for better visibility */
.table-dark th {
font-weight: 600;
font-size: 0.875rem;
white-space: nowrap;
text-align: center;
}
.table-dark th:first-child {
text-align: center;
}
.table-dark th:nth-child(n+4) {
text-align: right;
}

View file

@ -402,6 +402,16 @@ class ROICalculatorApp {
// toggleInvestmentModel removed - both models are now calculated simultaneously
updateMonthlyBreakdownFilters() {
try {
if (this.uiManager) {
this.uiManager.updateMonthlyBreakdown();
}
} catch (error) {
console.error('Error updating monthly breakdown filters:', error);
}
}
logout() {
if (!confirm('Are you sure you want to logout?')) {
return;

View file

@ -131,12 +131,21 @@ class UIManager {
tbody.innerHTML = '';
// Get filter settings
const filters = this.getMonthlyBreakdownFilters();
// Combine all monthly data and sort by month, then scenario, then model
const allData = [];
Object.keys(this.calculator.monthlyData).forEach(resultKey => {
this.calculator.monthlyData[resultKey].forEach(monthData => {
const model = resultKey.includes('_loan') ? 'loan' : 'direct';
const scenario = resultKey.replace('_direct', '').replace('_loan', '');
// Apply filters
if (!filters.models[model] || !filters.scenarios[scenario.toLowerCase()]) {
return; // Skip this entry if filtered out
}
allData.push({
...monthData,
model: model,
@ -176,6 +185,7 @@ class UIManager {
<td class="text-end">${data.totalInstances ? data.totalInstances.toLocaleString() : '0'}</td>
<td class="text-end">${this.formatCurrencyDetailed(data.monthlyRevenue || 0)}</td>
<td class="text-end fw-bold">${this.formatCurrencyDetailed(data.cspRevenue || 0)}</td>
<td class="text-end text-muted">${this.formatCurrencyDetailed(data.servalaRevenue || 0)}</td>
<td class="text-end fw-bold ${netPositionClass}">${this.formatCurrencyDetailed(data.netPosition || 0)}</td>
`;
});
@ -253,4 +263,27 @@ class UIManager {
default: return '#6c757d';
}
}
getMonthlyBreakdownFilters() {
try {
return {
models: {
direct: document.getElementById('breakdown-direct-enabled')?.checked ?? true,
loan: document.getElementById('breakdown-loan-enabled')?.checked ?? true
},
scenarios: {
conservative: document.getElementById('breakdown-conservative-enabled')?.checked ?? true,
moderate: document.getElementById('breakdown-moderate-enabled')?.checked ?? true,
aggressive: document.getElementById('breakdown-aggressive-enabled')?.checked ?? true
}
};
} catch (error) {
console.error('Error getting monthly breakdown filters:', error);
// Return default filters if there's an error
return {
models: { direct: true, loan: true },
scenarios: { conservative: true, moderate: true, aggressive: true }
};
}
}
}