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 }) {