feat(po): user-defined T&C categories + dynamic PO terms editor (#11 follow-up) #107
No reviewers
Labels
No labels
bug
claude-failed
claude-pr
claude-queue
claude-working
epic
feature
interactive
portal
triaged
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: shad0w/pelagia-portal#107
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/terms-dynamic-editor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to the merged #11 PR (#106), which shipped the enum-based T&C catalogue. This makes categories user-defined and the PO T&C a dynamic editor, per the review asks:
TermsCategoryis now a TABLE, not an enum. In the admin Add/Edit clause form the category is a combobox; typing a new name creates the category.isDefaultclauses pre-fill new POs.components/po/po-terms-editor.tsxis a dynamic list ("+ Add term" → category combobox + clause combobox, pick or type). Used by new / edit / manager-edit. New POs pre-fill fromgetDefaultPoTerms; editing loadspo.terms, or maps legacytc*+ fixed lines for pre-feature POs.Migration strategy (important)
The original
20260624140000_terms_conditionsmigration is already released on master, so it is left untouched. This PR adds a forward migration20260624150000_terms_categories_tablethat:TermsCategoryenum out of the way and creates theTermsCategorytable (+ seeds the 7 categories);categoryId/isDefault/sortOrdertoTermsConditionand migrates the existing enum clauses onto category rows (DELIVERY → Delivery, …), marking the seeded standards as defaults;PurchaseOrder.terms(JSON snapshot that supersedestc*for export/detail; old POs fall back totc*+ fixed lines).Storage stays a point-in-time snapshot, so editing/removing a clause never rewrites historical POs.
Verification
tsc --noEmitclean.🤖 Generated with Claude Code