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++; }