task-d.6.1

This commit is contained in:
phaichayon
2026-07-01 10:29:00 +07:00
parent 6d6cd3a6df
commit 0a144f0f9e
14 changed files with 364 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
{
"generatedAt": "2026-06-30T23:54:26.582Z",
"generatedAt": "2026-07-01T02:01:55.746Z",
"overallStatus": "PASS",
"quotationCode": "CRA2606-1107",
"expectedFixtureCode": "QT-H5-AUDIT",

View File

@@ -1,6 +1,6 @@
# PDF Audit Report
- Generated At: 2026-06-30T23:54:26.582Z
- Generated At: 2026-07-01T02:01:55.746Z
- Overall Status: PASS
- Quotation Code: CRA2606-1107
- Template: ALLA Demo Quotation Standard v1.0

View File

@@ -0,0 +1,42 @@
# 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 Source` field backed by master options.
## Review Summary
Reviewed before implementation:
- [AGENTS.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/AGENTS.md)
- [plans/task-d.6.1.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/plans/task-d.6.1.md)
- [docs/standards/project-foundations.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/standards/project-foundations.md)
- [docs/standards/architecture-rules.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/standards/architecture-rules.md)
- [docs/standards/ui-ux-rules.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/standards/ui-ux-rules.md)
- [docs/standards/task-review-checklist.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/standards/task-review-checklist.md)
- [docs/business/crm-terminology.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/business/crm-terminology.md)
- [docs/adr/0018-lead-enquiry-domain-separation.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/adr/0018-lead-enquiry-domain-separation.md)
- [task-d.6-crm-activity-foundation-audit-log-separation-2026-07-01.md](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/docs/implementation/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_channel` to [schema.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/db/schema.ts) and created [0001_lead_channel_and_status_default.sql](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/drizzle/0001_lead_channel_and_status_default.sql).
- Removed the old raw DB default for `crm_leads.status` and moved create-time default resolution into the lead service so new leads resolve `new_job` through master options.
- Extended lead contracts in [types.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/types.ts) to carry `leadChannel`, `leadChannelLabel`, and `leadChannels`.
- Extended [lead.schema.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/schemas/lead.schema.ts) with `leadChannel` and added a dedicated `leadFormSchema` for TanStack Form submit validation.
- Updated [service.ts](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/server/service.ts) to validate `crm_lead_channel`, return `leadChannels` reference data, map `leadChannelLabel`, and enforce create defaults for status, outcome, lost reason, and marketing owner.
- Rebuilt [lead-form.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-form.tsx) so create mode hides `Status`, `Lost Reason`, and `Marketing Owner`, while edit mode still exposes the operational fields.
- Updated [lead-detail.tsx](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/leads/components/lead-detail.tsx) to display `Lead Source`.
## Verification
- `npm run typecheck` -> PASS
- `npm run build` -> PASS
- `npm 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.