86 lines
4.9 KiB
Markdown
86 lines
4.9 KiB
Markdown
# Task D.5.4: Lead / Enquiry Workspace Separation UI Foundation
|
|
|
|
## Objective
|
|
Establish separate CRM workspaces for marketing-owned Leads and sales-owned Enquiries without changing existing quotation, dashboard, reporting, or approval behavior.
|
|
|
|
## Review Completed
|
|
- `AGENTS.md`
|
|
- `plans/task-d.5.4.md`
|
|
- `docs/standards/project-foundations.md`
|
|
- `docs/standards/task-catalog.md`
|
|
- `docs/adr/0018-lead-enquiry-domain-separation.md`
|
|
- `docs/implementation/task-d5-lead-enquiry-domain-separation.md`
|
|
- `docs/implementation/task-d52-lead-domain-service-api-foundation.md`
|
|
- `docs/implementation/task-d53-lead-assignment-create-enquiry-foundation.md`
|
|
- `docs/security/crm-authorization-boundaries.md`
|
|
- `src/config/nav-config.ts`
|
|
- existing enquiry list, detail, form, and assignment UI
|
|
- existing lead route handlers and lead assignment route
|
|
|
|
## What Changed
|
|
- Replaced legacy lead route aliases with real lead pages:
|
|
- [page.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/app/dashboard/crm/leads/page.tsx)
|
|
- [page.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/app/dashboard/crm/leads/[id]/page.tsx)
|
|
- Added lead client API/query/mutation stack:
|
|
- [service.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/api/service.ts)
|
|
- [queries.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/api/queries.ts)
|
|
- [mutations.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/api/mutations.ts)
|
|
- Added lead UI foundation:
|
|
- [lead-list.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-list.tsx)
|
|
- [leads-table.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/leads-table.tsx)
|
|
- [lead-columns.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-columns.tsx)
|
|
- [lead-form.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-form.tsx)
|
|
- [lead-detail.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-detail.tsx)
|
|
- [lead-assignment-dialog.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-assignment-dialog.tsx)
|
|
- [lead-followup-panel.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-followup-panel.tsx)
|
|
- Extended lead domain read models in:
|
|
- [types.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/types.ts)
|
|
- [service.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/server/service.ts)
|
|
- Lead detail now surfaces:
|
|
- linked enquiries
|
|
- assignment result visibility
|
|
- audit-safe activity list
|
|
- customer/contact/assignable-user reference data for forms
|
|
- Enquiry detail compatibility updated in [page.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/app/dashboard/crm/enquiries/[id]/page.tsx):
|
|
- preserves existing enquiry component contract
|
|
- loads linked lead server-side when `leadId` exists
|
|
- shows a read-only `Source Lead` block with open-lead navigation
|
|
- Enquiry read DTO now includes `leadId` in:
|
|
- [types.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/enquiries/api/types.ts)
|
|
- [service.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/enquiries/server/service.ts)
|
|
|
|
## APIs Consumed
|
|
- `GET /api/crm/leads`
|
|
- `POST /api/crm/leads`
|
|
- `GET /api/crm/leads/[id]`
|
|
- `PATCH /api/crm/leads/[id]`
|
|
- `DELETE /api/crm/leads/[id]`
|
|
- `POST /api/crm/leads/[id]/followups`
|
|
- `POST /api/crm/leads/[id]/assign`
|
|
- existing enquiry detail and follow-up APIs remain unchanged
|
|
|
|
## Permission Mapping
|
|
- Lead list/detail visibility uses:
|
|
- `crm.lead.read`
|
|
- Lead create button and create form use:
|
|
- `crm.lead.create`
|
|
- Lead edit actions use:
|
|
- `crm.lead.update`
|
|
- Lead delete action uses:
|
|
- `crm.lead.delete`
|
|
- Lead assignment action uses:
|
|
- `crm.lead.assign`
|
|
- Enquiry detail compatibility block does not widen enquiry permissions; it only renders when the user can already open the enquiry page.
|
|
|
|
## Compatibility Notes
|
|
- CRM nav already exposed separate Leads and Enquiries entries, so D.5.4 kept navigation structure and replaced the lead pages behind it.
|
|
- Lead assignment still goes through the D.5.3 server assignment flow and does not create enquiries client-side.
|
|
- Existing enquiry workflow, quotation conversion flow, dashboard datasets, and reports were not changed.
|
|
|
|
## Known Limitations
|
|
- Lead form intentionally does not introduce a separate persisted `notes` field because D.5.4 is out of scope for schema changes.
|
|
- Lead follow-up entry uses the existing audit-backed foundation and remains compatible with the current D.5.2 persistence approach.
|
|
|
|
## Verification
|
|
- `npm exec tsc --noEmit`
|