# Task E.1: Quotation Stabilization Before Approval ## 1. Files Added - `docs/adr/0007-quotation-revision-strategy.md` - `docs/adr/0008-attachment-storage-strategy.md` ## 2. Files Modified - `src/db/seeds/foundation.seed.ts` - `src/features/foundation/master-options/types.ts` - `src/features/crm/quotations/api/types.ts` - `src/features/crm/quotations/server/service.ts` - `src/features/crm/quotations/components/quotation-form-sheet.tsx` - `src/features/crm/quotations/components/quotation-detail.tsx` - `src/features/crm/enquiries/server/service.ts` - `docs/implementation/technical-debt.md` ## 3. Options Seeded - `crm_quotation_type` - `crane` - `dockdoor` - `solarcell` - `service` - `other` - `crm_discount_type` - `fixed` - `percentage` - `crm_unit` - `pcs` - `set` - `lot` - `job` - `crm_sent_via` - `email` - `manual` - `system` - `crm_quotation_customer_role` - `owner` - `consultant` - `contractor` - `billing` - `crm_quotation_topic_type` - `scope` - `exclusion` - `payment` ## 4. Revision Rule Confirmed - `draft`: cannot revise - `cancelled`: cannot revise - `accepted`: can revise - `rejected`: can revise - `sent`: can revise - `approved`: can revise Implementation notes: - revision guard now runs in quotation server service before a new revision is created - revision readiness is based on quotation status master-option code, not on UI-only conditions - new revision rows attempt to start with `revised` status when that option exists ## 5. Approval Readiness - quotation status seed now explicitly supports: - `draft` - `pending_approval` - `approved` - `rejected` - `sent` - `accepted` - `lost` - `cancelled` - `revised` - quotation detail now exposes a placeholder `Submit for approval` action for `draft` and `revised` quotations - no approval table or approval workflow was added in Task E.1 ## 6. Remaining Risks - quotation summary still does not support mixed tax rollup from per-line tax strategies - attachments are still metadata-only and not backed by upload/storage plumbing - revision snapshot still excludes follow-ups and attachments - CRM entity relationships still rely on organization-scoped validation instead of database foreign keys - approval workflow is still pending and starts in Task F ## 7. Task F Readiness - quotation forms now read status, quotation type, currency, discount type, unit, sent via, customer role, and topic type from master options instead of hardcoded UI choices where practical - quotation revision eligibility is explicit and server-enforced - approval-ready status vocabulary exists before approval workflow work begins - ADR notes now capture the revision and attachment strategies so Task F can build on stable assumptions ## 8. Verification - `npx tsc --noEmit`