feat(contacts): standardize company Address (US-only country, state dropdown, inline validation) (PMS-581) #393

Merged
longjacksonle merged 3 commits from feat/PMS-581-company-address-validation into main 2026-06-30 19:51:57 +02:00

PMS-581 (rewritten direction)

Standardizes the company Address block. The product is US-only, so Country is fixed to the US and State becomes a US-state dropdown; the remaining free-text fields get the same inline validation as the rest of the form.

Commits (small, logical)

  1. State/Region -> US-state dropdown: Select of US states/territories (USPS codes; value = code). Leading blank = "no state"; a pre-existing non-code value is preserved as its own option so an edit never drops it.
  2. Country -> US-only Select: offers "United States" (value "US"); a blank country saves as "US"; an existing non-US value is preserved. Removes the free-text 2-letter ISO input and its now-unused validation on this form (the validator stays for the payment form that still uses it).
  3. Street/City inline validation: Street 1, Street 2, City gain bounded-length + no-control-char validation via the shared Input error prop + FormGuard (red outline, focus-first). City capped 100, street lines 255.

Postal Code rule unchanged.

No migration / data safety

No schema change. Legacy non-code State and non-US Country values are preserved as selectable options, so editing an old company never silently rewrites or drops them. (Backfilling those to canonical codes is noted as a follow-up on the ticket.)

Verified

dx build clean (35s), no warnings, fmt clean. Dev app serves this branch.

Test

Companies > New/edit > Address: State is a dropdown of US states; Country shows United States (US-only); leaving City/Street with an over-long or control-char value shows an inline error; a blank country saves as US.

🤖 Generated with Claude Code

## PMS-581 (rewritten direction) Standardizes the company Address block. The product is US-only, so Country is fixed to the US and State becomes a US-state dropdown; the remaining free-text fields get the same inline validation as the rest of the form. ## Commits (small, logical) 1. **State/Region -> US-state dropdown**: Select of US states/territories (USPS codes; value = code). Leading blank = "no state"; a pre-existing non-code value is preserved as its own option so an edit never drops it. 2. **Country -> US-only Select**: offers "United States" (value "US"); a blank country saves as "US"; an existing non-US value is preserved. Removes the free-text 2-letter ISO input and its now-unused validation on this form (the validator stays for the payment form that still uses it). 3. **Street/City inline validation**: Street 1, Street 2, City gain bounded-length + no-control-char validation via the shared Input `error` prop + FormGuard (red outline, focus-first). City capped 100, street lines 255. Postal Code rule unchanged. ## No migration / data safety No schema change. Legacy non-code State and non-US Country values are preserved as selectable options, so editing an old company never silently rewrites or drops them. (Backfilling those to canonical codes is noted as a follow-up on the ticket.) ## Verified dx build clean (35s), no warnings, fmt clean. Dev app serves this branch. ## Test Companies > New/edit > Address: State is a dropdown of US states; Country shows United States (US-only); leaving City/Street with an over-long or control-char value shows an inline error; a blank country saves as US. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Replace the free-text State input on the company form with a Select of US states/territories (USPS codes, value = code). A leading blank means "no state"; a pre-existing non-code value is preserved as its own option so editing a company never silently drops it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the free-text 2-letter ISO Country input with a Select offering "United States" (value "US"); the product is US-only. A blank country is sent as "US" at submit, and any existing non-US value is preserved as a selectable option so legacy data is not dropped. Removes the now-unused country free-text validation and its inline error wiring on this form (the validator stays for the payment form that still uses it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat(contacts): inline validation for Street/City address fields (PMS-581)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 8m27s
Create release / Create release from merged PR (pull_request) Has been skipped
9758e61614
Street line 1, Street line 2, and City were free-text with no validation. Add validate_address_text (bounded length + no control characters; blank allowed) and wire each through the shared Input error prop + FormGuard, so they fail inline with a red outline and join the first-invalid focus order like the rest of the form. City capped at 100, street lines at 255.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
longjacksonle deleted branch feat/PMS-581-company-address-validation 2026-06-30 19:51:58 +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!393
No description provided.