Warehouse Master — Add/Edit Form

What the admin sees
pages/WarehouseFormPage.tsx, built on the shared MasterFormPage shell. Fields are grouped into three sections:
- Basic Info — Warehouse Code, Description (both required).
- Address — Address Line 1 (required), Address Line 2 (optional), City, Place, Land Mark (all required), State (an
IndiaStateAutocompletedropdown constrained to India’s states/UTs), Country (disabled, hardcoded"India"— the platform is India-only today), Zip Code (required, format-checked). - Contact — Contact Person, Contact Number 1 (both required, phone format-checked), Contact Number 2 (optional, format-checked only if filled in).
An error Alert appears above the footer if validation fails. The primary button’s label changes with context: “Create Draft” on a new warehouse, “Publish” when editing a DRAFT warehouse, “Save Changes” once it’s PUBLISHED/ARCHIVED. A secondary “Save Draft” button appears only while editing a DRAFT warehouse, and saves without publishing.
What the admin does here
Submitting validates, in order: all required fields non-empty, then format checks — a 6-digit Indian pincode (leading digit 1–9) and a 10-digit Indian phone number (leading digit 6–9, optional +91/91 prefix) for both contact numbers. The same full validation runs whether saving a draft or publishing — there’s no lighter draft-only tier.
- Create calls
POST /inventory/admin/api/v1/warehouses, always inserted asDRAFT. - Update (editing) calls
PUT /inventory/admin/api/v1/warehouses/:idwith the same field set. - Publish (primary button, while
DRAFT) follows the PUT with a separatePOST /inventory/admin/api/v1/warehouses/:id/publishcall. - Archive / Republish / Delete are offered as lifecycle actions (confirm dialog) depending on current status — Archive while
PUBLISHED, Republish whileARCHIVED, Delete only while stillDRAFT.
Edit-mode pre-fill does a fresh GET /inventory/admin/api/v1/warehouses/:id rather than reusing the list row’s data, since the list response never carries address/contact fields.
Address and Contact fields are not stored in inventory-service’s own database row — they round-trip through pii-service via gRPC (UpsertAttributes/GetAttributes), keyed by the warehouse’s ID, the same pattern used for any other PII-shaped attribute store in this platform.
Related Documents
- SR-022 FR-02 – FR-12 — field rules, lifecycle, PII-service address split
- ADR-00037 — Draft/Published/Archived Lifecycle for Admin Master Data
- Architecture — Warehouse Master Administration Console
- Technical Debt — Warehouse Master Gaps — client-only validation, no
is_mainUI surface - Microservices: inventory-service
- Previous: Warehouse List — Status Filter & Search