Kaynağa Gözat

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

Michael Bromley 10 ay önce
ebeveyn
işleme
eb9c8de792

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