refactor(forms): report-all errors on contacts + asset-edit forms (PMS-518) #357

Merged
nrupard merged 1 commit from feat/PMS-518-report-all-polish into main 2026-06-25 21:48:19 +02:00
Owner

What

Follow-up polish on the PMS-518 migration (the bulk #356 and billing #354 are now merged). Converts the forms that were left short-circuiting to the report-all pattern, so every invalid field surfaces at once (each in its own inline slot) with the first invalid field focused - matching the rest of the migrated forms.

Changes

  • contacts.rs - CompanyForm / ContactForm / SiteFormModal: were returning on the first failed field (focus-first had been added, but only one error showed at a time). Now validate every field, set each field's inline error, note_invalid in field order, single if guard.blocked() { return; }, then unwrap the carried validator results. The Contact company-XOR error and the Site name error stay on the form-level banner (no inline slot); everything else is per-field. Bespoke validators kept (they parse-and-return the typed values the bodies use).
  • assets.rs - Edit Asset modal: added per-field inline slots for Name / Serial / Manufacturer / Model (matching the New Asset form), accumulate all four validations, bail + focus once.

Behaviour

No change beyond surfacing all errors together; values sent to the server are unchanged.

Verification

just check parity via the rust-builder image: clippy --all-targets -- -D warnings, fmt --check, cargo check --target wasm32-unknown-unknown - all green.

## What Follow-up polish on the PMS-518 migration (the bulk #356 and billing #354 are now merged). Converts the forms that were left **short-circuiting** to the report-all pattern, so every invalid field surfaces at once (each in its own inline slot) with the first invalid field focused - matching the rest of the migrated forms. ## Changes - **contacts.rs** - CompanyForm / ContactForm / SiteFormModal: were returning on the first failed field (focus-first had been added, but only one error showed at a time). Now validate every field, set each field's inline error, `note_invalid` in field order, single `if guard.blocked() { return; }`, then unwrap the carried validator results. The Contact company-XOR error and the Site name error stay on the form-level banner (no inline slot); everything else is per-field. Bespoke validators kept (they parse-and-return the typed values the bodies use). - **assets.rs** - Edit Asset modal: added per-field inline slots for Name / Serial / Manufacturer / Model (matching the New Asset form), accumulate all four validations, bail + focus once. ## Behaviour No change beyond surfacing all errors together; values sent to the server are unchanged. ## Verification `just check` parity via the rust-builder image: `clippy --all-targets -- -D warnings`, `fmt --check`, `cargo check --target wasm32-unknown-unknown` - all green.
refactor(forms): make contacts + asset-edit forms report all errors at once (PMS-518)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 18m10s
Create release / Create release from merged PR (pull_request) Has been skipped
402d0ffbbc
Follow-up polish on this branch: the contacts forms (Company / Contact / Site) and the Edit Asset modal were left short-circuiting (return on the first failed field) when they were first migrated - focus-first was added but only one error showed at a time. Convert them to the accumulate-then-bail pattern so every invalid field surfaces together, each in its own inline slot, with the first invalid field focused.

- contacts CompanyForm / ContactForm / SiteFormModal: validate every field, set each field's inline err (Contact's company XOR + Site's name stay on the banner since they have no inline slot), guard.note_invalid in field order, single `if guard.blocked() { return; }`, then unwrap the carried validator results. Bespoke validators kept (they parse-and-return the typed values the body uses).
- assets Edit Asset modal: add per-field inline slots for Name / Serial / Manufacturer / Model (matching the New Asset form), accumulate all four validations, bail+focus once.

No behavior change beyond surfacing all errors together; 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
nrupard deleted branch feat/PMS-518-report-all-polish 2026-06-25 21:48:19 +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!357
No description provided.