diff --git a/web/src/pages/CreateLocationPage.tsx b/web/src/pages/CreateLocationPage.tsx index e6a4748..ad1f7e5 100644 --- a/web/src/pages/CreateLocationPage.tsx +++ b/web/src/pages/CreateLocationPage.tsx @@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom' import { inventory } from '@/api/client' import { PageHeader } from '@/components/PageHeader' import { ErrorBox } from '@/components/ErrorBox' +import { DynamicExtFields } from '@/components/DynamicExtFields' const LOCATION_TYPES = ['WAREHOUSE', 'BIN', 'VIRTUAL'] as const @@ -11,6 +12,7 @@ export function CreateLocationPage() { const [code, setCode] = useState('') const [name, setName] = useState('') const [type, setType] = useState('WAREHOUSE') + const [ext, setExt] = useState>({}) const [submitting, setSubmitting] = useState(false) const [error, setError] = useState(null) @@ -19,7 +21,8 @@ export function CreateLocationPage() { setError(null) setSubmitting(true) try { - await inventory.createLocation({ code, name, type }) + const extPayload = Object.keys(ext).length > 0 ? ext : undefined + await inventory.createLocation({ code, name, type, ...(extPayload ? { ext: extPayload } : {}) }) navigate('/locations') } catch (err: unknown) { setError(err instanceof Error ? err : new Error(String(err))) @@ -53,6 +56,11 @@ export function CreateLocationPage() { {LOCATION_TYPES.map((t) => )} + setExt((prev) => ({ ...prev, [k]: v }))} + /> {error && }