woocommerce/plugins/woocommerce-admin/client/analytics/report/coupons/config.js

88 lines
2.0 KiB
JavaScript
Raw Normal View History

2018-09-17 02:26:34 +00:00
/** @format */
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { getCouponLabels } from 'lib/async-requests';
2018-09-17 02:26:34 +00:00
export const charts = [
{
key: 'orders_count',
label: __( 'Discounted Orders', 'wc-admin' ),
order: 'desc',
orderby: 'orders_count',
type: 'number',
},
{
key: 'amount',
label: __( 'Amount', 'wc-admin' ),
order: 'desc',
orderby: 'amount',
type: 'currency',
},
];
2018-09-17 02:26:34 +00:00
export const filters = [
{
2018-10-29 01:30:24 +00:00
label: __( 'Show', 'wc-admin' ),
staticParams: [],
param: 'filter',
showFilters: () => true,
filters: [
{ label: __( 'All Coupons', 'wc-admin' ), value: 'all' },
{
label: __( 'Single Coupon', 'wc-admin' ),
value: 'select_coupon',
chartMode: 'item-comparison',
subFilters: [
{
component: 'Search',
value: 'single_coupon',
chartMode: 'item-comparison',
path: [ 'select_coupon' ],
settings: {
type: 'coupons',
param: 'coupons',
getLabels: getCouponLabels,
labels: {
placeholder: __( 'Type to search for a coupon', 'wc-admin' ),
button: __( 'Single Coupon', 'wc-admin' ),
},
},
},
],
},
2018-10-29 01:30:24 +00:00
{
label: __( 'Comparison', 'wc-admin' ),
value: 'compare-coupons',
2018-10-29 01:30:24 +00:00
settings: {
type: 'coupons',
param: 'coupons',
getLabels: getCouponLabels,
2018-10-29 01:30:24 +00:00
labels: {
title: __( 'Compare Coupon Codes', 'wc-admin' ),
update: __( 'Compare', 'wc-admin' ),
helpText: __( 'Select at least two coupon codes to compare', 'wc-admin' ),
2018-10-29 01:30:24 +00:00
},
},
2018-09-17 02:26:34 +00:00
},
{
label: __( 'Top Coupons by Discounted Orders', 'wc-admin' ),
value: 'top_orders',
chartMode: 'item-comparison',
query: { orderby: 'orders_count', order: 'desc', chart: 'orders_count' },
},
{
label: __( 'Top Coupons by Amount Discounted', 'wc-admin' ),
value: 'top_discount',
chartMode: 'item-comparison',
query: { orderby: 'amount', order: 'desc', chart: 'amount' },
},
2018-10-29 01:30:24 +00:00
],
2018-09-17 02:26:34 +00:00
},
];