Gonçalo Rodrigues 7a2cb10c79 feat(finance): dark mode UI overhaul + admin seed data
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>
2026-06-13 12:16:23 +01:00

71 lines
2.2 KiB
HTML

{{define "content"}}
{{$d := .}}
<h1 style="margin-bottom:24px;">Accounts</h1>
<div class="card animate-on-scroll">
<h2 style="margin-bottom:16px;">Add Account</h2>
<form method="POST" class="flex flex-wrap" style="gap:10px; align-items:flex-end;">
<div class="form-group" style="margin-bottom:0; flex:1; min-width:180px;">
<label>Account Name</label>
<input type="text" name="name" placeholder="e.g. CGD Checking" required>
</div>
<div class="form-group" style="margin-bottom:0; min-width:160px;">
<label>Type</label>
<select name="type">
<option value="checking">Checking</option>
<option value="savings">Savings</option>
<option value="credit">Credit Card</option>
<option value="securities">Securities</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Add</button>
</form>
</div>
<div class="card animate-on-scroll">
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th></th>
</tr>
</thead>
<tbody>
{{range $d.Accounts}}
<tr id="acct-row-{{.ID}}">
<td style="font-weight:500;">{{.Name}}</td>
<td>
{{$icon := "🏦"}}
{{if eq .Type "savings"}}{{$icon = "🏧"}}{{end}}
{{if eq .Type "credit"}}{{$icon = "💳"}}{{end}}
{{if eq .Type "securities"}}{{$icon = "📈"}}{{end}}
<span class="badge" style="background:var(--bg3); color:var(--text2); border:1px solid var(--border2);">
{{$icon}} {{.Type}}
</span>
</td>
<td class="text-right">
<button class="btn btn-danger btn-sm" onclick="delAccount('{{.ID}}')">Delete</button>
</td>
</tr>
{{else}}
<tr>
<td colspan="3" class="text-center text-muted" style="padding:36px;">No accounts yet.</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
<script>
function delAccount(id) {
if (!confirm('Delete this account?')) return;
fetch('/accounts/' + id, {method: 'DELETE'}).then(r => {
if (r.ok) document.getElementById('acct-row-' + id).remove();
});
}
</script>
{{end}}