From 0f928b08e94d3f4af776262f69cfbad13ebde19d Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Thu, 12 Mar 2026 19:13:49 +0200 Subject: [PATCH] fix: dashboard stats exclude closed entries + auto-tracked deadlines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - aggregateDeadlines() now skips entries with status "inchis" - Auto-tracked/background deadlines excluded from active/urgent/overdue counts - Only user-created deadlines affect badge numbers - Milestone dots vertically centered on progress bar (top-[5px], h-2.5) - Milestone tooltips now show full date ("Data maximă: 15 februarie 2026") - Countdown text shows date on hover too Co-Authored-By: Claude Opus 4.6 --- .../components/deadline-dashboard.tsx | 21 ++++++++++++++++--- .../registratura/services/deadline-service.ts | 18 ++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/modules/registratura/components/deadline-dashboard.tsx b/src/modules/registratura/components/deadline-dashboard.tsx index c0f386c..fb630f6 100644 --- a/src/modules/registratura/components/deadline-dashboard.tsx +++ b/src/modules/registratura/components/deadline-dashboard.tsx @@ -36,6 +36,18 @@ interface DeadlineDashboardProps { ) => void; } +function formatFullDate(iso: string): string { + try { + return new Date(iso).toLocaleDateString("ro-RO", { + day: "2-digit", + month: "long", + year: "numeric", + }); + } catch { + return iso; + } +} + const VARIANT_DOT: Record = { green: "bg-green-500", yellow: "bg-amber-500", @@ -327,6 +339,7 @@ interface ProgressMilestone { label: string; isPassed: boolean; typeId: string; + dueDate: string; // ISO date for tooltip } function computeMilestones( @@ -359,6 +372,7 @@ function computeMilestones( label: getMilestoneLabel(def.id, dlDue < now), isPassed: dlDue < now, typeId: def.id, + dueDate: dl.dueDate, }); } @@ -498,13 +512,13 @@ function DeadlineRow({ {milestones.map((ms) => (
{status.daysRemaining < 0 ? `${Math.abs(status.daysRemaining)}z depasit` diff --git a/src/modules/registratura/services/deadline-service.ts b/src/modules/registratura/services/deadline-service.ts index 627dbe6..be2450f 100644 --- a/src/modules/registratura/services/deadline-service.ts +++ b/src/modules/registratura/services/deadline-service.ts @@ -225,6 +225,9 @@ export function aggregateDeadlines(entries: RegistryEntry[]): { now.setHours(0, 0, 0, 0); for (const entry of entries) { + // Skip closed entries — their deadlines are no longer actionable + if (entry.status === "inchis") continue; + // Check missing recipient registration for outgoing entries if ( entry.direction === "iesit" && @@ -249,14 +252,21 @@ export function aggregateDeadlines(entries: RegistryEntry[]): { } for (const dl of entry.trackedDeadlines ?? []) { + // Skip auto-tracked/background sub-deadlines from top-level stats + const dlDef = getDeadlineType(dl.typeId); + if (dlDef?.backgroundOnly) continue; + const status = getDeadlineDisplayStatus(dl); all.push({ deadline: dl, entry, status }); if (dl.resolution === "pending") { - active++; - if (status.variant === "yellow") urgent++; - if (status.variant === "red") overdue++; - if (status.variant === "blue") tacit++; + // Only count user-created (non-auto-track) deadlines in main stats + if (!dlDef?.autoTrack) { + active++; + if (status.variant === "yellow") urgent++; + if (status.variant === "red") overdue++; + if (status.variant === "blue") tacit++; + } } else if (dl.resolution === "aprobat-tacit") { tacit++; }