Status history: every event-lead status change is recorded (service-counter.event_lead_status_change) with time and user; capture records the first status. Existing leads are backfilled with approximate times.
Dashboard on the portal home page for users with the new BO_DASHBOARD module (others keep the welcome):
period: this month (default), last month, or a custom range up to 731 days, in Malaysian time; trend by day up to 62 days, else by month;
tiles: captures, new leads, won in period, conversion rate, median days to win, overdue follow-ups;
status funnel, captures/wins trend (recharts), breakdowns by event (drill-down to event leads), salesperson (incl. Unassigned) and interest;
company scope as everywhere: staff see their company, super admins all or the picked one.
Dashboard appears first in the sidebar (module id 40050000); super admins grant it under Roles.
Layers
services-counter: history writes in capture/update; POST /counter/dashboard/leads — three bound-parameter native queries, aggregation in a pure unit-tested calculator (ponytail: ceiling noted).
mobile-api: GET /api/admin/dashboard/leads (BO_DASHBOARD, period validation and defaults, company scope, salesperson names).
portal: recharts 3.10.1 + shadcn chart.tsx (allow-listed in the HTML-sink sweep, as in babyboo: its <style> is built from code constants only), proxy app/api/dashboard/leads, LeadDashboard, phone cards.
SQL in openspec/changes/add-lead-dashboard/sql/, mirrored in local/seed/03-colite.sql; docs/deployment.md lists them. Run 01–03 before the new images go live (services-counter writes the new table on every capture and status edit).
Per-task Opus reviews (2 tasks needed one fix round) and a whole-branch Opus review: PASS.
Live check against the local stack and Playwright at 1280 and 360 px: super admin all / CV; INS staff scoped (asking for CV still gets INS); staff without the module see the welcome and the API is never called (403 if called); reversed and >731-day ranges 400 with a message; wins, median and overdue correct after real status edits; history rows correct; drill-down link.
The live check found three bugs the tests missed, each fixed test-first: mobile-api did not start (two constructors, no @Autowired), the sidebar showed BO_DASHBOARD, the last phone card lost its border.
Known / accepted
Backfilled history times are approximate.
Event with a missing event row shows a blank name (local test data only).
An empty bearer token gives 500 instead of 401 (pre-existing, HttpReqRespUtils.getJwtToken).
Salesperson names are looked up one call per distinct salesperson (existing pattern).
Even number of wins: median is the lower middle value (per design).
OpenSpec change `add-lead-dashboard`. Design: `docs/superpowers/specs/2026-12-01-lead-dashboard-design.md`.
## What it does
- **Status history:** every event-lead status change is recorded (`service-counter.event_lead_status_change`) with time and user; capture records the first status. Existing leads are backfilled with approximate times.
- **Dashboard** on the portal home page for users with the new `BO_DASHBOARD` module (others keep the welcome):
- period: this month (default), last month, or a custom range up to 731 days, in Malaysian time; trend by day up to 62 days, else by month;
- tiles: captures, new leads, won in period, conversion rate, median days to win, overdue follow-ups;
- status funnel, captures/wins trend (recharts), breakdowns by event (drill-down to event leads), salesperson (incl. Unassigned) and interest;
- company scope as everywhere: staff see their company, super admins all or the picked one.
- `Dashboard` appears first in the sidebar (module id 40050000); super admins grant it under Roles.
## Layers
- services-counter: history writes in capture/update; `POST /counter/dashboard/leads` — three bound-parameter native queries, aggregation in a pure unit-tested calculator (`ponytail:` ceiling noted).
- mobile-api: `GET /api/admin/dashboard/leads` (`BO_DASHBOARD`, period validation and defaults, company scope, salesperson names).
- portal: `recharts` 3.10.1 + shadcn `chart.tsx` (allow-listed in the HTML-sink sweep, as in babyboo: its `<style>` is built from code constants only), proxy `app/api/dashboard/leads`, `LeadDashboard`, phone cards.
- SQL in `openspec/changes/add-lead-dashboard/sql/`, mirrored in `local/seed/03-colite.sql`; `docs/deployment.md` lists them. **Run 01–03 before the new images go live** (services-counter writes the new table on every capture and status edit).
## Verification
- services-counter 168, mobile-api 731, portal 1375 tests green; lint 0 errors; tsc clean.
- Per-task Opus reviews (2 tasks needed one fix round) and a whole-branch Opus review: PASS.
- Live check against the local stack and Playwright at 1280 and 360 px: super admin all / CV; INS staff scoped (asking for CV still gets INS); staff without the module see the welcome and the API is never called (403 if called); reversed and >731-day ranges 400 with a message; wins, median and overdue correct after real status edits; history rows correct; drill-down link.
- The live check found three bugs the tests missed, each fixed test-first: mobile-api did not start (two constructors, no `@Autowired`), the sidebar showed `BO_DASHBOARD`, the last phone card lost its border.
## Known / accepted
- Backfilled history times are approximate.
- Event with a missing `event` row shows a blank name (local test data only).
- An empty bearer token gives 500 instead of 401 (pre-existing, `HttpReqRespUtils.getJwtToken`).
- Salesperson names are looked up one call per distinct salesperson (existing pattern).
- Even number of wins: median is the lower middle value (per design).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
recharts 3.10.1 (same as babyboo's portal) for the lead dashboard trend.
The chart wrapper's <style> is built from its colour config only, so it
joins the HTML-sink allow list as in babyboo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Capture and status edits append to event_lead_status_change. POST
/counter/dashboard/leads aggregates captures, wins, overdue follow-ups
and the breakdowns for a Malaysian-day period (at most 731 days).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Users with BO_DASHBOARD get period presets, capture and win tiles, the
status funnel, a captures/wins trend and breakdowns by event,
salesperson and interest; everyone else keeps the welcome.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
OpenSpec change
add-lead-dashboard. Design:docs/superpowers/specs/2026-12-01-lead-dashboard-design.md.What it does
service-counter.event_lead_status_change) with time and user; capture records the first status. Existing leads are backfilled with approximate times.BO_DASHBOARDmodule (others keep the welcome):Dashboardappears first in the sidebar (module id 40050000); super admins grant it under Roles.Layers
POST /counter/dashboard/leads— three bound-parameter native queries, aggregation in a pure unit-tested calculator (ponytail:ceiling noted).GET /api/admin/dashboard/leads(BO_DASHBOARD, period validation and defaults, company scope, salesperson names).recharts3.10.1 + shadcnchart.tsx(allow-listed in the HTML-sink sweep, as in babyboo: its<style>is built from code constants only), proxyapp/api/dashboard/leads,LeadDashboard, phone cards.openspec/changes/add-lead-dashboard/sql/, mirrored inlocal/seed/03-colite.sql;docs/deployment.mdlists them. Run 01–03 before the new images go live (services-counter writes the new table on every capture and status edit).Verification
@Autowired), the sidebar showedBO_DASHBOARD, the last phone card lost its border.Known / accepted
eventrow shows a blank name (local test data only).HttpReqRespUtils.getJwtToken).🤖 Generated with Claude Code
https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM