4.4 KiB
4.4 KiB
Task F - Approval Production
Summary
Task F delivered the first production-ready approval workflow on top of the CRM foundation, starting with quotation approval and keeping the service layer generic enough for future enquiry, PR, PO, and document flows.
Delivered Scope
- Added approval persistence tables in src/db/schema.ts.
- Seeded the
quotation_standard_approvalworkflow with sequentialsales_manager -> department_manager -> top_managersteps in src/db/seeds/foundation.seed.ts. - Added generic approval feature APIs in:
- Added production routes:
- Added production approvals UI:
- list page src/app/dashboard/crm/approvals/page.tsx
- detail page src/app/dashboard/crm/approvals/[id]/page.tsx
- reusable approval panels in src/features/foundation/approval/components/
- Replaced the quotation approval placeholder with a real approval tab in src/features/crm/quotations/components/quotation-detail.tsx and src/features/crm/quotations/components/quotation-approval-tab.tsx.
- Added approval permissions and business roles in src/lib/auth/rbac.ts.
- Updated side navigation and search-param plumbing in:
Behavioral Notes
- Quotation submission validates draft or revised status, active customer linkage, and at least one quotation item before opening an approval request.
- Final approval promotes quotation status to
approved. - Reject moves quotation status to
rejected. - Return or cancel sends quotation back to
draft. - Approval actions are audited under
crm_approval_requestandcrm_approval_action.
Follow-up
- Run schema generation and migration creation after reviewing the new tables.
- Seed or sync membership permission arrays if non-admin approvers need the new approval permissions immediately in existing environments.