Warehouse Master — Add/Edit Form

By Engineering Team•October 9, 2026•3 min read

Warehouse Master add/edit form, showing the Basic Info, Address, and Contact sections

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 IndiaStateAutocomplete dropdown 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 as DRAFT.
  • Update (editing) calls PUT /inventory/admin/api/v1/warehouses/:id with the same field set.
  • Publish (primary button, while DRAFT) follows the PUT with a separate POST /inventory/admin/api/v1/warehouses/:id/publish call.
  • Archive / Republish / Delete are offered as lifecycle actions (confirm dialog) depending on current status — Archive while PUBLISHED, Republish while ARCHIVED, Delete only while still DRAFT.

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.