Merge branch 'master' into fix/network-error
This commit is contained in:
commit
355fe30715
8 changed files with 629 additions and 737 deletions
|
@ -51,6 +51,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
||||||
- Fix minor visual bugs - #521 by @dominik-zeglen
|
- Fix minor visual bugs - #521 by @dominik-zeglen
|
||||||
- Handle session expiration - #520 by @dominik-zeglen
|
- Handle session expiration - #520 by @dominik-zeglen
|
||||||
- Update product stock management to newest design - #515 by @dominik-zeglen
|
- Update product stock management to newest design - #515 by @dominik-zeglen
|
||||||
|
- Handle untracked products - #523 by @dominik-zeglen
|
||||||
- Display correct error if there were no graphql errors - #525 by @dominik-zeglen
|
- Display correct error if there were no graphql errors - #525 by @dominik-zeglen
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
|
|
|
@ -2768,10 +2768,6 @@
|
||||||
"context": "order total price",
|
"context": "order total price",
|
||||||
"string": "Total"
|
"string": "Total"
|
||||||
},
|
},
|
||||||
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_1542417144": {
|
|
||||||
"context": "dialog header",
|
|
||||||
"string": "Create Product"
|
|
||||||
},
|
|
||||||
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2272209368": {
|
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2272209368": {
|
||||||
"context": "variant sku",
|
"context": "variant sku",
|
||||||
"string": "SKU {sku}"
|
"string": "SKU {sku}"
|
||||||
|
@ -2779,6 +2775,10 @@
|
||||||
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2336947364": {
|
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2336947364": {
|
||||||
"string": "Search by product name, attribute, product type etc..."
|
"string": "Search by product name, attribute, product type etc..."
|
||||||
},
|
},
|
||||||
|
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2775402904": {
|
||||||
|
"context": "dialog header",
|
||||||
|
"string": "Add Product"
|
||||||
|
},
|
||||||
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2850255786": {
|
"src_dot_orders_dot_components_dot_OrderProductAddDialog_dot_2850255786": {
|
||||||
"string": "Search Products"
|
"string": "Search Products"
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,80 +35,86 @@ import { renderCollection } from "@saleor/misc";
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
import AppHeader from "@saleor/components/AppHeader";
|
import AppHeader from "@saleor/components/AppHeader";
|
||||||
import { FulfillOrder_orderFulfill_errors } from "@saleor/orders/types/FulfillOrder";
|
import { FulfillOrder_orderFulfill_errors } from "@saleor/orders/types/FulfillOrder";
|
||||||
|
import { CSSProperties } from "@material-ui/styles";
|
||||||
|
|
||||||
type ClassKey =
|
type ClassKey =
|
||||||
| "actionBar"
|
| "actionBar"
|
||||||
| "table"
|
| "table"
|
||||||
| "colName"
|
| "colName"
|
||||||
| "colQuantity"
|
| "colQuantity"
|
||||||
| "colQuantityContent"
|
|
||||||
| "colQuantityHeader"
|
| "colQuantityHeader"
|
||||||
| "colQuantityTotal"
|
| "colQuantityTotal"
|
||||||
| "colSku"
|
| "colSku"
|
||||||
| "error"
|
| "error"
|
||||||
| "full"
|
| "full"
|
||||||
| "quantityInnerInput"
|
| "quantityInnerInput"
|
||||||
| "quantityInput"
|
| "quantityInnerInputNoRemaining"
|
||||||
| "remainingQuantity";
|
| "remainingQuantity";
|
||||||
const useStyles = makeStyles<Theme, OrderFulfillPageProps, ClassKey>(
|
const useStyles = makeStyles<Theme, OrderFulfillPageProps, ClassKey>(
|
||||||
theme => ({
|
theme => {
|
||||||
[theme.breakpoints.up("lg")]: {
|
const inputPadding: CSSProperties = {
|
||||||
|
paddingBottom: theme.spacing(2),
|
||||||
|
paddingTop: theme.spacing(2)
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
[theme.breakpoints.up("lg")]: {
|
||||||
|
colName: {
|
||||||
|
width: ({ warehouses }) => (warehouses?.length > 3 ? 250 : "auto")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[theme.breakpoints.only("md")]: {
|
||||||
|
colName: {
|
||||||
|
width: ({ warehouses }) => (warehouses?.length > 2 ? 250 : "auto")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actionBar: {
|
||||||
|
flexDirection: "row",
|
||||||
|
paddingLeft: theme.spacing(2) + 2
|
||||||
|
},
|
||||||
colName: {
|
colName: {
|
||||||
width: ({ warehouses }) => (warehouses?.length > 3 ? 250 : "auto")
|
width: 250
|
||||||
|
},
|
||||||
|
colQuantity: {
|
||||||
|
textAlign: "right",
|
||||||
|
width: 210
|
||||||
|
},
|
||||||
|
colQuantityHeader: {
|
||||||
|
textAlign: "right"
|
||||||
|
},
|
||||||
|
colQuantityTotal: {
|
||||||
|
textAlign: "right",
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
colSku: {
|
||||||
|
textAlign: "right",
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
width: 150
|
||||||
|
},
|
||||||
|
error: {
|
||||||
|
color: theme.palette.error.main
|
||||||
|
},
|
||||||
|
full: {
|
||||||
|
fontWeight: 600
|
||||||
|
},
|
||||||
|
quantityInnerInput: {
|
||||||
|
...inputPadding
|
||||||
|
},
|
||||||
|
quantityInnerInputNoRemaining: {
|
||||||
|
paddingRight: 0
|
||||||
|
},
|
||||||
|
remainingQuantity: {
|
||||||
|
...inputPadding,
|
||||||
|
color: theme.palette.text.secondary,
|
||||||
|
whiteSpace: "nowrap"
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
"&&": {
|
||||||
|
tableLayout: "fixed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
[theme.breakpoints.only("md")]: {
|
},
|
||||||
colName: {
|
|
||||||
width: ({ warehouses }) => (warehouses?.length > 2 ? 250 : "auto")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actionBar: {
|
|
||||||
flexDirection: "row",
|
|
||||||
paddingLeft: theme.spacing(2) + 2
|
|
||||||
},
|
|
||||||
colName: {
|
|
||||||
width: 250
|
|
||||||
},
|
|
||||||
colQuantity: {
|
|
||||||
width: 210
|
|
||||||
},
|
|
||||||
colQuantityContent: {
|
|
||||||
alignItems: "center",
|
|
||||||
display: "inline-flex"
|
|
||||||
},
|
|
||||||
colQuantityHeader: {
|
|
||||||
textAlign: "right"
|
|
||||||
},
|
|
||||||
colQuantityTotal: {
|
|
||||||
textAlign: "right",
|
|
||||||
width: 180
|
|
||||||
},
|
|
||||||
colSku: {
|
|
||||||
textAlign: "right",
|
|
||||||
textOverflow: "ellipsis",
|
|
||||||
width: 150
|
|
||||||
},
|
|
||||||
error: {
|
|
||||||
color: theme.palette.error.main
|
|
||||||
},
|
|
||||||
full: {
|
|
||||||
fontWeight: 600
|
|
||||||
},
|
|
||||||
quantityInnerInput: {
|
|
||||||
padding: "16px 0 14px 12px"
|
|
||||||
},
|
|
||||||
quantityInput: {
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
remainingQuantity: {
|
|
||||||
marginLeft: theme.spacing()
|
|
||||||
},
|
|
||||||
table: {
|
|
||||||
"&&": {
|
|
||||||
tableLayout: "fixed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
{ name: "OrderFulfillPage" }
|
{ name: "OrderFulfillPage" }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -343,50 +349,64 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
||||||
className={classes.colQuantity}
|
className={classes.colQuantity}
|
||||||
key={warehouseStock.id}
|
key={warehouseStock.id}
|
||||||
>
|
>
|
||||||
<div className={classes.colQuantityContent}>
|
<TextField
|
||||||
<TextField
|
type="number"
|
||||||
type="number"
|
inputProps={{
|
||||||
inputProps={{
|
className: classNames(
|
||||||
className: classes.quantityInnerInput,
|
classes.quantityInnerInput,
|
||||||
max: warehouseStock.quantity,
|
{
|
||||||
min: 0,
|
[classes.quantityInnerInputNoRemaining]: !line
|
||||||
style: { textAlign: "right" }
|
.variant.trackInventory
|
||||||
}}
|
}
|
||||||
className={classes.quantityInput}
|
),
|
||||||
value={formsetStock.quantity}
|
max:
|
||||||
onChange={event =>
|
line.variant.trackInventory &&
|
||||||
formsetChange(
|
warehouseStock.quantity,
|
||||||
line.id,
|
min: 0,
|
||||||
update(
|
style: { textAlign: "right" }
|
||||||
{
|
}}
|
||||||
quantity: parseInt(
|
fullWidth
|
||||||
event.target.value,
|
value={formsetStock.quantity}
|
||||||
10
|
onChange={event =>
|
||||||
),
|
formsetChange(
|
||||||
warehouse: warehouse.id
|
line.id,
|
||||||
},
|
update(
|
||||||
formsetData[lineIndex].value,
|
{
|
||||||
(a, b) => a.warehouse === b.warehouse
|
quantity: parseInt(
|
||||||
)
|
event.target.value,
|
||||||
|
10
|
||||||
|
),
|
||||||
|
warehouse: warehouse.id
|
||||||
|
},
|
||||||
|
formsetData[lineIndex].value,
|
||||||
|
(a, b) => a.warehouse === b.warehouse
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
error={
|
}
|
||||||
overfulfill ||
|
error={
|
||||||
|
overfulfill ||
|
||||||
|
(line.variant.trackInventory &&
|
||||||
formsetStock.quantity >
|
formsetStock.quantity >
|
||||||
availableQuantity ||
|
availableQuantity) ||
|
||||||
!!errors?.find(
|
!!errors?.find(
|
||||||
err =>
|
err =>
|
||||||
err.warehouse === warehouse.id &&
|
err.warehouse === warehouse.id &&
|
||||||
err.orderLine === line.id &&
|
err.orderLine === line.id &&
|
||||||
err.code ===
|
err.code ===
|
||||||
OrderErrorCode.INSUFFICIENT_STOCK
|
OrderErrorCode.INSUFFICIENT_STOCK
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
InputProps={{
|
||||||
<div className={classes.remainingQuantity}>
|
endAdornment: line.variant
|
||||||
/ {availableQuantity}
|
.trackInventory && (
|
||||||
</div>
|
<div
|
||||||
</div>
|
className={classes.remainingQuantity}
|
||||||
|
>
|
||||||
|
/ {availableQuantity}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -61,7 +61,8 @@ export const orderToFulfill: OrderFulfillData_order = {
|
||||||
quantity: 1220,
|
quantity: 1220,
|
||||||
quantityAllocated: 7
|
quantityAllocated: 7
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
trackInventory: false
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
__typename: "Image",
|
__typename: "Image",
|
||||||
|
@ -114,7 +115,8 @@ export const orderToFulfill: OrderFulfillData_order = {
|
||||||
quantity: 760,
|
quantity: 760,
|
||||||
quantityAllocated: 4
|
quantityAllocated: 4
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
trackInventory: true
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
__typename: "Image",
|
__typename: "Image",
|
||||||
|
@ -160,7 +162,8 @@ export const orderToFulfill: OrderFulfillData_order = {
|
||||||
quantity: 587,
|
quantity: 587,
|
||||||
quantityAllocated: 1
|
quantityAllocated: 1
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
trackInventory: true
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
__typename: "Image",
|
__typename: "Image",
|
||||||
|
|
|
@ -208,7 +208,7 @@ const OrderProductAddDialog: React.FC<OrderProductAddDialogProps> = props => {
|
||||||
>
|
>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
defaultMessage="Create Product"
|
defaultMessage="Add Product"
|
||||||
description="dialog header"
|
description="dialog header"
|
||||||
/>
|
/>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|
|
@ -371,6 +371,7 @@ const orderFulfillData = gql`
|
||||||
quantity
|
quantity
|
||||||
quantityAllocated
|
quantityAllocated
|
||||||
}
|
}
|
||||||
|
trackInventory
|
||||||
}
|
}
|
||||||
thumbnail(size: 64) {
|
thumbnail(size: 64) {
|
||||||
url
|
url
|
||||||
|
|
|
@ -37,6 +37,7 @@ export interface OrderFulfillData_order_lines_variant {
|
||||||
sku: string;
|
sku: string;
|
||||||
attributes: OrderFulfillData_order_lines_variant_attributes[];
|
attributes: OrderFulfillData_order_lines_variant_attributes[];
|
||||||
stocks: (OrderFulfillData_order_lines_variant_stocks | null)[] | null;
|
stocks: (OrderFulfillData_order_lines_variant_stocks | null)[] | null;
|
||||||
|
trackInventory: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderFulfillData_order_lines_thumbnail {
|
export interface OrderFulfillData_order_lines_thumbnail {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue