feat(po): admin-managed Terms & Conditions catalogue + PO dropdowns (#11) #106
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#106
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/terms-conditions-admin"
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?
Closes #11. (Per your steer: dropped the "work order" distinction — POs only.)
Summary
The PO Terms & Conditions fields are now sourced from an admin-managed clause catalogue, exactly the Place-of-Delivery (#19) pattern.
Admin
TermsConditionmodel —category(TermsCategoryenum) +text+isActive(schema + migration). The migration seeds the priorTC_DEFAULTSwording so the catalogue is usable immediately and the existing defaults stay selectable.manage_terms→ Manager + SuperUser + Admin./admin/terms: searchable table + Add/Edit dialogs + activate/deactivate + delete (mirrors/admin/delivery-locations). Sidebar link under Administration.PO forms
<TermsField>native<select>populated from the active clauses of that category (lib/terms.tsmaps eachtc*field → category;lib/terms-data.tsgroups them). Applied to all three forms (new / edit / manager-edit).TC_FIXED_LINE/TC_FIXED_LINE_2) are unchanged.Design choice — snapshot, not FK
The
tc*columns stay free-text snapshots: the dropdown only changes how a clause is picked, so the export, import, and historical POs are untouched. Editing a PO whose current clause isn't in the active list preserves it as a "(current)" option (no silent loss); deleting a clause is always safe.Heads-up
The five named slots are now dropdowns (no per-PO free-typing), consistent with what you approved for Place of Delivery. If you'd rather they be pick-or-type comboboxes (so a one-off custom clause is still possible on a slot), that's a small follow-up — tell me and I'll switch
<TermsField>to a combobox.Tests
terms.test.ts(6): CRUD + themanage_termsguard + the active-only grouping helper.tsc --noEmitclean.Deploy
Adds migration
20260624140000_terms_conditions(table + enum + seed) →prisma migrate deploy. Applied to the local dev DB already.🤖 Generated with Claude Code