Files
alla-allaos-fullstack/docs/implementation/task-d.6.2-opportunity-quotation-prefill-project-timeline-2026-07-01.md
phaichayon ed28ff6b50 task-d.6.2
2026-07-01 13:57:16 +07:00

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 Date and Delivery Date to both opportunity and quotation flows.
  • Enforce backend-supported hot-project auto suggestion with same-session manual override support.

Review Summary

Reviewed before implementation:

Implementation Summary

  • Added shared hot-project decision logic in hot-project.ts so frontend and backend use the same projectCloseDate <= current date + 3 months rule.
  • Extended crm_opportunities and crm_quotations with project_close_date, delivery_date, hot_project_auto_suggested, and hot_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 Date and Delivery 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

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.
  • npm run audit:pdf
    • Regenerated audit artifacts and reports under artifacts/pdf-audit/ and docs/implementation/pdf-audit-report.*.

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.