Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add error label to sku

Krzysztof Bialoglowicz5be7b497110b
diff --git a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
index f9a82c40f0..fc4744c74e 100644
--- a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
@@ -160,6 +160,7 @@ export const ProductCreatePage: React.StatelessComponent<
disabled={disabled}
product={undefined}
onChange={change}
+ errors={errors}
/>
<CardSpacer />
</>
diff --git a/saleor/static/dashboard-next/products/components/ProductStock/ProductStock.tsx b/saleor/static/dashboard-next/products/components/ProductStock/ProductStock.tsx
index 7da4553a78..0d572b6e7f 100644
--- a/saleor/static/dashboard-next/products/components/ProductStock/ProductStock.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductStock/ProductStock.tsx
@@ -29,12 +29,13 @@ interface ProductStockProps extends WithStyles<typeof styles> {
stockQuantity: number;
};
disabled: boolean;
+ errors: { [key: string]: string };
product: ProductDetails_product;
onChange: (event: React.ChangeEvent<any>) => void;
}
const ProductStock = withStyles(styles, { name: "ProductStock" })(
- ({ classes, data, disabled, product, onChange }: ProductStockProps) => (
+ ({ classes, data, disabled, product, onChange, errors }: ProductStockProps) => (
<Card>
<CardTitle title={i18n.t("Inventory")} />
<CardContent>
@@ -45,6 +46,8 @@ const ProductStock = withStyles(styles, { name: "ProductStock" })(
label={i18n.t("SKU (Stock Keeping Unit)")}
value={data.sku}
onChange={onChange}
+ error={!!errors.sku}
+ helperText={errors.sku}
/>
<TextField
disabled={disabled}
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 0ff003e2ca..f0ac0c15e0 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -255,6 +255,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
disabled={disabled}
product={product}
onChange={change}
+ errors={errors}
/>
)}
<CardSpacer />