3.9 KiB
3.9 KiB
Task D.6.1 Implementation Report - 2026-07-01
Scope
- Improve Create Lead UX so the first-step form only shows fields needed to open a new lead.
- Enforce default create rules for lead status and marketing owner.
- Add a persisted
Lead Sourcefield backed by master options.
Review Summary
Reviewed before implementation:
- AGENTS.md
- plans/task-d.6.1.md
- docs/standards/project-foundations.md
- docs/standards/architecture-rules.md
- docs/standards/ui-ux-rules.md
- docs/standards/task-review-checklist.md
- docs/business/crm-terminology.md
- docs/adr/0018-lead-enquiry-domain-separation.md
- task-d.6-crm-activity-foundation-audit-log-separation-2026-07-01.md
- Lead feature foundation under
src/features/crm/leads/** - Master-option foundation under
src/features/foundation/master-options/** - Session helper under
src/lib/auth/session.ts
Changes
- Added
lead_channelto schema.ts and created 0001_lead_channel_and_status_default.sql. - Removed the old raw DB default for
crm_leads.statusand moved create-time default resolution into the lead service so new leads resolvenew_jobthrough master options. - Extended lead contracts in types.ts to carry
leadChannel,leadChannelLabel, andleadChannels. - Extended lead.schema.ts with
leadChanneland added a dedicatedleadFormSchemafor TanStack Form submit validation. - Updated service.ts to validate
crm_lead_channel, returnleadChannelsreference data, mapleadChannelLabel, and enforce create defaults for status, outcome, lost reason, and marketing owner. - Rebuilt lead-form.tsx so create mode hides
Status,Lost Reason, andMarketing Owner, while edit mode still exposes the operational fields. - Updated lead-detail.tsx to display
Lead Source.
Verification
npm run typecheck-> PASSnpm run build-> PASSnpm run audit:pdf-> PASS
Known Follow-up
- Build still emits pre-existing Turbopack warnings about workspace root lockfiles and broad storage/template trace patterns.
- I did not add Lead Source to lead table filters or listing columns in this phase because the task focused on create UX and default rules.
Outcome
Task D.6.1 now gives Create Lead a cleaner first-step UX, persists Lead Source through the lead domain, and enforces the intended default business rules from the server boundary instead of relying on client behavior alone.