{intl.formatMessage(messages.total)} |
diff --git a/src/orders/components/OrderDraftPage/OrderDraftPage.stories.tsx b/src/orders/components/OrderDraftPage/OrderDraftPage.stories.tsx
index 257ceb79c..ba31f72e2 100644
--- a/src/orders/components/OrderDraftPage/OrderDraftPage.stories.tsx
+++ b/src/orders/components/OrderDraftPage/OrderDraftPage.stories.tsx
@@ -43,6 +43,7 @@ const order = draftOrder(placeholderImage);
const props: Omit = {
...fetchMoreProps,
+ loading: false,
disabled: false,
fetchUsers: () => undefined,
onBillingAddressEdit: undefined,
diff --git a/src/orders/components/OrderDraftPage/OrderDraftPage.tsx b/src/orders/components/OrderDraftPage/OrderDraftPage.tsx
index 497dea73a..01cef04ba 100644
--- a/src/orders/components/OrderDraftPage/OrderDraftPage.tsx
+++ b/src/orders/components/OrderDraftPage/OrderDraftPage.tsx
@@ -53,7 +53,7 @@ export interface OrderDraftPageProps extends FetchMoreProps {
const OrderDraftPage: React.FC = props => {
const {
- disabled,
+ loading,
fetchUsers,
hasMore,
saveButtonBarState,
@@ -120,6 +120,7 @@ const OrderDraftPage: React.FC = props => {
order={order as OrderDetailsFragment}
channelUsabilityData={channelUsabilityData}
errors={errors}
+ loading={loading}
onOrderLineAdd={onOrderLineAdd}
onOrderLineChange={onOrderLineChange}
onOrderLineRemove={onOrderLineRemove}
@@ -152,7 +153,7 @@ const OrderDraftPage: React.FC = props => {
navigate(orderDraftListUrl())}
onSubmit={onDraftFinalize}
labels={{
diff --git a/src/orders/components/OrderFulfilledProductsCard/ExtraInfoLines.tsx b/src/orders/components/OrderFulfilledProductsCard/ExtraInfoLines.tsx
index 87c6bd3f4..662fcdf73 100644
--- a/src/orders/components/OrderFulfilledProductsCard/ExtraInfoLines.tsx
+++ b/src/orders/components/OrderFulfilledProductsCard/ExtraInfoLines.tsx
@@ -1,7 +1,7 @@
-import TableRowLink from "@dashboard/components/TableRowLink";
import { FulfillmentStatus, OrderDetailsFragment } from "@dashboard/graphql";
import { getStringOrPlaceholder } from "@dashboard/misc";
-import { TableCell, Typography } from "@material-ui/core";
+import { Typography } from "@material-ui/core";
+import { Box } from "@saleor/macaw-ui/next";
import clsx from "clsx";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
@@ -9,8 +9,6 @@ import { FormattedMessage, useIntl } from "react-intl";
import { extraInfoMessages } from "./messages";
import useStyles from "./styles";
-const NUMBER_OF_COLUMNS = 5;
-
interface ExtraInfoLinesProps {
fulfillment?: OrderDetailsFragment["fulfillments"][0];
}
@@ -26,48 +24,51 @@ const ExtraInfoLines: React.FC = ({ fulfillment }) => {
const { warehouse, trackingNumber, status } = fulfillment;
return (
-
-
-
- {warehouse && (
- <>
- {intl.formatMessage(
- status === FulfillmentStatus.RETURNED
- ? extraInfoMessages.restocked
- : extraInfoMessages.fulfilled,
- )}
-
- {getStringOrPlaceholder(warehouse?.name)}
-
- >
- )}
-
-
- {trackingNumber && (
-
- {trackingNumber}
-
- ),
- }}
- />
- )}
-
-
-
+
+
+ {warehouse && (
+ <>
+ {intl.formatMessage(
+ status === FulfillmentStatus.RETURNED
+ ? extraInfoMessages.restocked
+ : extraInfoMessages.fulfilled,
+ )}
+
+ {getStringOrPlaceholder(warehouse?.name)}
+
+ >
+ )}
+
+
+ {trackingNumber && (
+
+ {trackingNumber}
+
+ ),
+ }}
+ />
+ )}
+
+
);
};
diff --git a/src/orders/components/OrderFulfilledProductsCard/OrderFulfilledProductsCard.tsx b/src/orders/components/OrderFulfilledProductsCard/OrderFulfilledProductsCard.tsx
index e519a9951..8383295dc 100644
--- a/src/orders/components/OrderFulfilledProductsCard/OrderFulfilledProductsCard.tsx
+++ b/src/orders/components/OrderFulfilledProductsCard/OrderFulfilledProductsCard.tsx
@@ -1,17 +1,14 @@
import CardSpacer from "@dashboard/components/CardSpacer";
-import ResponsiveTable from "@dashboard/components/ResponsiveTable";
import { FulfillmentStatus, OrderDetailsFragment } from "@dashboard/graphql";
import TrashIcon from "@dashboard/icons/Trash";
import { orderHasTransactions } from "@dashboard/orders/types";
import { mergeRepeatedOrderLines } from "@dashboard/orders/utils/data";
-import { Card, CardContent, TableBody } from "@material-ui/core";
+import { Card, CardContent } from "@material-ui/core";
import { IconButton } from "@saleor/macaw-ui";
import React from "react";
-import { renderCollection } from "../../../misc";
import OrderCardTitle from "../OrderCardTitle";
-import TableHeader from "../OrderProductsCardElements/OrderProductsCardHeader";
-import TableLine from "../OrderProductsCardElements/OrderProductsTableRow";
+import { OrderDetailsDatagrid } from "../OrderDetailsDatagrid";
import ActionButtons from "./ActionButtons";
import ExtraInfoLines from "./ExtraInfoLines";
import useStyles from "./styles";
@@ -55,10 +52,12 @@ const OrderFulfilledProductsCard: React.FC<
const getLines = () => {
if (statusesToMergeLines.includes(fulfillment?.status)) {
- return mergeRepeatedOrderLines(fulfillment.lines);
+ return mergeRepeatedOrderLines(fulfillment.lines).map(
+ order => order.orderLine,
+ );
}
- return fulfillment?.lines || [];
+ return fulfillment?.lines.map(order => order.orderLine) || [];
};
return (
@@ -85,15 +84,8 @@ const OrderFulfilledProductsCard: React.FC<
}
/>
-
-
-
- {renderCollection(getLines(), line => (
-
- ))}
-
-
-
+
+
{
case "status":
return getStatusCellContent(intl, themeValues, currentTheme, rowData);
case "total":
- return getTotalCellContent(locale, rowData);
+ return getTotalCellContent(rowData);
default:
return textCell("");
}
@@ -213,15 +212,12 @@ export function getStatusCellContent(
}
export function getTotalCellContent(
- locale: Locale,
rowData: RelayToFlat[number],
) {
if (rowData?.total?.gross) {
- return moneyCell(
- formatMoneyAmount(rowData.total.gross, locale),
- rowData.total.gross.currency,
- { cursor: "pointer" },
- );
+ return moneyCell(rowData.total.gross.amount, rowData.total.gross.currency, {
+ cursor: "pointer",
+ });
}
return readonlyTextCell("-");
diff --git a/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx b/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx
index 0c11b868d..882e59d29 100644
--- a/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx
+++ b/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx
@@ -169,12 +169,12 @@ const OrderProductAddDialog: React.FC = props => {
scrollableTarget={scrollableTargetId}
>
-
+
{renderCollection(
productChoicesWithValidVariants,
(product, productIndex) => (
-
+
= props => {
className={classes.avatar}
thumbnail={maybe(() => product.thumbnail.url)}
/>
-
+
{maybe(() => product.name)}
{maybe(() => product.variants, [])
.filter(isValidVariant)
.map((variant, variantIndex) => (
-
+
= props => {
)}
-
+
diff --git a/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx b/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx
index e9550e48f..193b1773a 100644
--- a/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx
+++ b/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx
@@ -1,22 +1,13 @@
import { Button } from "@dashboard/components/Button";
import CardSpacer from "@dashboard/components/CardSpacer";
-import ResponsiveTable from "@dashboard/components/ResponsiveTable";
import { OrderLineFragment } from "@dashboard/graphql";
import { commonMessages } from "@dashboard/intl";
-import { renderCollection } from "@dashboard/misc";
-import {
- Card,
- CardActions,
- CardContent,
- TableBody,
- Typography,
-} from "@material-ui/core";
+import { Card, CardActions, CardContent, Typography } from "@material-ui/core";
import React from "react";
import { FormattedMessage } from "react-intl";
import OrderCardTitle from "../OrderCardTitle";
-import TableHeader from "../OrderProductsCardElements/OrderProductsCardHeader";
-import TableLine from "../OrderProductsCardElements/OrderProductsTableRow";
+import { OrderDetailsDatagrid } from "../OrderDetailsDatagrid";
import { useStyles } from "./styles";
interface OrderUnfulfilledProductsCardProps {
@@ -24,13 +15,18 @@ interface OrderUnfulfilledProductsCardProps {
notAllowedToFulfillUnpaid: boolean;
lines: OrderLineFragment[];
onFulfill: () => void;
+ loading: boolean;
}
const OrderUnfulfilledProductsCard: React.FC<
OrderUnfulfilledProductsCardProps
-> = props => {
- const { showFulfillmentAction, notAllowedToFulfillUnpaid, lines, onFulfill } =
- props;
+> = ({
+ showFulfillmentAction,
+ notAllowedToFulfillUnpaid,
+ lines,
+ onFulfill,
+ loading,
+}) => {
const classes = useStyles();
if (!lines.length) {
@@ -47,14 +43,7 @@ const OrderUnfulfilledProductsCard: React.FC<
className={classes.cardTitle}
/>
-
-
-
- {renderCollection(lines, line => (
-
- ))}
-
-
+
{showFulfillmentAction && (
|