Add single customer filter and hook up customer link (https://github.com/woocommerce/woocommerce-admin/pull/1798)

* Add a single customer filter to the customers report

* Hook up activity panel orders customer link to customer report

* Use customer name for label instead of username
This commit is contained in:
Joshua T Flowers 2019-03-18 10:39:54 +08:00 committed by GitHub
parent f08fda5271
commit b1dd517eb6
3 changed files with 24 additions and 2 deletions

View File

@ -19,6 +19,28 @@ export const filters = [
showFilters: () => true,
filters: [
{ label: __( 'All Customers', 'woocommerce-admin' ), value: 'all' },
{
label: __( 'Single Customer', 'woocommerce-admin' ),
value: 'select_customer',
chartMode: 'item-comparison',
subFilters: [
{
component: 'Search',
value: 'single_customer',
chartMode: 'item-comparison',
path: [ 'select_customer' ],
settings: {
type: 'customers',
param: 'customers',
getLabels: getCustomerLabels,
labels: {
placeholder: __( 'Type to search for a customer', 'woocommerce-admin' ),
button: __( 'Single Customer', 'woocommerce-admin' ),
},
},
},
],
},
{ label: __( 'Advanced Filters', 'woocommerce-admin' ), value: 'advanced' },
],
},

View File

@ -107,7 +107,7 @@ function OrdersPanel( { orders, isRequesting, isError, orderStatuses } ) {
const customerUrl = customer.customer_id
? getNewPath( {}, '/analytics/customers', {
filter: 'single_customer',
customer_id: customer.customer_id,
customers: customer.customer_id,
} )
: null;

View File

@ -53,7 +53,7 @@ export const getCouponLabels = getRequestByIdString( NAMESPACE + '/coupons', cou
export const getCustomerLabels = getRequestByIdString( NAMESPACE + '/customers', customer => ( {
id: customer.id,
label: customer.username,
label: customer.name,
} ) );
export const getProductLabels = getRequestByIdString( NAMESPACE + '/products', product => ( {