{{define "content"}} {{$d := .}}

{{$d.T.Get "dashboard.title"}}

{{if $d.Email}}{{$d.Email}}{{end}}
{{if $d.Alerts}}
{{range $d.Alerts}}
{{if eq .Level "danger"}}🔴{{else if eq .Level "warn"}}⚠{{else}}ℹ{{end}} {{.Message}}
{{end}}
{{end}}
{{$d.T.Get "dashboard.available_to_spend"}} {{$d.T.Get "dashboard.available_formula"}}
€0.00
of €0.00 {{$d.T.Get "dashboard.disposable_label"}}  ·  {{$d.MonthSpentPct}}% used
Month progress: {{$d.MonthProgressPct}}% Spent: {{$d.MonthSpentPct}}%

{{$d.T.Get "dashboard.cards.bank_should_be"}}

€0.00

{{$d.T.Get "dashboard.cards.bank_should_be_sub"}}

{{$d.T.Get "dashboard.cards.savings_rate"}}

{{$d.SavingsRatePct}}%
{{if $d.LastMonthSavingsRatePct}}

{{if gt $d.SavingsRatePct $d.LastMonthSavingsRatePct}}↑{{else}}↓{{end}} {{$d.T.Get "dashboard.alerts.vs_last_month_up"}} ({{$d.LastMonthSavingsRatePct}}%)

{{end}}

{{$d.T.Get "dashboard.cards.net_worth"}}

€0.00

{{$d.T.Get "dashboard.cards.net_worth_link"}}

{{$d.T.Get "dashboard.cards.portfolio_today"}}

{{if $d.PortfolioHoldings}}
€0.00
{{if $d.PortfolioPricesAvailable}}

{{if ge $d.PortfolioPCLCents 0}}+{{else}}−{{end}}€{{cents (centsAbs $d.PortfolioPCLCents)}} total P&L

{{else}}

{{$d.T.Get "dashboard.cards.portfolio_cost_basis"}}

{{end}} {{else}}
{{$d.T.Get "dashboard.cards.portfolio_no_trades"}}

{{$d.T.Get "dashboard.cards.portfolio_import_link"}}

{{end}}

{{$d.T.Get "dashboard.bank_math.section_title"}}

{{$d.T.Get "dashboard.bank_math.section_subtitle"}}
{{if $d.RecurringExpenses}}
{{range $d.RecurringExpenses}} {{$color := index $d.CategoryColors .Category}}
{{if $color}}{{end}} {{.Category}} − €{{cents .MonthlyCents}}
{{end}} {{if $d.SafetyBufferCents}}
{{$d.T.Get "dashboard.bank_math.safety_buffer"}} − €{{cents $d.SafetyBufferCents}}
{{end}}
{{$d.T.Get "dashboard.bank_math.minimum_recommended"}} €0.00
{{else}}

{{$d.T.Get "dashboard.bank_math.no_recurring_msg"}}
{{$d.T.Get "dashboard.bank_math.no_recurring_sub"}}

{{end}}

{{$d.T.Get "dashboard.stocks.section_title"}}

{{$d.T.Get "dashboard.stocks.portfolio_link"}}
{{if $d.PortfolioHoldings}}
{{range $d.PortfolioHoldings}}
{{.Name}}
{{printf "%.4f" .SharesOwned}} {{$d.T.Get "dashboard.stocks.shares_label"}}
{{if $d.PortfolioPricesAvailable}}
€{{cents .CurrentValueCents}}
{{pctSign .UnrealizedPCLPct}}{{printf "%.1f" .UnrealizedPCLPct}}%
{{else}}
€{{cents .TotalCostCents}}
{{$d.T.Get "dashboard.stocks.cost_basis"}}
{{end}}
{{end}}
{{$d.T.Get "dashboard.stocks.total_label"}}{{if not $d.PortfolioPricesAvailable}} {{$d.T.Get "dashboard.stocks.total_invested"}}{{end}} €0.00
{{else}}

{{$d.T.Get "dashboard.stocks.no_holdings_msg"}}
{{$d.T.Get "dashboard.stocks.import_link"}}

{{end}}
{{if $d.CategoryBudgets}}

{{$d.T.Get "dashboard.budget_health.section_title"}}

{{$d.T.Get "dashboard.budget_health.categories_link"}}
{{range $cat, $budget := $d.CategoryBudgets}} {{$spent := index $d.ThisMonth.ByCategory $cat}} {{$spentAbs := centsAbs $spent}} {{$color := index $d.CategoryColors $cat}} {{$over := isOver $spentAbs $budget}} {{$pct := clampPct $spentAbs $budget}}
{{if $color}}{{end}} {{$cat}} {{$pct}}%{{if $over}} ⚠{{end}}
{{end}}
{{end}}

{{$d.T.Get "dashboard.recent.section_title"}}

{{$d.T.Get "dashboard.recent.all_txns_link"}}
{{if $d.RecentTxns}}
{{range $d.RecentTxns}} {{$color := index $d.CategoryColors .Category}}
{{.Description}}
{{dateShort .Date}}
{{if lt .AmountCents 0}}−{{else}}+{{end}}€{{cents (centsAbs .AmountCents)}}
{{end}}
{{else}}
{{$d.T.Get "dashboard.recent.no_txns_msg"}} {{$d.T.Get "dashboard.recent.import_link"}}
{{end}}
{{if $d.DashGoals}}

{{$d.T.Get "dashboard.goals.section_title"}}

{{$d.T.Get "dashboard.goals.all_goals_link"}}
{{range $d.DashGoals}}
{{if eq .Type "once"}}🎯{{else if eq .Type "deposit"}}🏠{{else if eq .Type "emergency"}}🛡️{{else}}📈{{end}} {{.Name}}
{{.MonthsLeft}}{{$d.T.Get "dashboard.goals.months_left"}} {{.ProgressPct}}%
€{{cents .SavedCents}} of €{{cents .TargetCents}} €{{cents .MonthlyCents}}{{$d.T.Get "dashboard.goals.per_month_needed"}}
{{end}}
{{end}} {{if $d.RecurringExpenses}}

{{$d.T.Get "dashboard.fixed_costs.section_title"}}

{{$d.T.Get "dashboard.fixed_costs.auto_detected"}}
{{range $d.RecurringExpenses}} {{$color := index $d.CategoryColors .Category}}
{{if .IsGoal}} {{else if $color}} {{end}}
{{.Category}}
{{if .IsGoal}}{{$d.T.Get "dashboard.fixed_costs.committed_goal"}}{{else}}{{$d.T.Get "dashboard.fixed_costs.recurring_expense"}}{{end}}
− €{{cents .MonthlyCents}}
{{$d.T.Get "dashboard.fixed_costs.per_month"}}
{{end}}
{{$d.T.Get "dashboard.fixed_costs.total_committed"}} €0
{{end}} {{end}}