Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Restyle variant adding dialog
dominik-zeglen160f2c18f2b5
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsxindex 02848e5341..1421d07010 100644--- a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx@@ -53,12 +53,6 @@ export interface OrderDraftPageProps extends WithStyles<typeof styles> {label: string;}>;saveButtonBarState: ConfirmButtonTransitionState;- variants: Array<{- id: string;- name: string;- sku: string;- stockQuantity: number;- }>;variantsLoading: boolean;fetchVariants: (value: string) => void;fetchUsers: (query: string) => void;diff --git a/saleor/static/dashboard-next/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsxindex ddacf494c3..47ea49d2ee 100644--- a/saleor/static/dashboard-next/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderProductAddDialog/OrderProductAddDialog.tsx@@ -1,55 +1,102 @@import Button from "@material-ui/core/Button";+import Checkbox from "@material-ui/core/Checkbox";+import CircularProgress from "@material-ui/core/CircularProgress";import Dialog from "@material-ui/core/Dialog";import DialogActions from "@material-ui/core/DialogActions";import DialogContent from "@material-ui/core/DialogContent";import DialogTitle from "@material-ui/core/DialogTitle";-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";+import {+ createStyles,+ Theme,+ withStyles,+ WithStyles+} from "@material-ui/core/styles";+import Table from "@material-ui/core/Table";+import TableBody from "@material-ui/core/TableBody";+import TableCell from "@material-ui/core/TableCell";+import TableRow from "@material-ui/core/TableRow";+import TextField from "@material-ui/core/TextField";import * as React from "react";import ConfirmButton, {ConfirmButtonTransitionState} from "../../../components/ConfirmButton";+import Debounce from "../../../components/Debounce";import Form from "../../../components/Form";-import { SingleAutocompleteSelectField } from "../../../components/SingleAutocompleteSelectField";+import Money from "../../../components/Money";+import TableCellAvatar from "../../../components/TableCellAvatar";import i18n from "../../../i18n";+import {+ OrderVariantSearch_products_edges_node,+ OrderVariantSearch_products_edges_node_variants+} from "../../types/OrderVariantSearch";export interface FormData {- quantity: number;- variant: {- label: string;- value: string;- };+ variants: OrderVariantSearch_products_edges_node_variants[];+ query: string;}-const styles = createStyles({- overflow: {- overflowY: "visible"- }-});+const styles = (theme: Theme) =>+ createStyles({+ avatar: {+ "&:first-child": {+ paddingLeft: 0+ }+ },+ content: {+ maxHeight: 600,+ overflowY: "scroll"+ },+ grayText: {+ color: theme.palette.text.disabled+ },+ overflow: {+ overflowY: "visible"+ },+ productCheckboxCell: {+ "&:first-child": {+ paddingLeft: 0,+ paddingRight: 0+ }+ },+ textRight: {+ textAlign: "right"+ },+ variantCheckboxCell: {},+ wideCell: {+ width: "100%"+ }+ });interface OrderProductAddDialogProps extends WithStyles<typeof styles> {confirmButtonState: ConfirmButtonTransitionState;open: boolean;- variants?: Array<{- id: string;- name: string;- sku: string;- stockQuantity: number;- }>;+ products: OrderVariantSearch_products_edges_node[];loading: boolean;- fetchVariants: (value: string) => void;onClose: () => void;+ onFetch: (value: string) => void;onSubmit: (data: FormData) => void;}const initialForm: FormData = {- quantity: 1,- variant: {- label: "",- value: ""- }+ query: "",+ variants: []};+function hasAllVariantsSelected(+ productVariants: OrderVariantSearch_products_edges_node_variants[],+ selectedVariants: OrderVariantSearch_products_edges_node_variants[]+) {+ return productVariants.reduce(+ (acc, productVariant) =>+ acc &&+ !!selectedVariants.find(+ selectedVariant => selectedVariant.id === productVariant.id+ ),+ true+ );+}+const OrderProductAddDialog = withStyles(styles, {name: "OrderProductAddDialog"})(@@ -58,8 +105,8 @@ const OrderProductAddDialog = withStyles(styles, {confirmButtonState,open,loading,- variants,- fetchVariants,+ products,+ onFetch,onClose,onSubmit}: OrderProductAddDialogProps) => (@@ -70,43 +117,162 @@ const OrderProductAddDialog = withStyles(styles, {maxWidth="sm"><Form initial={initialForm} onSubmit={onSubmit}>- {({ data, change }) => {- const choices =- !loading && variants- ? variants.map(v => ({- label: `${v.sku} ${v.name}`,- value: v.id- }))- : [];- return (- <>- <DialogTitle>{i18n.t("Add product")}</DialogTitle>- <DialogContent className={classes.overflow}>- <SingleAutocompleteSelectField- name="variant"- value={data.variant}- choices={choices}- onChange={change}- fetchChoices={fetchVariants}- loading={loading}- />- </DialogContent>- <DialogActions>- <Button onClick={onClose}>- {i18n.t("Cancel", { context: "button" })}- </Button>- <ConfirmButton- transitionState={confirmButtonState}- color="primary"- variant="contained"- type="submit"- >- {i18n.t("Confirm", { context: "button" })}- </ConfirmButton>- </DialogActions>- </>- );- }}+ {({ data, change }) => (+ <>+ <DialogTitle>{i18n.t("Add product")}</DialogTitle>+ <DialogContent className={classes.overflow}>+ <Debounce debounceFn={onFetch}>+ {fetch => (+ <TextField+ name="query"+ value={data.query}+ onChange={event => change(event, () => fetch(data.query))}+ label={i18n.t("Search Products", {+ context: "product search input label"+ })}+ placeholder={i18n.t(+ "Search by product name, attribute, product type etc...",+ {+ context: "product search input placeholder"+ }+ )}+ fullWidth+ InputProps={{+ autoComplete: "off",+ endAdornment: loading && <CircularProgress size={16} />+ }}+ />+ )}+ </Debounce>+ </DialogContent>+ <DialogContent className={classes.content}>+ <Table>+ <TableBody>+ {products &&+ products.map(product => (+ <React.Fragment key={product.id}>+ <TableRow>+ <TableCell+ padding="checkbox"+ className={classes.productCheckboxCell}+ >+ <Checkbox+ checked={hasAllVariantsSelected(+ product.variants,+ data.variants+ )}+ onChange={() =>+ hasAllVariantsSelected(+ product.variants,+ data.variants+ )+ ? change({+ target: {+ name: "variants",+ value: data.variants.filter(+ selectedVariant =>+ !product.variants.find(+ productVariant =>+ productVariant.id ===+ selectedVariant.id+ )+ )+ }+ } as any)+ : change({+ target: {+ name: "variants",+ value: [+ ...data.variants,+ ...product.variants.filter(+ productVariant =>+ !data.variants.find(+ selectedVariant =>+ selectedVariant.id ===+ productVariant.id+ )+ )+ ]+ }+ } as any)+ }+ />+ </TableCell>+ <TableCellAvatar+ className={classes.avatar}+ thumbnail={product.thumbnail.url}+ />+ <TableCell className={classes.wideCell} colSpan={2}>+ {product.name}+ </TableCell>+ </TableRow>+ {product.variants.map(variant => (+ <TableRow key={variant.id}>+ <TableCell />+ <TableCell className={classes.variantCheckboxCell}>+ <Checkbox+ checked={+ !!data.variants.find(+ selectedVariant =>+ selectedVariant.id === variant.id+ )+ }+ onChange={() =>+ data.variants.find(+ selectedVariant =>+ selectedVariant.id === variant.id+ )+ ? change({+ target: {+ name: "variants",+ value: data.variants.filter(+ selectedVariant =>+ selectedVariant.id !== variant.id+ )+ }+ } as any)+ : change({+ target: {+ name: "variants",+ value: [...data.variants, variant]+ }+ } as any)+ }+ />+ </TableCell>+ <TableCell>+ <div>{variant.name}</div>+ <div className={classes.grayText}>+ {i18n.t("SKU {{ sku }}", {+ sku: variant.sku+ })}+ </div>+ </TableCell>+ <TableCell className={classes.textRight}>+ <Money money={variant.price} />+ </TableCell>+ </TableRow>+ ))}+ </React.Fragment>+ ))}+ </TableBody>+ </Table>+ </DialogContent>+ <DialogActions>+ <Button onClick={onClose}>+ {i18n.t("Cancel", { context: "button" })}+ </Button>+ <ConfirmButton+ transitionState={confirmButtonState}+ color="primary"+ variant="contained"+ type="submit"+ >+ {i18n.t("Confirm", { context: "button" })}+ </ConfirmButton>+ </DialogActions>+ </>+ )}</Form></Dialog>)diff --git a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsxindex f66acb1a0c..9fb2135e16 100644--- a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx+++ b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx@@ -12,8 +12,8 @@ import {TypedOrderDraftUpdateMutation,TypedOrderFulfillmentCancelMutation,TypedOrderFulfillmentUpdateTrackingMutation,- TypedOrderLineAddMutation,TypedOrderLineDeleteMutation,+ TypedOrderLinesAddMutation,TypedOrderLineUpdateMutation,TypedOrderMarkAsPaidMutation,TypedOrderRefundMutation,@@ -207,7 +207,7 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({onCompleted={onOrderLineDelete}>{(...deleteOrderLine) => (- <TypedOrderLineAddMutation+ <TypedOrderLinesAddMutationonCompleted={onOrderLineAdd}>{(...addOrderLine) => (@@ -319,7 +319,7 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({)}</TypedOrderLineUpdateMutation>)}- </TypedOrderLineAddMutation>+ </TypedOrderLinesAddMutation>)}</TypedOrderLineDeleteMutation>)}diff --git a/saleor/static/dashboard-next/orders/mutations.ts b/saleor/static/dashboard-next/orders/mutations.tsindex 84a5df8611..7c81e0e1b6 100644--- a/saleor/static/dashboard-next/orders/mutations.ts+++ b/saleor/static/dashboard-next/orders/mutations.ts@@ -34,11 +34,11 @@ import {OrderFulfillmentUpdateTracking,OrderFulfillmentUpdateTrackingVariables} from "./types/OrderFulfillmentUpdateTracking";-import { OrderLineAdd, OrderLineAddVariables } from "./types/OrderLineAdd";import {OrderLineDelete,OrderLineDeleteVariables} from "./types/OrderLineDelete";+import { OrderLinesAdd, OrderLinesAddVariables } from "./types/OrderLinesAdd";import {OrderLineUpdate,OrderLineUpdateVariables@@ -395,9 +395,9 @@ export const TypedOrderLineDeleteMutation = TypedMutation<OrderLineDeleteVariables>(orderLineDeleteMutation);-const orderLineAddMutation = gql`+const orderLinesAddMutation = gql`${fragmentOrderDetails}- mutation OrderLineAdd($id: ID!, $input: [OrderLineCreateInput]!) {+ mutation OrderLinesAdd($id: ID!, $input: [OrderLineCreateInput]!) {draftOrderLinesCreate(id: $id, input: $input) {errors {field@@ -409,10 +409,10 @@ const orderLineAddMutation = gql`}}`;-export const TypedOrderLineAddMutation = TypedMutation<- OrderLineAdd,- OrderLineAddVariables->(orderLineAddMutation);+export const TypedOrderLinesAddMutation = TypedMutation<+ OrderLinesAdd,+ OrderLinesAddVariables+>(orderLinesAddMutation);const orderLineUpdateMutation = gql`${fragmentOrderDetails}diff --git a/saleor/static/dashboard-next/orders/queries.ts b/saleor/static/dashboard-next/orders/queries.tsindex cb21ba70a4..675cfa8921 100644--- a/saleor/static/dashboard-next/orders/queries.ts+++ b/saleor/static/dashboard-next/orders/queries.ts@@ -232,11 +232,17 @@ export const orderVariantSearchQuery = gql`node {idname+ thumbnail {+ url+ }variants {idnamesku- stockQuantity+ price {+ amount+ currency+ }}}}diff --git a/saleor/static/dashboard-next/orders/types/OrderLinesAdd.ts b/saleor/static/dashboard-next/orders/types/OrderLinesAdd.tsnew file mode 100644index 0000000000..b78a79677b--- /dev/null+++ b/saleor/static/dashboard-next/orders/types/OrderLinesAdd.ts@@ -0,0 +1,270 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++import { OrderLineCreateInput, OrderEventsEmails, OrderEvents, FulfillmentStatus, PaymentChargeStatusEnum, OrderStatus, OrderAction } from "./../../types/globalTypes";++// ====================================================+// GraphQL mutation operation: OrderLinesAdd+// ====================================================++export interface OrderLinesAdd_draftOrderLinesCreate_errors {+ __typename: "Error";+ field: string | null;+ message: string | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_billingAddress_country {+ __typename: "CountryDisplay";+ code: string;+ country: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_billingAddress {+ __typename: "Address";+ city: string;+ cityArea: string;+ companyName: string;+ country: OrderLinesAdd_draftOrderLinesCreate_order_billingAddress_country;+ countryArea: string;+ firstName: string;+ id: string;+ lastName: string;+ phone: string | null;+ postalCode: string;+ streetAddress1: string;+ streetAddress2: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_events_user {+ __typename: "User";+ email: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_events {+ __typename: "OrderEvent";+ id: string;+ amount: number | null;+ date: any | null;+ email: string | null;+ emailType: OrderEventsEmails | null;+ message: string | null;+ quantity: number | null;+ type: OrderEvents | null;+ user: OrderLinesAdd_draftOrderLinesCreate_order_events_user | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine_unitPrice_gross {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine_unitPrice_net {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine_unitPrice {+ __typename: "TaxedMoney";+ gross: OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine_unitPrice_gross;+ net: OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine_unitPrice_net;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine {+ __typename: "OrderLine";+ id: string;+ isShippingRequired: boolean;+ productName: string;+ productSku: string;+ quantity: number;+ quantityFulfilled: number;+ unitPrice: OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine_unitPrice | null;+ thumbnailUrl: string | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines {+ __typename: "FulfillmentLine";+ id: string;+ quantity: number;+ orderLine: OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines_orderLine | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_fulfillments {+ __typename: "Fulfillment";+ id: string;+ lines: (OrderLinesAdd_draftOrderLinesCreate_order_fulfillments_lines | null)[] | null;+ fulfillmentOrder: number;+ status: FulfillmentStatus;+ trackingNumber: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_lines_unitPrice_gross {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_lines_unitPrice_net {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_lines_unitPrice {+ __typename: "TaxedMoney";+ gross: OrderLinesAdd_draftOrderLinesCreate_order_lines_unitPrice_gross;+ net: OrderLinesAdd_draftOrderLinesCreate_order_lines_unitPrice_net;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_lines {+ __typename: "OrderLine";+ id: string;+ isShippingRequired: boolean;+ productName: string;+ productSku: string;+ quantity: number;+ quantityFulfilled: number;+ unitPrice: OrderLinesAdd_draftOrderLinesCreate_order_lines_unitPrice | null;+ thumbnailUrl: string | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_shippingAddress_country {+ __typename: "CountryDisplay";+ code: string;+ country: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_shippingAddress {+ __typename: "Address";+ city: string;+ cityArea: string;+ companyName: string;+ country: OrderLinesAdd_draftOrderLinesCreate_order_shippingAddress_country;+ countryArea: string;+ firstName: string;+ id: string;+ lastName: string;+ phone: string | null;+ postalCode: string;+ streetAddress1: string;+ streetAddress2: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_shippingMethod {+ __typename: "ShippingMethod";+ id: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_shippingPrice_gross {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_shippingPrice {+ __typename: "TaxedMoney";+ gross: OrderLinesAdd_draftOrderLinesCreate_order_shippingPrice_gross;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_subtotal_gross {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_subtotal {+ __typename: "TaxedMoney";+ gross: OrderLinesAdd_draftOrderLinesCreate_order_subtotal_gross;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_total_gross {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_total_tax {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_total {+ __typename: "TaxedMoney";+ gross: OrderLinesAdd_draftOrderLinesCreate_order_total_gross;+ tax: OrderLinesAdd_draftOrderLinesCreate_order_total_tax;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_totalAuthorized {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_totalCaptured {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_user {+ __typename: "User";+ id: string;+ email: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_availableShippingMethods_price {+ __typename: "Money";+ amount: number;+ currency: string;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order_availableShippingMethods {+ __typename: "ShippingMethod";+ id: string;+ name: string;+ price: OrderLinesAdd_draftOrderLinesCreate_order_availableShippingMethods_price | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate_order {+ __typename: "Order";+ id: string;+ billingAddress: OrderLinesAdd_draftOrderLinesCreate_order_billingAddress | null;+ canFinalize: boolean;+ created: any;+ customerNote: string;+ events: (OrderLinesAdd_draftOrderLinesCreate_order_events | null)[] | null;+ fulfillments: (OrderLinesAdd_draftOrderLinesCreate_order_fulfillments | null)[];+ lines: (OrderLinesAdd_draftOrderLinesCreate_order_lines | null)[];+ number: string | null;+ paymentStatus: PaymentChargeStatusEnum | null;+ shippingAddress: OrderLinesAdd_draftOrderLinesCreate_order_shippingAddress | null;+ shippingMethod: OrderLinesAdd_draftOrderLinesCreate_order_shippingMethod | null;+ shippingMethodName: string | null;+ shippingPrice: OrderLinesAdd_draftOrderLinesCreate_order_shippingPrice | null;+ status: OrderStatus;+ subtotal: OrderLinesAdd_draftOrderLinesCreate_order_subtotal | null;+ total: OrderLinesAdd_draftOrderLinesCreate_order_total | null;+ actions: (OrderAction | null)[];+ totalAuthorized: OrderLinesAdd_draftOrderLinesCreate_order_totalAuthorized | null;+ totalCaptured: OrderLinesAdd_draftOrderLinesCreate_order_totalCaptured | null;+ user: OrderLinesAdd_draftOrderLinesCreate_order_user | null;+ userEmail: string | null;+ availableShippingMethods: (OrderLinesAdd_draftOrderLinesCreate_order_availableShippingMethods | null)[] | null;+}++export interface OrderLinesAdd_draftOrderLinesCreate {+ __typename: "DraftOrderLinesCreate";+ errors: OrderLinesAdd_draftOrderLinesCreate_errors[] | null;+ order: OrderLinesAdd_draftOrderLinesCreate_order;+}++export interface OrderLinesAdd {+ draftOrderLinesCreate: OrderLinesAdd_draftOrderLinesCreate | null;+}++export interface OrderLinesAddVariables {+ id: string;+ input: (OrderLineCreateInput | null)[];+}diff --git a/saleor/static/dashboard-next/orders/types/OrderVariantSearch.ts b/saleor/static/dashboard-next/orders/types/OrderVariantSearch.tsindex 137b2c831d..9d0070dada 100644--- a/saleor/static/dashboard-next/orders/types/OrderVariantSearch.ts+++ b/saleor/static/dashboard-next/orders/types/OrderVariantSearch.ts@@ -5,18 +5,30 @@// GraphQL query operation: OrderVariantSearch// ====================================================+export interface OrderVariantSearch_products_edges_node_thumbnail {+ __typename: "Image";+ url: string;+}++export interface OrderVariantSearch_products_edges_node_variants_price {+ __typename: "Money";+ amount: number;+ currency: string;+}+export interface OrderVariantSearch_products_edges_node_variants {__typename: "ProductVariant";id: string;name: string;sku: string;- stockQuantity: number;+ price: OrderVariantSearch_products_edges_node_variants_price | null;}export interface OrderVariantSearch_products_edges_node {__typename: "Product";id: string;name: string;+ thumbnail: OrderVariantSearch_products_edges_node_thumbnail | null;variants: (OrderVariantSearch_products_edges_node_variants | null)[] | null;}diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails/OrderDetailsMessages.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails/OrderDetailsMessages.tsxindex 958fbf9d6e..0c37d6b340 100644--- a/saleor/static/dashboard-next/orders/views/OrderDetails/OrderDetailsMessages.tsx+++ b/saleor/static/dashboard-next/orders/views/OrderDetails/OrderDetailsMessages.tsx@@ -218,13 +218,13 @@ export const OrderDetailsMessages: React.StatelessComponent<}};const handleOrderLineAdd = (data: OrderLineAdd) => {- if (!maybe(() => data.draftOrderLineCreate.errors.length)) {+ if (!maybe(() => data.draftOrderLinesCreate.errors.length)) {pushMessage({text: i18n.t("Order line added", {context: "notification"})});- navigate(orderUrl(data.draftOrderLineCreate.order.id), true);+ navigate(orderUrl(data.draftOrderLinesCreate.order.id), true);} else {pushMessage({text: i18n.t("Could not create order line", {diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsxindex 8ace4ad39f..bfb67774b5 100644--- a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx+++ b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx@@ -548,22 +548,6 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({})}fetchVariants={variantSearch}- variants={maybe(() =>- variantSearchOpts.data.products.edges- .map(edge => edge.node)- .map(product =>- product.variants.map(variant => ({- ...variant,- name: `${product.name}(${- variant.name- })`- }))- )- .reduce(- (prev, curr) => prev.concat(curr),- []- )- )}users={maybe(() =>users.searchOpts.data.customers.edges.map(@@ -723,40 +707,27 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({maybe(() =>orderLineAdd.opts.data- .draftOrderLineCreate.errors+ .draftOrderLinesCreate.errors))}loading={variantSearchOpts.loading}open={!!match}- variants={maybe(() =>- variantSearchOpts.data.products.edges- .map(edge => edge.node)- .map(product =>- product.variants.map(- variant => ({- ...variant,- name: `${product.name}(${- variant.name- })`- })- )- )- .reduce(- (prev, curr) =>- prev.concat(curr),- []- )+ products={maybe(() =>+ variantSearchOpts.data.products.edges.map(+ edge => edge.node+ ))}- fetchVariants={variantSearch}onClose={onModalClose}- onSubmit={variables =>+ onFetch={variantSearch}+ onSubmit={formData =>orderLineAdd.mutate({id,- input: {- quantity: variables.quantity,- variantId:- variables.variant.value- }+ input: formData.variants.map(+ variant => ({+ quantity: 1,+ variantId: variant.id+ })+ )})}/>