Skip to content

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

Add fulfillment status fitltering

dominik-zeglend8436e17c87a
diff --git a/saleor/static/dashboard-next/orders/components/OrderListFilter/OrderListFilter.tsx b/saleor/static/dashboard-next/orders/components/OrderListFilter/OrderListFilter.tsx
index 0171aa44ad..6fe3b547df 100644
--- a/saleor/static/dashboard-next/orders/components/OrderListFilter/OrderListFilter.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderListFilter/OrderListFilter.tsx
@@ -7,6 +7,7 @@ import FilterBar from "@saleor/components/FilterBar";
import TimezoneContext from "@saleor/components/Timezone";
import i18n from "../../../i18n";
import { FilterProps } from "../../../types";
+import { OrderStatusFilter } from "../../../types/globalTypes";
import { OrderListUrlFilters } from "../../urls";
type OrderListFilterProps = FilterProps<OrderListUrlFilters>;
@@ -18,7 +19,8 @@ export enum OrderFilterKeys {
dateLastWeek,
dateLastMonth,
dateLastYear,
- email
+ email,
+ fulfillment
}
const OrderListFilter: React.FC<OrderListFilterProps> = props => {
@@ -93,6 +95,30 @@ const OrderListFilter: React.FC<OrderListFilterProps> = props => {
},
label: i18n.t("Date"),
value: OrderFilterKeys.date.toString()
+ },
+ {
+ children: [],
+ data: {
+ additionalText: i18n.t("is set as"),
+ fieldLabel: i18n.t("Status"),
+ options: [
+ {
+ label: i18n.t("Fulfilled"),
+ value: OrderStatusFilter.FULFILLED.toString()
+ },
+ {
+ label: i18n.t("Partially Fulfilled"),
+ value: OrderStatusFilter.PARTIALLY_FULFILLED.toString()
+ },
+ {
+ label: i18n.t("Unfulfilled"),
+ value: OrderStatusFilter.UNFULFILLED.toString()
+ }
+ ],
+ type: FieldType.select
+ },
+ label: i18n.t("Fulfillment Status"),
+ value: OrderFilterKeys.fulfillment.toString()
}
];
diff --git a/saleor/static/dashboard-next/orders/views/OrderList/filters.ts b/saleor/static/dashboard-next/orders/views/OrderList/filters.ts
index e1809aef35..85a5acc61b 100644
--- a/saleor/static/dashboard-next/orders/views/OrderList/filters.ts
+++ b/saleor/static/dashboard-next/orders/views/OrderList/filters.ts
@@ -1,7 +1,10 @@
import { FilterContentSubmitData } from "../../../components/Filter";
import { Filter } from "../../../components/TableFilter";
import i18n from "../../../i18n";
-import { OrderFilterInput } from "../../../types/globalTypes";
+import {
+ OrderFilterInput,
+ OrderStatusFilter
+} from "../../../types/globalTypes";
import {
createFilterTabUtils,
createFilterUtils
@@ -23,7 +26,8 @@ export function getFilterVariables(
gte: params.dateFrom,
lte: params.dateTo
},
- customer: params.email
+ customer: params.email,
+ status: OrderStatusFilter[params.status]
};
}
@@ -57,6 +61,11 @@ export function createFilter(
dateFrom: value as string,
dateTo: undefined
};
+ } else if (filterName === OrderFilterKeys.fulfillment.toString()) {
+ const { value } = filter;
+ return {
+ status: value as string
+ };
}
}