2018-12-14 23:58:08 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2021-07-13 22:17:51 +00:00
|
|
|
import { __, _x } from '@wordpress/i18n';
|
2019-08-23 16:41:42 +00:00
|
|
|
import { applyFilters } from '@wordpress/hooks';
|
|
|
|
|
|
|
|
const STOCK_REPORT_FILTERS_FILTER = 'woocommerce_admin_stock_report_filters';
|
2020-02-14 02:23:21 +00:00
|
|
|
const STOCK_REPORT_ADVANCED_FILTERS_FILTER =
|
|
|
|
'woocommerce_admin_stock_report_advanced_filters';
|
2018-12-14 23:58:08 +00:00
|
|
|
|
|
|
|
export const showDatePicker = false;
|
|
|
|
|
2022-02-11 14:38:38 +00:00
|
|
|
/**
|
|
|
|
* Stock Report Advanced Filters.
|
|
|
|
*
|
|
|
|
* @filter woocommerce_admin_stock_report_advanced_filters
|
|
|
|
* @param {Object} advancedFilters Report Advanced Filters.
|
|
|
|
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
|
|
|
|
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
|
|
|
|
*/
|
2021-07-13 22:17:51 +00:00
|
|
|
export const advancedFilters = applyFilters(
|
|
|
|
STOCK_REPORT_ADVANCED_FILTERS_FILTER,
|
|
|
|
{
|
|
|
|
filters: {},
|
|
|
|
title: _x(
|
|
|
|
'Products Match {{select /}} Filters',
|
|
|
|
'A sentence describing filters for Products. See screen shot for context: https://cloudup.com/cSsUY9VeCVJ',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-02-11 14:38:38 +00:00
|
|
|
/**
|
|
|
|
* @typedef {import('../index.js').filter} filter
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stock Report Filters.
|
|
|
|
*
|
|
|
|
* @filter woocommerce_admin_stock_report_filters
|
|
|
|
* @param {Array.<filter>} filters Report filters.
|
|
|
|
*/
|
2019-08-23 16:41:42 +00:00
|
|
|
export const filters = applyFilters( STOCK_REPORT_FILTERS_FILTER, [
|
2018-12-14 23:58:08 +00:00
|
|
|
{
|
2019-03-13 17:14:02 +00:00
|
|
|
label: __( 'Show', 'woocommerce-admin' ),
|
2020-06-01 23:03:26 +00:00
|
|
|
staticParams: [ 'paged', 'per_page' ],
|
2018-12-14 23:58:08 +00:00
|
|
|
param: 'type',
|
|
|
|
showFilters: () => true,
|
|
|
|
filters: [
|
2021-08-13 18:54:24 +00:00
|
|
|
{ label: __( 'All products', 'woocommerce-admin' ), value: 'all' },
|
2020-02-14 02:23:21 +00:00
|
|
|
{
|
2021-08-13 18:54:24 +00:00
|
|
|
label: __( 'Out of stock', 'woocommerce-admin' ),
|
2020-02-14 02:23:21 +00:00
|
|
|
value: 'outofstock',
|
|
|
|
},
|
|
|
|
{
|
2021-08-13 18:54:24 +00:00
|
|
|
label: __( 'Low stock', 'woocommerce-admin' ),
|
2020-02-14 02:23:21 +00:00
|
|
|
value: 'lowstock',
|
|
|
|
},
|
2021-08-13 18:54:24 +00:00
|
|
|
{ label: __( 'In stock', 'woocommerce-admin' ), value: 'instock' },
|
2020-02-14 02:23:21 +00:00
|
|
|
{
|
2021-08-13 18:54:24 +00:00
|
|
|
label: __( 'On backorder', 'woocommerce-admin' ),
|
2020-02-14 02:23:21 +00:00
|
|
|
value: 'onbackorder',
|
|
|
|
},
|
2018-12-14 23:58:08 +00:00
|
|
|
],
|
|
|
|
},
|
2021-07-13 22:17:51 +00:00
|
|
|
{
|
|
|
|
label: __( 'Filter by', 'woocommerce-admin' ),
|
|
|
|
staticParams: [ 'paged', 'per_page' ],
|
|
|
|
param: 'filter',
|
|
|
|
showFilters: () => Object.keys( advancedFilters.filters ).length,
|
|
|
|
filters: [
|
|
|
|
{ label: __( 'All Products', 'woocommerce-admin' ), value: 'all' },
|
|
|
|
{
|
|
|
|
label: __( 'Advanced Filters', 'woocommerce-admin' ),
|
|
|
|
value: 'advanced',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-08-23 16:41:42 +00:00
|
|
|
] );
|