From 4cfe80e3d520eed6181410b0942671a0d9e36674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Rodrigues?= Date: Fri, 19 Jun 2026 22:27:31 +0100 Subject: [PATCH] feat(finance): goal monthly funding status on dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each committed goal card now shows a "This month" section beneath the overall progress bar with three states: - ✓ On track (green) when funded >= monthly need - partial (amber) showing shortfall + "Fund it →" link - unfunded (red) with monthly amount needed + "Fund it →" link "Fund it →" deep-links to /transactions?fund_goal= which auto-opens the Add Transaction modal with the goal pre-selected. Co-Authored-By: Claude Sonnet 4.6 --- .../finance/services/api/main/locales/en.toml | 7 +++ .../finance/services/api/main/locales/pt.toml | 7 +++ .../api/main/templates/dashboard.html | 59 +++++++++++++++---- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/apps/finance/services/api/main/locales/en.toml b/apps/finance/services/api/main/locales/en.toml index 7344499..f173852 100644 --- a/apps/finance/services/api/main/locales/en.toml +++ b/apps/finance/services/api/main/locales/en.toml @@ -230,6 +230,13 @@ section_title = "Committed goals" all_goals_link = "→ all goals" months_left = "mo left" per_month_needed = "/mo needed" +of = "of" +this_month = "This month" +funded = "On track" +fund_link = "Fund it" +needed = "needed" +left_to_fund = "left to fund" +needed_this_month = "needed this month" [dashboard.fixed_costs] section_title = "Fixed costs" diff --git a/apps/finance/services/api/main/locales/pt.toml b/apps/finance/services/api/main/locales/pt.toml index 8995294..ddd101c 100644 --- a/apps/finance/services/api/main/locales/pt.toml +++ b/apps/finance/services/api/main/locales/pt.toml @@ -230,6 +230,13 @@ section_title = "Objetivos comprometidos" all_goals_link = "→ todos os objetivos" months_left = "meses restantes" per_month_needed = "/mês necessários" +of = "de" +this_month = "Este mês" +funded = "No bom caminho" +fund_link = "Financiar" +needed = "necessários" +left_to_fund = "em falta" +needed_this_month = "necessários este mês" [dashboard.fixed_costs] section_title = "Custos fixos" diff --git a/apps/finance/services/api/main/templates/dashboard.html b/apps/finance/services/api/main/templates/dashboard.html index 26781b9..c29838d 100644 --- a/apps/finance/services/api/main/templates/dashboard.html +++ b/apps/finance/services/api/main/templates/dashboard.html @@ -377,28 +377,65 @@ function wfToggleCat(id) {

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

{{$d.T.Get "dashboard.goals.all_goals_link"}} -
+
{{range $d.DashGoals}} + {{$funded := index $d.GoalFundedThisMonth .ID}} + {{$needed := .MonthlyCents}} + {{$met := ge $funded $needed}} + {{$partial := and (gt $funded 0) (not $met)}} + {{$monthPct := 0}} + {{if gt $needed 0}}{{$monthPct = clampPct $funded $needed}}{{end}}
-
-
- {{if eq .Type "once"}}🎯{{else if eq .Type "deposit"}}🏠{{else if eq .Type "emergency"}}🛡️{{else}}📈{{end}} - {{.Name}} + +
+
+ {{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"}} +
+ {{.MonthsLeft}}{{$d.T.Get "dashboard.goals.months_left"}} {{.ProgressPct}}%
-
+ +
-
- €{{cents .SavedCents}} of €{{cents .TargetCents}} - €{{cents .MonthlyCents}}{{$d.T.Get "dashboard.goals.per_month_needed"}} +
+ €{{cents .SavedCents}} {{$d.T.Get "dashboard.goals.of"}} €{{cents .TargetCents}}
+ + + {{if gt $needed 0}} +
+
+ {{$d.T.Get "dashboard.goals.this_month"}} + {{if $met}} + ✓ {{$d.T.Get "dashboard.goals.funded"}} + {{else if $partial}} + {{$d.T.Get "dashboard.goals.fund_link"}} → + {{else}} + {{$d.T.Get "dashboard.goals.fund_link"}} → + {{end}} +
+
+
+
+
+ {{if $met}} + €{{cents $funded}} {{$d.T.Get "dashboard.goals.of"}} €{{cents $needed}} {{$d.T.Get "dashboard.goals.needed"}} + {{else if $partial}} + €{{cents $funded}} {{$d.T.Get "dashboard.goals.of"}} €{{cents $needed}} — €{{cents (sub $needed $funded)}} {{$d.T.Get "dashboard.goals.left_to_fund"}} + {{else}} + €{{cents $needed}} {{$d.T.Get "dashboard.goals.needed_this_month"}} + {{end}} +
+
+ {{end}}
{{end}}