UI — full dark/light theme system: - CSS custom-property token system (--bg, --surface, --accent, --green, --red, etc.) with complete light-mode overrides via [data-theme="light"] - Sticky frosted-glass nav with animated brand icon, theme toggle persisted to localStorage, respects prefers-color-scheme on first visit - Cards with layered shadows, glass backdrop-filter, shimmer accent stripe on value cards - Glowing category color dots, colored P&L badges, budget bars with glow effect - All Chart.js instances use CSS-variable-aware grid/text colours - Scroll-reveal animations and animated money counters on every KPI card - 3-D donut portfolio chart recoloured to match palette; hover lifts the hovered slice - Accounts page shows type emoji icons; delete removes row in-place - Sharing page search dropdown themed with var() colours - Import preview: colour-coded left border on category select driven by category colour - Projections: second KPI card (monthly avg) + pace bars per category Seed data (seed.go): - SeedAdmin() runs in a goroutine at startup; idempotent (skips if transactions exist) - Resolves admin user ID via internal users service GET /admin/users?search=<email> (SEED_USER_EMAIL env var, defaults to admin@homelab.local) - Seeds 4 accounts (CGD Checking, CGD Savings, Visa Credit, Trade Republic) - Seeds 14 categories with colours and monthly budgets - Seeds ~65 realistic Portuguese household transactions spread across 6 months - Seeds 7 ETF buy trades across VWCE, SXR8 (S&P 500), EUNL (MSCI World) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
88 lines
3.1 KiB
HTML
88 lines
3.1 KiB
HTML
{{define "content"}}
|
|
{{$d := .}}
|
|
<h1 style="margin-bottom:24px;">Monthly Reports</h1>
|
|
|
|
<div class="card animate-on-scroll">
|
|
<h2>12-Month Spend by Category</h2>
|
|
<div style="padding-top:8px;">
|
|
<canvas id="reportChart" height="280"></canvas>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card animate-on-scroll" style="overflow-x:auto;">
|
|
<h2 style="margin-bottom:14px;">Breakdown by Month</h2>
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Month</th>
|
|
{{range $cat, $_ := $d.CategoryNames}}
|
|
{{$color := index $d.CategoryColors $cat}}
|
|
<th class="text-right" style="white-space:nowrap;">
|
|
{{if $color}}<span style="display:inline-block;width:7px;height:7px;border-radius:50%;background:{{$color}};margin-right:4px;vertical-align:middle;box-shadow:0 0 4px {{$color}}88;"></span>{{end}}{{$cat}}
|
|
</th>
|
|
{{end}}
|
|
<th class="text-right">Total</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range $row := $d.MonthlyData}}
|
|
{{$total := sub 0 0}}
|
|
{{range $_, $v := $row.Totals}}{{$total = add $total $v}}{{end}}
|
|
<tr>
|
|
<td style="font-weight:600; white-space:nowrap;">{{$row.Month}}</td>
|
|
{{range $cat, $_ := $d.CategoryNames}}
|
|
{{$v := index $row.Totals $cat}}
|
|
<td class="cents">
|
|
{{if $v}}<span class="{{if lt $v 0}}negative{{else}}positive{{end}}">€{{cents $v}}</span>{{else}}<span class="text-muted">—</span>{{end}}
|
|
</td>
|
|
{{end}}
|
|
<td class="cents" style="font-weight:600;">
|
|
<span class="{{if lt $total 0}}negative{{else}}positive{{end}}">€{{cents $total}}</span>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const isDark = () => document.documentElement.getAttribute('data-theme') === 'dark';
|
|
const gridC = () => isDark() ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.06)';
|
|
const textC = () => isDark() ? '#5c6585' : '#8a92b0';
|
|
|
|
new Chart(document.getElementById('reportChart'), {
|
|
type: 'bar',
|
|
data: {
|
|
labels: [{{range $d.MonthlyData}}"{{.Month}}",{{end}}],
|
|
datasets: [
|
|
{{$colors := $d.CategoryColors}}
|
|
{{range $cat, $_ := $d.CategoryNames}}
|
|
{
|
|
label: '{{$cat}}',
|
|
data: [{{range $d.MonthlyData}}{{$v := index .Totals $cat}}{{if $v}}{{abs $v | div 100}}{{else}}0{{end}},{{end}}],
|
|
backgroundColor: '{{index $colors $cat}}cc',
|
|
borderColor: '{{index $colors $cat}}',
|
|
borderWidth: 0,
|
|
borderRadius: 3,
|
|
},
|
|
{{end}}
|
|
]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
animation: { duration: 900, easing: 'easeOutQuart' },
|
|
plugins: {
|
|
legend: { position: 'bottom', labels: { boxWidth: 11, padding: 14, color: textC(), usePointStyle: true, pointStyle: 'circle' } },
|
|
tooltip: { mode: 'index', intersect: false }
|
|
},
|
|
scales: {
|
|
x: { stacked: true, grid: { display: false }, ticks: { color: textC() } },
|
|
y: { stacked: true, beginAtZero: true, grid: { color: gridC() }, ticks: { color: textC(), callback: v => '€' + v } }
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
{{end}}
|