Browse Source

feat(dashboard): Add state filter to order list view

Michael Bromley 10 months ago
parent
commit
eb9c8de792
1 changed files with 13 additions and 0 deletions
  1. 13 0
      packages/dashboard/src/app/routes/_authenticated/_orders/orders.tsx

+ 13 - 0
packages/dashboard/src/app/routes/_authenticated/_orders/orders.tsx

@@ -6,6 +6,7 @@ import { ListPage } from '@/framework/page/list-page.js';
 import { Trans } from '@/lib/trans.js';
 import { createFileRoute, Link } from '@tanstack/react-router';
 import { orderListDocument } from './orders.graphql.js';
+import { useServerConfig } from '@/hooks/use-server-config.js';
 
 export const Route = createFileRoute('/_authenticated/_orders/orders')({
     component: OrderListPage,
@@ -13,6 +14,7 @@ export const Route = createFileRoute('/_authenticated/_orders/orders')({
 });
 
 function OrderListPage() {
+    const serverConfig = useServerConfig();
     return (
         <ListPage
             pageId="order-list"
@@ -102,6 +104,17 @@ function OrderListPage() {
                 type: false,
                 currencyCode: false,
             }}
+            facetedFilters={{
+                state: {
+                    title: 'State',
+                    options: serverConfig?.orderProcess.map(state => {
+                        return {
+                            label: state.name,
+                            value: state.name,
+                        }
+                    }) ?? [],
+                },
+            }}
         />
     );
 }