fix(admin-ui): Edit prices requires at least one product (#5710)

This commit is contained in:
Kasper Fabricius Kristensen
2023-11-24 13:54:07 +00:00
committed by GitHub
parent f4c489fb85
commit 07934cdaac
5 changed files with 32 additions and 30 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
fix(admin-ui): Ensure that the prices step is disabled until at least one product is selected in PriceList forms
@@ -571,7 +571,7 @@ const AddProductsModal = ({
</span>
</ProgressTabs.Trigger>
<ProgressTabs.Trigger
disabled={selectedIds.length === 0}
disabled={status[Tab.PRODUCTS] !== "completed"}
value={Tab.PRICES}
className="w-full max-w-[200px]"
status={status[Tab.PRICES]}
@@ -97,19 +97,17 @@ const PriceListPricesForm = ({
<Heading>
{t("price-list-prices-form-heading", "Edit prices")}
</Heading>
{isDirty && (
<Form.Field
control={control}
name={path("products")}
render={() => {
return (
<Form.Item>
<Form.ErrorMessage />
</Form.Item>
)
}}
/>
)}
<Form.Field
control={control}
name={path("products")}
render={() => {
return (
<Form.Item>
<Form.ErrorMessage />
</Form.Item>
)
}}
/>
</div>
<div className="flex items-center gap-x-2">
<ProductFilterMenu
@@ -129,7 +127,7 @@ const PriceListPricesForm = ({
<div className="border-ui-border-base border-b">
<table className="w-full text-left">
<thead>
<tr className="[&_th]:text-ui-fg-subtle [&_th]:txt-compact-small-plus border-ui-border-base [&_th]:w-1/3 [&_th]:border-r [&_th]:px-4 [&_th]:py-2.5 [&_th:last-of-type]:border-r-0">
<tr className="[&_th]:text-ui-fg-subtle [&_th]:txt-compact-small-plus border-ui-border-base [&_th:last-of-type]:border-r-0 [&_th]:w-1/3 [&_th]:border-r [&_th]:px-4 [&_th]:py-2.5">
<th>{t("price-list-prices-form-variant", "Variant")}</th>
<th>{t("price-list-prices-form-sku", "SKU")}</th>
<th className="text-right">
@@ -376,24 +376,23 @@ const PriceListProductsForm = ({
return (
<div className="flex h-full flex-col">
<div className="border-ui-border-base flex items-center justify-between border-b px-8 pt-6 pb-4">
<div className="border-ui-border-base flex items-center justify-between border-b px-8 pb-4 pt-6">
<div className="flex items-center gap-x-3">
<Heading>
{t("price-list-products-form-heading", "Choose products")}
</Heading>
{isDirty && (
<Form.Field
control={control}
name={path("ids")}
render={() => {
return (
<Form.Item>
<Form.ErrorMessage />
</Form.Item>
)
}}
/>
)}
<Form.Field
control={control}
name={path("ids")}
render={() => {
return (
<Form.Item>
<Form.ErrorMessage />
</Form.Item>
)
}}
/>
</div>
<div className={clx("flex items-center gap-x-2")}>
<ProductFilterMenu
@@ -631,7 +631,7 @@ const PriceListNew = () => {
<ProgressTabs.Trigger
value={Tab.PRICES}
disabled={
status[Tab.DETAILS] !== "completed" &&
status[Tab.DETAILS] !== "completed" ||
status[Tab.PRODUCTS] !== "completed"
}
className="w-full min-w-0 max-w-[200px]"