6.3 KiB
6.3 KiB
Task D.6.2 Implementation Report - 2026-07-01
Scope
- Prefill quotation creation from opportunity detail so users do not need to reselect the same opportunity.
- Add
Project Close DateandDelivery Dateto both opportunity and quotation flows. - Enforce backend-supported hot-project auto suggestion with same-session manual override support.
Review Summary
Reviewed before implementation:
- AGENTS.md
- plans/task-d.6.2.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
- docs/implementation/task-d.6-crm-activity-foundation-audit-log-separation-2026-07-01.md
- docs/implementation/task-d.6.1-lead-create-form-ux-default-rules-2026-07-01.md
Implementation Summary
- Added shared hot-project decision logic in hot-project.ts so frontend and backend use the same
projectCloseDate <= current date + 3 monthsrule. - Extended
crm_opportunitiesandcrm_quotationswithproject_close_date,delivery_date,hot_project_auto_suggested, andhot_project_manually_overridden, plus migration 0002_opportunity_quotation_timeline_hot_project.sql. - Updated DTOs, Zod schemas, and server services so create/update flows accept the new date fields, validate
YYYY-MM-DD, auto-suggest hot-project state, and preserve manual override flags. - Updated opportunity form to show calendar-based
Project Close DateandDelivery Date, and to stop re-forcing the hot-project checkbox after the user manually changes it in the same session. - Rebuilt quotation form flow to support:
- opening from opportunity detail with prefilled opportunity/customer/contact/project data
- timeline field carry-forward (
projectCloseDate,deliveryDate) - hot-project auto suggestion with manual override preservation
- touched-field protection so post-open prefills do not overwrite user edits
- Updated opportunity detail to pass quotation prefill context and display new timeline values.
Files Changed
- src/db/schema.ts
- drizzle/0002_opportunity_quotation_timeline_hot_project.sql
- drizzle/meta/_journal.json
- src/features/crm/shared/hot-project.ts
- src/features/crm/opportunities/api/types.ts
- src/features/crm/opportunities/schemas/opportunity.schema.ts
- src/features/crm/opportunities/server/service.ts
- src/features/crm/opportunities/components/opportunity-form-sheet.tsx
- src/features/crm/opportunities/components/opportunity-detail.tsx
- src/app/api/crm/opportunities/route.ts
- src/app/api/crm/opportunities/[id]/route.ts
- src/features/crm/quotations/api/types.ts
- src/features/crm/quotations/schemas/quotation.schema.ts
- src/features/crm/quotations/server/service.ts
- src/features/crm/quotations/components/quotation-form-sheet.tsx
Verification
npm run typecheck✅npm run build✅- Existing warnings remained from Turbopack workspace-root inference and the broad local storage provider path pattern in
src/features/foundation/storage/server/local-provider.ts.
- Existing warnings remained from Turbopack workspace-root inference and the broad local storage provider path pattern in
npm run audit:pdf✅- Regenerated audit artifacts and reports under
artifacts/pdf-audit/anddocs/implementation/pdf-audit-report.*.
- Regenerated audit artifacts and reports under
Outcome
- Opportunity detail now launches quotation creation with selected opportunity context already attached.
- Opportunity and quotation both persist project timeline dates.
- Hot-project suggestion is deterministic, backend-backed, and no longer fights the user after manual override during the same edit session.