diff --git a/admin-spa/src/routes/Customers/index.tsx b/admin-spa/src/routes/Customers/index.tsx index 21c4058..ee65632 100644 --- a/admin-spa/src/routes/Customers/index.tsx +++ b/admin-spa/src/routes/Customers/index.tsx @@ -11,7 +11,7 @@ import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { ErrorCard } from '@/components/ErrorCard'; import { Skeleton } from '@/components/ui/skeleton'; -import { RefreshCw, Trash2, Search, User, ChevronRight } from 'lucide-react'; +import { RefreshCw, Trash2, Search, User, ChevronRight, Edit } from 'lucide-react'; import { formatMoney } from '@/lib/currency'; export default function CustomersIndex() { @@ -103,15 +103,14 @@ export default function CustomersIndex() {
- { setSearch(e.target.value); setPage(1); }} - className="pl-9" + placeholder={__('Search customers...')} + className="w-full pl-10 pr-4 py-2.5 rounded-lg border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent" />
@@ -146,15 +145,14 @@ export default function CustomersIndex() {
- { setSearch(e.target.value); setPage(1); }} - className="pl-9 w-64" + placeholder={__('Search customers...')} + className="pl-10 pr-4 py-2 rounded-lg border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent w-64" />
@@ -175,15 +173,17 @@ export default function CustomersIndex() { {__('Customer')} {__('Email')} + {__('Type')} {__('Orders')} {__('Total Spent')} {__('Registered')} + {__('Actions')} {customers.length === 0 ? ( - + {search ? __('No customers found matching your search') : __('No customers yet')} {!search && ( @@ -206,11 +206,18 @@ export default function CustomersIndex() { /> - + {customer.display_name || `${customer.first_name} ${customer.last_name}`} {customer.email} + + + {customer.role === 'customer' ? __('Member') : __('Guest')} + + {customer.stats?.total_orders || 0} {customer.stats?.total_spent ? formatMoney(customer.stats.total_spent) : '—'} @@ -218,6 +225,15 @@ export default function CustomersIndex() { {new Date(customer.registered).toLocaleDateString()} + + + )) )} @@ -236,7 +252,7 @@ export default function CustomersIndex() { customers.map((customer) => (
diff --git a/includes/Api/CustomersController.php b/includes/Api/CustomersController.php index 91de62d..e1b1ab7 100644 --- a/includes/Api/CustomersController.php +++ b/includes/Api/CustomersController.php @@ -93,7 +93,7 @@ class CustomersController { $customers = []; foreach ($users as $user) { - $customers[] = self::format_customer($user); + $customers[] = self::format_customer($user, true); // Include stats for list view } return new WP_REST_Response([