Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Filter order list by email param

Krzysztof Bialoglowicz4aa99a62edd0
diff --git a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
index 1f58af257f..9087e34ff8 100644
--- a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
+++ b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
@@ -7,7 +7,7 @@ import useNavigator from "../../hooks/useNavigator";
import useNotifier from "../../hooks/useNotifier";
import i18n from "../../i18n";
import { getMutationState, maybe } from "../../misc";
-import { orderUrl, orderListUrl } from "../../orders/urls";
+import { orderListUrl, orderUrl } from "../../orders/urls";
import CustomerDetailsPage from "../components/CustomerDetailsPage/CustomerDetailsPage";
import {
TypedRemoveCustomerMutation,
diff --git a/saleor/static/dashboard-next/orders/queries.ts b/saleor/static/dashboard-next/orders/queries.ts
index 2231630701..bf0d074dce 100644
--- a/saleor/static/dashboard-next/orders/queries.ts
+++ b/saleor/static/dashboard-next/orders/queries.ts
@@ -169,6 +169,7 @@ export const orderListQuery = gql`
$last: Int
$before: String
$status: OrderStatusFilter
+ $filter: OrderFilterInput
) {
orders(
before: $before
@@ -176,6 +177,7 @@ export const orderListQuery = gql`
first: $first
last: $last
status: $status
+ filter: $filter
) {
edges {
node {
diff --git a/saleor/static/dashboard-next/orders/types/OrderList.ts b/saleor/static/dashboard-next/orders/types/OrderList.ts
index db615fd7ae..959ca23095 100644
--- a/saleor/static/dashboard-next/orders/types/OrderList.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderList.ts
@@ -2,7 +2,7 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
-import { OrderStatusFilter, PaymentChargeStatusEnum, OrderStatus } from "./../../types/globalTypes";
+import { OrderStatusFilter, OrderFilterInput, PaymentChargeStatusEnum, OrderStatus } from "./../../types/globalTypes";
// ====================================================
// GraphQL query operation: OrderList
@@ -82,4 +82,5 @@ export interface OrderListVariables {
last?: number | null;
before?: string | null;
status?: OrderStatusFilter | null;
+ filter?: OrderFilterInput | null;
}
diff --git a/saleor/static/dashboard-next/orders/urls.ts b/saleor/static/dashboard-next/orders/urls.ts
index dcc64a5389..e997c6a2df 100644
--- a/saleor/static/dashboard-next/orders/urls.ts
+++ b/saleor/static/dashboard-next/orders/urls.ts
@@ -9,6 +9,7 @@ const orderSectionUrl = "/orders";
export const orderListPath = orderSectionUrl;
export type OrderListUrlFilters = Partial<{
status: OrderStatusFilter;
+ email: string;
}>;
export type OrderListUrlDialog = "cancel";
export type OrderListUrlQueryParams = BulkAction &
diff --git a/saleor/static/dashboard-next/orders/views/OrderList.tsx b/saleor/static/dashboard-next/orders/views/OrderList.tsx
index 769ccf2193..ab11755f0b 100644
--- a/saleor/static/dashboard-next/orders/views/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderList.tsx
@@ -80,6 +80,7 @@ export const OrderList: React.StatelessComponent<OrderListProps> = ({
displayLoader
variables={{
...paginationState,
+ filter: { customer: params.email },
status: params.status
}}
>
diff --git a/saleor/static/dashboard-next/types/globalTypes.ts b/saleor/static/dashboard-next/types/globalTypes.ts
index b4e0dc9128..5b5e3cc562 100644
--- a/saleor/static/dashboard-next/types/globalTypes.ts
+++ b/saleor/static/dashboard-next/types/globalTypes.ts
@@ -316,6 +316,11 @@ export interface CustomerInput {
note?: string | null;
}
+export interface DateRangeInput {
+ gte?: any | null;
+ lte?: any | null;
+}
+
export interface DraftOrderInput {
billingAddress?: AddressInput | null;
user?: string | null;
@@ -383,6 +388,13 @@ export interface OrderAddNoteInput {
message?: string | null;
}
+export interface OrderFilterInput {
+ paymentStatus?: (PaymentChargeStatusEnum | null)[] | null;
+ status?: (OrderStatusFilter | null)[] | null;
+ customer?: string | null;
+ created?: DateRangeInput | null;
+}
+
export interface OrderLineCreateInput {
quantity: number;
variantId: string;