feat(billing): payment terms as a settings-managed dropdown (MAPPS-170) #165

Merged
nrupard merged 2 commits from feat/mapps-170-payment-terms into main 2026-06-15 22:20:25 +02:00
Owner

What

MAPPS-170: invoice payment terms are now a settings-managed dropdown instead of a free-text field. Depends on PMS-333 (merged) - the server payment_terms lookup + CRUD and the invoices.payment_term_id FK (with a joined payment_term_name on the response).

Settings editor

  • New Payment Terms card in the Settings hub (Billing & SLA group) -> /settings/payment-terms.
  • List + create/edit/delete (name, default, active, sort order), admin-gated, wired to /payment-terms. A faithful clone of the existing project-type / lookup editors (uses the shared save_lookup/delete_lookup/SettingFormModal).

Invoice form

  • The invoice edit modal's free-text Payment Terms Input is now a Select populated from /payment-terms (active terms, plus the currently-set term even if it was later deactivated, so an existing invoice keeps its value).
  • Saves payment_term_id (the FK) instead of the free-text string; a "No payment term" option clears it.
  • The invoice detail shows the joined payment_term_name.

Notes / scope

  • New invoices still take the server's default term (the create form has no payment-terms field today); change it via edit. Adding a picker to create is a small follow-up if wanted.
  • Verified PMS-333 live: lookup CRUD finance-gated, UpsertPaymentTermRequest = name/is_default/is_active/sort_order, InvoiceResponse carries payment_term_id + payment_term_name, create/update accept payment_term_id.
  • Not compiled locally (no Rust toolchain here). Reviewer pass found no compile/clippy issues. CI gates.

Test plan

  • Settings -> Payment Terms: create/edit/delete terms; set one default; deactivate one.
  • Open an invoice's edit modal: the Payment Terms dropdown lists active terms, preselects the invoice's current term; change it and save; the detail shows the new term name.
  • An invoice whose term was deactivated still shows + keeps that term in the dropdown.
  • "No payment term" clears the FK.
## What MAPPS-170: invoice payment terms are now a settings-managed dropdown instead of a free-text field. Depends on PMS-333 (merged) - the server `payment_terms` lookup + CRUD and the `invoices.payment_term_id` FK (with a joined `payment_term_name` on the response). ### Settings editor - New **Payment Terms** card in the Settings hub (Billing & SLA group) -> `/settings/payment-terms`. - List + create/edit/delete (name, default, active, sort order), admin-gated, wired to `/payment-terms`. A faithful clone of the existing project-type / lookup editors (uses the shared `save_lookup`/`delete_lookup`/`SettingFormModal`). ### Invoice form - The invoice edit modal's free-text **Payment Terms** `Input` is now a `Select` populated from `/payment-terms` (active terms, plus the currently-set term even if it was later deactivated, so an existing invoice keeps its value). - Saves `payment_term_id` (the FK) instead of the free-text string; a "No payment term" option clears it. - The invoice detail shows the joined `payment_term_name`. ## Notes / scope - New invoices still take the server's default term (the create form has no payment-terms field today); change it via edit. Adding a picker to create is a small follow-up if wanted. - Verified PMS-333 live: lookup CRUD finance-gated, `UpsertPaymentTermRequest` = name/is_default/is_active/sort_order, `InvoiceResponse` carries `payment_term_id` + `payment_term_name`, create/update accept `payment_term_id`. - Not compiled locally (no Rust toolchain here). Reviewer pass found no compile/clippy issues. CI gates. ## Test plan - Settings -> Payment Terms: create/edit/delete terms; set one default; deactivate one. - Open an invoice's edit modal: the Payment Terms dropdown lists active terms, preselects the invoice's current term; change it and save; the detail shows the new term name. - An invoice whose term was deactivated still shows + keeps that term in the dropdown. - "No payment term" clears the FK.
feat(billing): payment terms as a settings-managed dropdown
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 53s
98d9de690e
MAPPS-170. Payment terms were a free-text field on the invoice edit form. PMS-333 added a tenant-scoped payment_terms lookup (CRUD) and moved invoices to a payment_term_id FK with a joined payment_term_name on the response.

Client:
- New "Payment Terms" editor in the Settings hub (Billing & SLA group): list + create/edit/delete, admin-gated, wired to /payment-terms via the shared lookup helpers (a clone of the project-type editor minus is_system).
- Invoice edit modal: the free-text Payment Terms input becomes a Select populated from /payment-terms (active terms, plus the currently-set term even if later deactivated). It saves payment_term_id instead of the free-text string, and the invoice detail shows the joined payment_term_name.

New invoices still take the server's default term; pick a different one via edit (the create form has no payment-terms field today).

Not compiled locally (no Rust toolchain in this environment); the Settings editor mirrors the existing lookup editors and the invoice modal mirrors its existing pattern, gated by CI (cargo clippy --all-targets -- -D warnings).

#MAPPS-170

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(billing): drop the no-op "no payment term" clear option
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 58s
Create release / Create release from merged PR (pull_request) Has been skipped
17887730f5
Code-review follow-up. The invoice edit dropdown always offered a "No payment term" option, but the server PUT does payment_term_id = COALESCE($x, payment_term_id), so sending null preserves a term that is already set. Picking "No payment term" on an invoice that has one was a silent no-op. Only show the "No payment term" placeholder when the invoice has no term yet; once set, the dropdown lists only real terms (switch, not blank). A currently-unset invoice still stays unset (COALESCE of null on null).

#MAPPS-170

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard deleted branch feat/mapps-170-payment-terms 2026-06-15 22:20:25 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!165
No description provided.