Add warehouse info
This commit is contained in:
parent
1b3e304c79
commit
596cc41a7f
3 changed files with 67 additions and 22 deletions
|
@ -9,6 +9,7 @@ import TableRow from "@material-ui/core/TableRow";
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
import CardMenu from "@saleor/components/CardMenu";
|
import CardMenu from "@saleor/components/CardMenu";
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
|
@ -46,7 +47,15 @@ const useStyles = makeStyles(
|
||||||
textAlign: "right",
|
textAlign: "right",
|
||||||
width: 120
|
width: 120
|
||||||
},
|
},
|
||||||
|
infoLabel: {
|
||||||
|
display: "inline-block"
|
||||||
|
},
|
||||||
|
infoLabelWithMargin: {
|
||||||
|
marginBottom: theme.spacing()
|
||||||
|
},
|
||||||
|
infoRow: {
|
||||||
|
padding: theme.spacing(2, 3)
|
||||||
|
},
|
||||||
orderNumber: {
|
orderNumber: {
|
||||||
display: "inline",
|
display: "inline",
|
||||||
marginLeft: theme.spacing(1)
|
marginLeft: theme.spacing(1)
|
||||||
|
@ -68,7 +77,7 @@ interface OrderFulfillmentProps {
|
||||||
onTrackingCodeAdd: () => void;
|
onTrackingCodeAdd: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberOfColumns = 3;
|
const numberOfColumns = 4;
|
||||||
|
|
||||||
const OrderFulfillment: React.FC<OrderFulfillmentProps> = props => {
|
const OrderFulfillment: React.FC<OrderFulfillmentProps> = props => {
|
||||||
const {
|
const {
|
||||||
|
@ -216,18 +225,47 @@ const OrderFulfillment: React.FC<OrderFulfillmentProps> = props => {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
{maybe(() => fulfillment.trackingNumber) && (
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={numberOfColumns}>
|
<TableCell className={classes.infoRow} colSpan={numberOfColumns}>
|
||||||
|
<Typography color="textSecondary" variant="body2">
|
||||||
|
<FormattedMessage
|
||||||
|
defaultMessage="Fulfilled from: {warehouseName}"
|
||||||
|
description="fulfillment group"
|
||||||
|
values={{
|
||||||
|
warehouseName: (
|
||||||
|
<Typography
|
||||||
|
className={classNames(classes.infoLabel, {
|
||||||
|
[classes.infoLabelWithMargin]: !!fulfillment?.trackingNumber
|
||||||
|
})}
|
||||||
|
color="textPrimary"
|
||||||
|
variant="body2"
|
||||||
|
>
|
||||||
|
default
|
||||||
|
</Typography>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Typography>
|
||||||
|
<Typography color="textSecondary" variant="body2">
|
||||||
|
{fulfillment?.trackingNumber && (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
defaultMessage="Tracking Number: {trackingNumber}"
|
defaultMessage="Tracking Number: {trackingNumber}"
|
||||||
values={{
|
values={{
|
||||||
trackingNumber: fulfillment.trackingNumber
|
trackingNumber: (
|
||||||
|
<Typography
|
||||||
|
className={classes.infoLabel}
|
||||||
|
color="textPrimary"
|
||||||
|
variant="body2"
|
||||||
|
>
|
||||||
|
{fulfillment.trackingNumber}
|
||||||
|
</Typography>
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)}
|
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</ResponsiveTable>
|
</ResponsiveTable>
|
||||||
{status === FulfillmentStatus.FULFILLED && !fulfillment.trackingNumber && (
|
{status === FulfillmentStatus.FULFILLED && !fulfillment.trackingNumber && (
|
||||||
|
|
|
@ -905,7 +905,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
status: FulfillmentStatus.FULFILLED,
|
status: FulfillmentStatus.FULFILLED,
|
||||||
trackingNumber: ""
|
trackingNumber: "01nn12399su12nndfsy"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
id: "T3JkZXI6OQ==",
|
id: "T3JkZXI6OQ==",
|
||||||
|
|
|
@ -73,11 +73,28 @@ export const fragmentOrderLine = gql`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
export const fulfillmentFragment = gql`
|
||||||
|
${fragmentOrderLine}
|
||||||
|
fragment FulfillmentFragment on Fulfillment {
|
||||||
|
id
|
||||||
|
lines {
|
||||||
|
id
|
||||||
|
quantity
|
||||||
|
orderLine {
|
||||||
|
...OrderLineFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fulfillmentOrder
|
||||||
|
status
|
||||||
|
trackingNumber
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const fragmentOrderDetails = gql`
|
export const fragmentOrderDetails = gql`
|
||||||
${fragmentAddress}
|
${fragmentAddress}
|
||||||
${fragmentOrderEvent}
|
${fragmentOrderEvent}
|
||||||
${fragmentOrderLine}
|
${fragmentOrderLine}
|
||||||
|
${fulfillmentFragment}
|
||||||
fragment OrderDetailsFragment on Order {
|
fragment OrderDetailsFragment on Order {
|
||||||
id
|
id
|
||||||
billingAddress {
|
billingAddress {
|
||||||
|
@ -90,17 +107,7 @@ export const fragmentOrderDetails = gql`
|
||||||
...OrderEventFragment
|
...OrderEventFragment
|
||||||
}
|
}
|
||||||
fulfillments {
|
fulfillments {
|
||||||
id
|
...FulfillmentFragment
|
||||||
lines {
|
|
||||||
id
|
|
||||||
quantity
|
|
||||||
orderLine {
|
|
||||||
...OrderLineFragment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fulfillmentOrder
|
|
||||||
status
|
|
||||||
trackingNumber
|
|
||||||
}
|
}
|
||||||
lines {
|
lines {
|
||||||
...OrderLineFragment
|
...OrderLineFragment
|
||||||
|
|
Loading…
Reference in a new issue