diff --git a/.changeset/calm-turtles-enjoy.md b/.changeset/calm-turtles-enjoy.md new file mode 100644 index 0000000000..34d640da70 --- /dev/null +++ b/.changeset/calm-turtles-enjoy.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +Feat(admin-ui): add metadata controls for stock locations diff --git a/packages/admin-ui/ui/src/domain/inventory/locations/edit/index.tsx b/packages/admin-ui/ui/src/domain/inventory/locations/edit/index.tsx index 80a8345b99..e74bfab796 100644 --- a/packages/admin-ui/ui/src/domain/inventory/locations/edit/index.tsx +++ b/packages/admin-ui/ui/src/domain/inventory/locations/edit/index.tsx @@ -4,19 +4,26 @@ import { StockLocationAddressInput, StockLocationDTO, } from "@medusajs/medusa" -import { useAdminUpdateStockLocation } from "medusa-react" -import { useForm } from "react-hook-form" +import GeneralForm, { GeneralFormType } from "../components/general-form" +import MetadataForm, { + MetadataFormType, + getMetadataFormValues, + getSubmittableMetadata, +} from "../../../../components/forms/general/metadata-form" + +import AddressForm from "../components/address-form" import Button from "../../../../components/fundamentals/button" import Modal from "../../../../components/molecules/modal" -import useNotification from "../../../../hooks/use-notification" import { getErrorMessage } from "../../../../utils/error-messages" import { nestedForm } from "../../../../utils/nested-form" -import AddressForm from "../components/address-form" -import GeneralForm, { GeneralFormType } from "../components/general-form" +import { useAdminUpdateStockLocation } from "medusa-react" +import { useForm } from "react-hook-form" +import useNotification from "../../../../hooks/use-notification" type EditLocationForm = { general: GeneralFormType address: StockLocationAddressDTO + metadata: MetadataFormType } export type LocationEditModalProps = { @@ -31,6 +38,7 @@ const LocationEditModal = ({ onClose, location }: LocationEditModalProps) => { name: location.name, }, // @ts-ignore address: location.address, + metadata: getMetadataFormValues(location.metadata), }, reValidateMode: "onBlur", mode: "onBlur", @@ -67,6 +75,10 @@ const LocationEditModal = ({ onClose, location }: LocationEditModalProps) => {