Adds the lead-records and lead-export main specs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
4.1 KiB
4.1 KiB
Proposal
Why
Change 4a lets staff capture leads at an event and work them one event at a time. Staff still cannot see a person across events, correct a lead's details, or take a list out to work it elsewhere. This is change 4b of the design's change 4 (see docs/superpowers/specs/2026-11-26-co-lite-foundation-and-leads-design.md, Listings and Access). It completes what go-live needs for leads.
What Changes
- Lead Listing (
/leads): every lead in the company in one list. Search by name, mobile or email. Each row shows name, mobile, email, company, number of events, last event and latest salesperson, all worked out when the list is read. Server-side paging, newest capture first. - Lead detail (
/leads/{leadUuid}): the lead's fields, plus its event history. The history lists every event the lead was captured at, newest first, with lead type, salesperson, temperature and status. When another lead in the company shares this lead's mobile or email, the page shows a warning naming that lead. Nothing is merged. - Lead edit on the detail page: name, mobile, email, company, job title and notes. These use the same normalisation and validation as capture. A save that makes the mobile or email the same as another lead's is allowed, and the warning then shows.
- xlsx export of the Lead Listing and of the Event Leads Listing. Each export has exactly the columns shown on screen and applies the current search or filters, across all pages, not just the visible one.
- Mobile numbers are written as text, so Excel keeps the
+. - Dates are written as real dates.
- The export stops at 20,000 rows; above that, staff are asked to narrow the filters.
- The file is built in
mobile-apiwith Apache POI's streaming writer. - Each export is logged with the username, the listing and the row count, but never with lead data.
- Mobile numbers are written as text, so Excel keeps the
- Permissions:
- New menu module
BO_LEADS(/leads) to view the Lead Listing and lead detail. - New modules
BO_LEADS_EDIT(edit a lead) andBO_LEADS_EXPORT(export either listing). They have no url, so they never show in the sidebar. - An export also needs the listing's own module:
BO_LEADSfor the Lead Listing,BO_EVENT_LEADSfor the Event Leads Listing.
- New menu module
- Link from the event lead edit page to the lead detail page, for users who hold
BO_LEADS. - New dependency
org.apache.poi:poi-ooxml4.1.0 inmobile-api. It is the same library and version thatservices-systemalready uses for its spreadsheet exports. - New index
event_lead (company_id, lead_uuid)for the per-lead aggregation and the event history.
Not in this change: reports beyond the on-screen listings, merging leads, and per-salesperson visibility.
Capabilities
New Capabilities
lead-records: the company-wide Lead Listing, the lead detail page with event history and shared-contact warnings, and lead edits.lead-export: xlsx exports of the Lead Listing and the Event Leads Listing, and the export permission.
Modified Capabilities
None. The Event Leads Listing (event-lead-capture) keeps its requirements; the export of it is specified in lead-export.
Impact
solvway-services-counter:- a lead search (a native query with window functions for the latest capture and the latest salesperson);
- lead detail with history and shared contacts;
- lead update.
solvway-mobile-api:AdminLeadControllerand its service;- xlsx export endpoints for both listings;
- the poi-ooxml dependency.
solvway-admin-portal:app/leads/**pages (the listing, and a phone-friendly detail page);- an Export button on both listings, shown only with
BO_LEADS_EXPORT; - a binary-safe download route;
- services, types and i18n;
- a
routeModulesentry; - a "View lead" link on the event lead edit page.
- Database: one new index on
service-counter.event_lead, and threeservice-system.modulerows. Additive only. local/seed/03-colite.sqlmirrors the index and the module rows.solvway-services-system: the ACL menu keeps url-lessMmodules that have a parent, soBO_LEADS_EDITandBO_LEADS_EXPORTreach the portal.- No change to the gateway, existing tables or existing endpoints.