From c8c867ff66fc06b0270c48b29bc17a26727ab70e Mon Sep 17 00:00:00 2001 From: Chris Olson Date: Fri, 4 Sep 2026 12:20:33 -0400 Subject: [PATCH] Add District Performance chart and count planned activities as touched Executive Overview now shows a District Performance bar chart with Activities (occurred), Planned (future), and Accounts Touched per district. Planned activities now count toward the account's touch data so scheduling future engagement flips an account to "touched." Co-Authored-By: Claude Opus 4.6 --- src/app/(dashboard)/page.tsx | 38 ++++++++++++++++++++++++++++++++++++ src/lib/db.ts | 4 +--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/app/(dashboard)/page.tsx b/src/app/(dashboard)/page.tsx index 98e0c40..3935a73 100644 --- a/src/app/(dashboard)/page.tsx +++ b/src/app/(dashboard)/page.tsx @@ -76,6 +76,28 @@ export default function ExecutiveOverview() { return Array.from(districtMap.entries()).map(([name, data]) => ({ name, ...data })); }, [accounts, allStatuses]); + const districtActivity = useMemo(() => { + const todayStr = new Date().toISOString().split('T')[0]; + const districtMap = new Map }>(); + activities.forEach(a => { + const d = DISTRICT_SHORT[a.District_Name] || a.District_Name; + if (!districtMap.has(d)) districtMap.set(d, { occurred: 0, planned: 0, touchedAccounts: new Set() }); + const m = districtMap.get(d)!; + if (a.Status === 'Planned' || a.Activity_Date > todayStr) { + m.planned++; + } else { + m.occurred++; + } + m.touchedAccounts.add(a.Account_Name); + }); + return Array.from(districtMap.entries()).map(([name, data]) => ({ + name, + 'Activities': data.occurred, + 'Planned': data.planned, + 'Accounts Touched': data.touchedAccounts.size, + })); + }, [activities]); + const pipelineByForecast = useMemo(() => { const districtMap = new Map>(); pipeline.filter(p => p.Stage !== '06-Closed Won' && p.Stage !== '07-Closed Lost').forEach(p => { @@ -170,6 +192,22 @@ export default function ExecutiveOverview() { +
+ + + + + + } /> + + + + + + + +
+
diff --git a/src/lib/db.ts b/src/lib/db.ts index f8fb749..4a385b4 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -428,9 +428,7 @@ export function addActivity(record: { Status: status, }); - if (!status || status !== 'Planned') { - updateLastTouched(record.Account_Name, record.Activity_Date); - } + updateLastTouched(record.Account_Name, record.Activity_Date); } export function updateActivityStatus(id: number, updates: { Status: string; Outcome?: string | null; Notes?: string | null }) {