fix(dashboard): show fulfilment option on SO edit (#13269)
* fix(dashboard): show fulfilment option on SO edit * fix: validation
This commit is contained in:
1 parent
25ed42f740
commit
2d62e28913
2 files changed
+38
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(dashboard): show fulfilment option on SO edit
|
||||||
+33
@@ -19,6 +19,7 @@ import {
|
|||||||
FulfillmentSetType,
|
FulfillmentSetType,
|
||||||
ShippingOptionPriceType,
|
ShippingOptionPriceType,
|
||||||
} from "../../../common/constants"
|
} from "../../../common/constants"
|
||||||
|
import { formatProvider } from "../../../../../lib/format-provider"
|
||||||
|
|
||||||
type EditShippingOptionFormProps = {
|
type EditShippingOptionFormProps = {
|
||||||
locationId: string
|
locationId: string
|
||||||
@@ -32,6 +33,7 @@ const EditShippingOptionSchema = zod.object({
|
|||||||
enabled_in_store: zod.boolean().optional(),
|
enabled_in_store: zod.boolean().optional(),
|
||||||
shipping_profile_id: zod.string(),
|
shipping_profile_id: zod.string(),
|
||||||
shipping_option_type_id: zod.string(),
|
shipping_option_type_id: zod.string(),
|
||||||
|
provider_id: zod.string().optional(), // just for UI purposes
|
||||||
})
|
})
|
||||||
|
|
||||||
export const EditShippingOptionForm = ({
|
export const EditShippingOptionForm = ({
|
||||||
@@ -72,6 +74,7 @@ export const EditShippingOptionForm = ({
|
|||||||
enabled_in_store: isOptionEnabledInStore(shippingOption),
|
enabled_in_store: isOptionEnabledInStore(shippingOption),
|
||||||
shipping_profile_id: shippingOption.shipping_profile_id,
|
shipping_profile_id: shippingOption.shipping_profile_id,
|
||||||
shipping_option_type_id: shippingOption.type.id,
|
shipping_option_type_id: shippingOption.type.id,
|
||||||
|
provider_id: shippingOption.provider_id,
|
||||||
},
|
},
|
||||||
resolver: zodResolver(EditShippingOptionSchema),
|
resolver: zodResolver(EditShippingOptionSchema),
|
||||||
})
|
})
|
||||||
@@ -242,6 +245,36 @@ export const EditShippingOptionForm = ({
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Form.Field
|
||||||
|
control={form.control}
|
||||||
|
name="provider_id"
|
||||||
|
disabled={true}
|
||||||
|
render={({ field }) => {
|
||||||
|
return (
|
||||||
|
<Form.Item>
|
||||||
|
<Form.Label>
|
||||||
|
{t("stockLocations.shippingOptions.fields.provider")}
|
||||||
|
</Form.Label>
|
||||||
|
<Form.Control>
|
||||||
|
<Combobox
|
||||||
|
value={shippingOption.provider_id}
|
||||||
|
disabled={true}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
label: `${formatProvider(
|
||||||
|
shippingOption.provider_id
|
||||||
|
)} (${shippingOption?.data?.id || "N/A"})`, // FO is stored in so.data and only guaranteed proeprty is `id`
|
||||||
|
value: shippingOption.provider_id,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Form.Control>
|
||||||
|
<Form.ErrorMessage />
|
||||||
|
</Form.Item>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|||||||
Reference in new issue
Block a user