feat(billing): migrate New Invoice form to FormGuard (PMS-518) #354
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-518-migrate-billing-form"
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?
What
PMS-518 increment: migrates the billing New Invoice form (
handle_create) onto the sharedFormGuard.Why
The handler validated field-by-field with first-failure-
returns, so a missing Company hid a missing date, which hid a missing description, etc. (the same masking class as PMS-514). Now every required field is validated throughguard.field(...)into its own inline slot, all failures surface at once, and the first invalid field is focused.Changes
CompanyPickerhas no inline slot) and blocks vianote_invalid.invoice_date_error/due_date_error/line_description_error) instead of sharing the form-level banner.[Rule::Required, Rule::Number{min:0}]- the canonical "must not be negative." / "must be a number." messages replace the bespoke ones; the value is still sent as a string for the server to parse.due_date_error+note_invalid.Behaviour
Verification
just checkparity via the rust-builder image:clippy --all-targets -- -D warnings,fmt --check,cargo check --target wasm32-unknown-unknown- all green.Scope: the New Invoice create form. The billing modals (Record Payment, Edit Invoice, Tax Rate, Gateway) are further increments. Part of PMS-518.
Moves the New Invoice handler (handle_create) onto the shared FormGuard. It previously validated field-by-field with first-failure-returns, so a missing Company hid a missing date, which hid a missing description, etc. Now every required field is validated through guard.field(...) into its own inline error slot, all failures surface at once, and the first invalid field is focused. - Company keeps its specific banner message (the CompanyPicker has no inline slot) and blocks via note_invalid. - Invoice Date / Due Date / Line Description get per-field inline slots (invoice_date_error / due_date_error / line_description_error) instead of sharing the form-level banner. - Quantity / Unit Price use [Rule::Required, Rule::Number{min:0}] - the canonical "must not be negative." / "must be a number." messages replace the bespoke ones; the value is still sent as a string for the server to parse. - The cross-field "due date on or after invoice date" check is preserved, runs only when both dates are present, and routes to due_date_error + note_invalid. just check parity (rust-builder image): clippy --all-targets -D warnings, fmt --check, cargo check --target wasm32-unknown-unknown all green. #PMS-518Follows the New Invoice migration on this branch; brings the rest of billing onto the shared guard so every modal reports its failures together with focus-first. - Record Payment modal: Company (banner + note_invalid), Payment Date (new per-field slot, Rule::Required); Amount and Invoice keep their bespoke Decimal/UUID parses (reused in the body) and add focus-first via note_invalid. Replaces the ok-flag with guard.blocked(). - Edit Invoice modal: Invoice/Due dates get per-field slots; per-line Description (Rule::Required) and Quantity/Unit Price ([Rule::Required, Rule::Number{min:0}]) get per-line err fields on EditableLine; empty-line-set rule routes to the banner + note_invalid. - Tax Rate modal: Name (Rule::Required) + Rate ([Rule::Required, Rule::Number{min:0}]) get per-field slots, replacing the presence-only banner returns. - Gateway modal: Config JSON keeps its serde_json parse (reused in the body) and routes its message to a new inline slot + focus-first. Values sent to the server are unchanged. just check parity (rust-builder image): clippy --all-targets -D warnings, fmt --check, cargo check --target wasm32-unknown-unknown all green. #PMS-518