feat(contacts): inline company name validation + duplicate-name feedback (MAPPS-246) #273

Merged
vas2000-work merged 1 commit from feat/MAPPS-246-company-name-inline-validation into main 2026-06-18 03:11:50 +02:00
Owner

Adds inline client-side validation for the company create/edit form's Company Name field, mirroring the server's validate_company_name rule (trim, reject empty/whitespace-only, reject control characters) via a new validate_name_field run first in the submit handler so the user sees "Company name is required." inline before any request rather than bouncing off an opaque server 422. Also routes a duplicate-name 409 from the create/edit endpoint onto the Company Name field using the server's conflict message (branching on ApiError::status_code(), with a message-text fallback), keeping it robust if the backend 409 is not yet deployed and leaving the existing website/phone/postal/country validation and the success/other-error paths unchanged. Extends the established per-field validator + *_err signal pattern; covered by a new unit test.

#MAPPS-246

Adds inline client-side validation for the company create/edit form's Company Name field, mirroring the server's `validate_company_name` rule (trim, reject empty/whitespace-only, reject control characters) via a new `validate_name_field` run first in the submit handler so the user sees "Company name is required." inline before any request rather than bouncing off an opaque server 422. Also routes a duplicate-name 409 from the create/edit endpoint onto the Company Name field using the server's conflict message (branching on `ApiError::status_code()`, with a message-text fallback), keeping it robust if the backend 409 is not yet deployed and leaving the existing website/phone/postal/country validation and the success/other-error paths unchanged. Extends the established per-field validator + `*_err` signal pattern; covered by a new unit test. #MAPPS-246
feat(contacts): inline company name validation + duplicate-name feedback (MAPPS-246)
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m1s
Create release / Create release from merged PR (pull_request) Has been skipped
c3bb13265a
Add validate_name_field mirroring the server's validate_company_name rule (trim, reject empty / whitespace-only with "Company name is required", reject control characters, return the trimmed name) next to the other company-form validators.

Run validate_name_field first in the company submit handler (before website / phone / postal / country) and on Err set name_err and early-return, matching the existing per-field validation structure; feed the validated name into the request body so submission and inline cue agree.

Route a duplicate-name 409 from the create / edit endpoint onto the Company Name field via name_err using the server's conflict message, branching on ApiError::status_code() when present and falling back to conflict message text otherwise, so the cue stays robust even if the backend 409 is not deployed yet and the normal success / other-error paths are untouched.

Add a unit test covering trim, empty / whitespace-only rejection, and control-character rejection for validate_name_field.

#MAPPS-246

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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!273
No description provided.