From 99be71be8a3a1f7f4ff461dfda4410238fb4405d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Rodrigues?= Date: Sat, 13 Jun 2026 16:28:58 +0100 Subject: [PATCH] fix: replace month input with month/year dropdowns in goal modal Co-Authored-By: Claude Sonnet 4.6 --- .../services/api/main/templates/goals.html | 68 +++++++++++++++---- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/apps/finance/services/api/main/templates/goals.html b/apps/finance/services/api/main/templates/goals.html index b54a601..9ee1452 100644 --- a/apps/finance/services/api/main/templates/goals.html +++ b/apps/finance/services/api/main/templates/goals.html @@ -155,19 +155,39 @@

-
-
- - -
-
- - +
+ + +
+ +
+ +
+ +
+ +
@@ -190,6 +210,30 @@ function updateTypeHint(v) { document.getElementById('type-hint').textContent = typeHints[v] || ''; } +// populate year dropdown: current year + 10 years ahead +(function() { + const now = new Date(); + const yearSel = document.getElementById('deadline-year'); + const monthSel = document.getElementById('deadline-month'); + for (let y = now.getFullYear(); y <= now.getFullYear() + 10; y++) { + const opt = document.createElement('option'); + opt.value = String(y); + opt.textContent = String(y); + yearSel.appendChild(opt); + } + // default month to next month + const nextMonth = new Date(now.getFullYear(), now.getMonth() + 1, 1); + monthSel.value = String(nextMonth.getMonth() + 1).padStart(2, '0'); + yearSel.value = String(nextMonth.getFullYear()); +})(); + +// wire hidden field before submit +document.querySelector('#new-goal-modal form').addEventListener('submit', function() { + const m = document.getElementById('deadline-month').value; + const y = document.getElementById('deadline-year').value; + document.getElementById('deadline-value').value = y + '-' + m; +}); + // close modal on backdrop click document.getElementById('new-goal-modal').addEventListener('click', function(e) { if (e.target === this) this.style.display = 'none';