3.2 KiB
3.2 KiB
Task J: CRM Dashboard KPI and Sales Analytics
Files added
src/features/crm/dashboard/api/types.tssrc/features/crm/dashboard/api/service.tssrc/features/crm/dashboard/api/queries.tssrc/features/crm/dashboard/server/service.tssrc/features/crm/dashboard/components/crm-dashboard.tsxsrc/features/crm/dashboard/components/dashboard-filters.tsxsrc/features/crm/dashboard/components/dashboard-summary-cards.tsxsrc/features/crm/dashboard/components/dashboard-funnel.tsxsrc/features/crm/dashboard/components/dashboard-revenue-cards.tsxsrc/features/crm/dashboard/components/dashboard-sales-ranking.tsxsrc/features/crm/dashboard/components/dashboard-followups.tsxsrc/features/crm/dashboard/components/dashboard-approval-metrics.tsxsrc/features/crm/dashboard/components/dashboard-hot-projects.tsxsrc/app/api/crm/dashboard/route.tssrc/app/api/crm/dashboard/export/route.ts
Files modified
src/app/dashboard/crm/page.tsxsrc/config/nav-config.tssrc/lib/auth/rbac.tssrc/lib/searchparams.tsdocs/implementation/technical-debt.md
KPI widgets added
- Replaced the CRM placeholder route with a production dashboard at
/dashboard/crm. - Added summary cards for lead, opportunity, quotation, and revenue metrics.
- Added a funnel widget for lead -> opportunity -> quotation -> pending approval -> approved -> closed won.
- Added a hot-project widget based on real enquiry data.
Revenue analytics added
- Added top end-customer, billing-customer, contractor, and consultant revenue tables.
- Reused the Task D.2.1 reporting helpers so revenue attribution follows the frozen governance rules.
- Added export support for revenue analytics through the dashboard export route.
Sales ranking added
- Added a production sales ranking table using enquiry assignment and quotation salesman ownership rules.
- Added CSV export for sales ranking.
Approval and follow-up analytics added
- Added approval KPI cards and a
My Pending Approvalstable. - Added follow-up KPI cards and an
Upcoming Follow Upstable from enquiry and quotation follow-up sources.
Export and permissions added
- Added
crm.dashboard.read. - Added
crm.dashboard.export. - Added audit logging for
crm_dashboard_exportwithexport_csvandexport_excel. - Added sidebar navigation for the CRM dashboard.
Remaining risks
closed_wonis not yet a first-class enquiry lifecycle field, so the dashboard currently uses quotation statusacceptedas the practical won-stage proxy.- follow-up completion is inferred from
outcomepresence because the follow-up model still has no explicit completion flag. - the global
Project Party Rolefilter currently influences revenue analytics and exports, but the rest of the dashboard still depends mainly on enquiry and quotation core filters. - sales users currently read organization-wide dashboard data; own-scope filtering is still future work.
Task K readiness
- the CRM dashboard now uses real production data
- KPI widgets are live
- revenue analytics is reusable
- sales ranking is exportable
- approval and follow-up analytics exist
- export and audit hooks are in place
- the app is ready for Task K report-center expansion