From c4f02a84c83d9698ec8a6f797497921fa388744a Mon Sep 17 00:00:00 2001 From: Chris Olson Date: Fri, 4 Sep 2026 12:21:34 -0400 Subject: [PATCH] Add Planned activities column to Exec Summary district table Split the Activities column into Activities (occurred) and Planned (future) to match the Executive Overview's District Performance chart. Co-Authored-By: Claude Opus 4.6 --- .../(dashboard)/reports/executive/page.tsx | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/app/(dashboard)/reports/executive/page.tsx b/src/app/(dashboard)/reports/executive/page.tsx index 4f19883..e5a75e6 100644 --- a/src/app/(dashboard)/reports/executive/page.tsx +++ b/src/app/(dashboard)/reports/executive/page.tsx @@ -80,11 +80,12 @@ export default function ExecutiveSummary() { }, [accounts]); const districtPerformance = useMemo(() => { - const districts = new Map; totalAccounts: number }>(); + const todayStr = format(now, 'yyyy-MM-dd'); + const districts = new Map; totalAccounts: number }>(); accounts.forEach(a => { const d = DISTRICT_SHORT[a.District_Name] || a.District_Name; - if (!districts.has(d)) districts.set(d, { pipeline: 0, activities: 0, accountsTouched: new Set(), totalAccounts: 0 }); + if (!districts.has(d)) districts.set(d, { pipeline: 0, activities: 0, planned: 0, accountsTouched: new Set(), totalAccounts: 0 }); const entry = districts.get(d)!; entry.totalAccounts++; if ((a.Touch_Count || 0) > 0) entry.accountsTouched.add(a.Account_Name); @@ -92,14 +93,19 @@ export default function ExecutiveSummary() { pipeline.filter(p => p.Stage !== '06-Closed Won' && p.Stage !== '07-Closed Lost').forEach(p => { const d = DISTRICT_SHORT[p.District_Name] || p.District_Name; - if (!districts.has(d)) districts.set(d, { pipeline: 0, activities: 0, accountsTouched: new Set(), totalAccounts: 0 }); + if (!districts.has(d)) districts.set(d, { pipeline: 0, activities: 0, planned: 0, accountsTouched: new Set(), totalAccounts: 0 }); districts.get(d)!.pipeline += p.Amount_USD; }); activities.forEach(a => { const d = DISTRICT_SHORT[a.District_Name] || a.District_Name; - if (!districts.has(d)) districts.set(d, { pipeline: 0, activities: 0, accountsTouched: new Set(), totalAccounts: 0 }); - districts.get(d)!.activities++; + if (!districts.has(d)) districts.set(d, { pipeline: 0, activities: 0, planned: 0, accountsTouched: new Set(), totalAccounts: 0 }); + const entry = districts.get(d)!; + if (a.Status === 'Planned' || a.Activity_Date > todayStr) { + entry.planned++; + } else { + entry.activities++; + } }); return Array.from(districts.entries()) @@ -107,11 +113,12 @@ export default function ExecutiveSummary() { name, pipeline: data.pipeline, activities: data.activities, + planned: data.planned, accountsTouched: data.accountsTouched.size, totalAccounts: data.totalAccounts, })) .sort((a, b) => b.pipeline - a.pipeline); - }, [pipeline, accounts, activities]); + }, [pipeline, accounts, activities, now]); const keyWins = useMemo(() => { return pipeline @@ -290,6 +297,7 @@ export default function ExecutiveSummary() { District Pipeline Activities + Planned Touched @@ -299,6 +307,7 @@ export default function ExecutiveSummary() { {d.name} {formatCurrency(d.pipeline, true)} {d.activities} + {d.planned} {d.accountsTouched}/{d.totalAccounts}