Add no warehouses info in variant creator

This commit is contained in:
Dawid Tarasiuk 2020-09-16 13:55:49 +02:00
parent 7e24e4a14f
commit 9e8f453c99
2 changed files with 196 additions and 178 deletions

View file

@ -302,6 +302,10 @@
"context": "variant stock, header",
"string": "Stock"
},
"productVariantCreatorWarehouseSectionDescription": {
"context": "no warehouses info",
"string": "There are no warehouses set up for your store. You can configure your variants without providing stock quantites."
},
"productVariantCreatorWarehouseSectionHeader": {
"context": "header",
"string": "Warehouses"

View file

@ -123,6 +123,16 @@ const ProductVariantCreatorStock: React.FC<ProductVariantCreatorStockProps> = pr
})}
/>
<CardContent>
{!warehouses.length ? (
<Typography color="textSecondary">
<FormattedMessage
defaultMessage="There are no warehouses set up for your store. You can configure your variants without providing stock quantites."
description="no warehouses info"
id="productVariantCreatorWarehouseSectionDescription"
/>
</Typography>
) : (
<>
{warehouses.length > 1 && (
<>
<Typography className={classes.warehouseHeader} variant="h5">
@ -185,8 +195,9 @@ const ProductVariantCreatorStock: React.FC<ProductVariantCreatorStockProps> = pr
<div key={warehouseId}>
<Typography className={classes.warehouseName}>
{
warehouses.find(warehouse => warehouse.id === warehouseId)
.name
warehouses.find(
warehouse => warehouse.id === warehouseId
).name
}
</Typography>
<TextField
@ -271,7 +282,8 @@ const ProductVariantCreatorStock: React.FC<ProductVariantCreatorStockProps> = pr
})}
value={
data.stock.values.find(
value => value.slug === attributeValue.slug
value =>
value.slug === attributeValue.slug
).value[warehouseIndex]
}
onChange={event =>
@ -309,6 +321,8 @@ const ProductVariantCreatorStock: React.FC<ProductVariantCreatorStockProps> = pr
onChange={() => onApplyToAllChange("skip")}
/>
</RadioGroup>
</>
)}
</CardContent>
</Card>
);