2018-06-07 16:05:22 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
2018-08-01 19:07:17 +00:00
|
|
|
import { Button } from '@wordpress/components';
|
2019-04-15 07:06:34 +00:00
|
|
|
import { Component, Fragment } from '@wordpress/element';
|
2018-11-30 16:12:34 +00:00
|
|
|
import { compose } from '@wordpress/compose';
|
2019-04-15 07:06:34 +00:00
|
|
|
import Gridicon from 'gridicons';
|
2018-06-07 16:05:22 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2018-11-30 20:45:44 +00:00
|
|
|
import interpolateComponents from 'interpolate-components';
|
2019-07-16 21:04:28 +00:00
|
|
|
import { keyBy, map, merge } from 'lodash';
|
2018-06-07 16:05:22 +00:00
|
|
|
|
|
|
|
/**
|
2018-10-30 18:57:48 +00:00
|
|
|
* WooCommerce dependencies
|
2018-06-07 16:05:22 +00:00
|
|
|
*/
|
2020-02-14 02:23:21 +00:00
|
|
|
import {
|
|
|
|
EmptyContent,
|
|
|
|
Flag,
|
|
|
|
Link,
|
|
|
|
OrderStatus,
|
|
|
|
Section,
|
|
|
|
} from '@woocommerce/components';
|
2019-11-22 17:07:26 +00:00
|
|
|
import { getNewPath } from '@woocommerce/navigation';
|
|
|
|
import { getAdminLink, getSetting } from '@woocommerce/wc-admin-settings';
|
2020-03-25 03:20:17 +00:00
|
|
|
import { SETTINGS_STORE_NAME } from '@woocommerce/data';
|
2018-10-30 18:57:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-11-30 21:47:04 +00:00
|
|
|
import { ActivityCard, ActivityCardPlaceholder } from '../activity-card';
|
2018-10-30 18:57:48 +00:00
|
|
|
import ActivityHeader from '../activity-header';
|
|
|
|
import ActivityOutboundLink from '../activity-outbound-link';
|
2020-03-25 03:20:17 +00:00
|
|
|
import { QUERY_DEFAULTS } from 'wc-api/constants';
|
|
|
|
import { DEFAULT_ACTIONABLE_STATUSES } from 'analytics/settings/config';
|
2018-12-03 15:59:53 +00:00
|
|
|
import withSelect from 'wc-api/with-select';
|
2020-04-02 21:54:38 +00:00
|
|
|
import { CurrencyContext } from 'lib/currency-context';
|
2020-08-03 16:38:57 +00:00
|
|
|
import { recordEvent } from 'lib/tracks';
|
2018-06-07 16:05:22 +00:00
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
class OrdersPanel extends Component {
|
2020-08-03 16:38:57 +00:00
|
|
|
recordOrderEvent( eventName ) {
|
|
|
|
recordEvent( `activity_panel_orders_${ eventName }`, {} );
|
|
|
|
}
|
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
renderEmptyCard() {
|
|
|
|
const { hasNonActionableOrders } = this.props;
|
|
|
|
if ( hasNonActionableOrders ) {
|
2019-03-15 01:26:16 +00:00
|
|
|
return (
|
2019-04-15 07:06:34 +00:00
|
|
|
<ActivityCard
|
2019-06-12 21:51:08 +00:00
|
|
|
className="woocommerce-empty-activity-card"
|
2020-02-14 02:23:21 +00:00
|
|
|
title={ __(
|
|
|
|
'You have no orders to fulfill',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-04-15 07:06:34 +00:00
|
|
|
icon={ <Gridicon icon="checkmark" size={ 48 } /> }
|
|
|
|
>
|
2020-02-14 02:23:21 +00:00
|
|
|
{ __(
|
|
|
|
"Good job, you've fulfilled all of your new orders!",
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-04-15 07:06:34 +00:00
|
|
|
</ActivityCard>
|
2019-03-15 01:26:16 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
return (
|
|
|
|
<ActivityCard
|
2019-06-12 21:51:08 +00:00
|
|
|
className="woocommerce-empty-activity-card"
|
2020-02-14 02:23:21 +00:00
|
|
|
title={ __(
|
|
|
|
'You have no orders to fulfill',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-04-15 07:06:34 +00:00
|
|
|
icon={ <Gridicon icon="time" size={ 48 } /> }
|
|
|
|
actions={
|
|
|
|
<Button
|
|
|
|
href="https://docs.woocommerce.com/document/managing-orders/"
|
2020-06-11 19:22:20 +00:00
|
|
|
isSecondary
|
2020-08-03 16:38:57 +00:00
|
|
|
onClick={ () => this.recordOrderEvent( 'learn_more' ) }
|
2019-04-15 07:06:34 +00:00
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
{ __( 'Learn more', 'woocommerce-admin' ) }
|
|
|
|
</Button>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{ __(
|
|
|
|
"You're still waiting for your customers to make their first orders. " +
|
|
|
|
'While you wait why not learn how to manage orders?',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</ActivityCard>
|
2019-03-13 17:14:02 +00:00
|
|
|
);
|
2019-04-15 07:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
renderOrders() {
|
|
|
|
const { orders } = this.props;
|
2020-04-02 21:54:38 +00:00
|
|
|
const Currency = this.context;
|
2019-04-15 07:06:34 +00:00
|
|
|
|
|
|
|
if ( orders.length === 0 ) {
|
|
|
|
return this.renderEmptyCard();
|
|
|
|
}
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
const getCustomerString = ( order ) => {
|
|
|
|
const extendedInfo = order.extended_info || {};
|
2020-02-25 01:18:52 +00:00
|
|
|
const { first_name: firstName, last_name: lastName } =
|
|
|
|
extendedInfo.customer || {};
|
2019-04-15 07:06:34 +00:00
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
if ( ! firstName && ! lastName ) {
|
2019-04-15 07:06:34 +00:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
const name = [ firstName, lastName ].join( ' ' );
|
2019-04-15 07:06:34 +00:00
|
|
|
return sprintf(
|
|
|
|
__(
|
|
|
|
/* translators: describes who placed an order, e.g. Order #123 placed by John Doe */
|
|
|
|
'placed by {{customerLink}}%(customerName)s{{/customerLink}}',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
{
|
|
|
|
customerName: name,
|
|
|
|
}
|
|
|
|
);
|
2018-11-30 22:13:05 +00:00
|
|
|
};
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
const orderCardTitle = ( order ) => {
|
2020-02-25 01:18:52 +00:00
|
|
|
const {
|
|
|
|
extended_info: extendedInfo,
|
|
|
|
order_id: orderId,
|
|
|
|
order_number: orderNumber,
|
|
|
|
} = order;
|
2020-02-14 02:23:21 +00:00
|
|
|
const { customer } = extendedInfo || {};
|
2019-04-15 07:06:34 +00:00
|
|
|
const customerUrl = customer.customer_id
|
|
|
|
? getNewPath( {}, '/analytics/customers', {
|
|
|
|
filter: 'single_customer',
|
|
|
|
customers: customer.customer_id,
|
2020-02-14 02:23:21 +00:00
|
|
|
} )
|
2019-04-15 07:06:34 +00:00
|
|
|
: null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{ interpolateComponents( {
|
|
|
|
mixedString: sprintf(
|
|
|
|
__(
|
|
|
|
'Order {{orderLink}}#%(orderNumber)s{{/orderLink}} %(customerString)s {{destinationFlag/}}',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
{
|
2020-02-14 02:23:21 +00:00
|
|
|
orderNumber,
|
2019-04-15 07:06:34 +00:00
|
|
|
customerString: getCustomerString( order ),
|
|
|
|
}
|
|
|
|
),
|
|
|
|
components: {
|
2019-11-22 17:07:26 +00:00
|
|
|
orderLink: (
|
|
|
|
<Link
|
2020-02-14 02:23:21 +00:00
|
|
|
href={ getAdminLink(
|
|
|
|
'post.php?action=edit&post=' + orderId
|
|
|
|
) }
|
2020-08-03 16:38:57 +00:00
|
|
|
onClick={ () =>
|
|
|
|
this.recordOrderEvent( 'order_number' )
|
|
|
|
}
|
2019-11-22 17:07:26 +00:00
|
|
|
type="wp-admin"
|
|
|
|
/>
|
|
|
|
),
|
2019-04-15 07:06:34 +00:00
|
|
|
destinationFlag: customer.country ? (
|
2020-02-14 02:23:21 +00:00
|
|
|
<Flag
|
|
|
|
code={ customer.country }
|
|
|
|
round={ false }
|
|
|
|
/>
|
2019-04-15 07:06:34 +00:00
|
|
|
) : null,
|
2020-02-14 02:23:21 +00:00
|
|
|
customerLink: customerUrl ? (
|
2020-08-03 16:38:57 +00:00
|
|
|
<Link
|
|
|
|
href={ customerUrl }
|
|
|
|
onClick={ () =>
|
|
|
|
this.recordOrderEvent( 'customer_name' )
|
|
|
|
}
|
|
|
|
type="wc-admin"
|
|
|
|
/>
|
2020-02-14 02:23:21 +00:00
|
|
|
) : (
|
|
|
|
<span />
|
|
|
|
),
|
2019-04-15 07:06:34 +00:00
|
|
|
},
|
|
|
|
} ) }
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const cards = [];
|
2020-02-14 02:23:21 +00:00
|
|
|
orders.forEach( ( order ) => {
|
|
|
|
const extendedInfo = order.extended_info || {};
|
2019-04-15 07:06:34 +00:00
|
|
|
const productsCount =
|
2020-02-14 02:23:21 +00:00
|
|
|
extendedInfo && extendedInfo.products
|
|
|
|
? extendedInfo.products.length
|
|
|
|
: 0;
|
2019-04-15 07:06:34 +00:00
|
|
|
|
2019-11-22 15:06:14 +00:00
|
|
|
const total = order.total_sales;
|
2019-04-15 07:06:34 +00:00
|
|
|
|
|
|
|
cards.push(
|
|
|
|
<ActivityCard
|
|
|
|
key={ order.order_id }
|
|
|
|
className="woocommerce-order-activity-card"
|
|
|
|
title={ orderCardTitle( order ) }
|
|
|
|
date={ order.date_created_gmt }
|
|
|
|
subtitle={
|
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{ sprintf(
|
2020-02-14 02:23:21 +00:00
|
|
|
_n(
|
|
|
|
'%d product',
|
|
|
|
'%d products',
|
|
|
|
productsCount,
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-04-15 07:06:34 +00:00
|
|
|
productsCount
|
|
|
|
) }
|
|
|
|
</span>
|
2020-06-17 23:33:40 +00:00
|
|
|
<span>{ Currency.formatAmount( total ) }</span>
|
2019-04-15 07:06:34 +00:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
actions={
|
|
|
|
<Button
|
2020-06-11 19:22:20 +00:00
|
|
|
isSecondary
|
2020-02-14 02:23:21 +00:00
|
|
|
href={ getAdminLink(
|
|
|
|
'post.php?action=edit&post=' + order.order_id
|
|
|
|
) }
|
2020-08-03 16:38:57 +00:00
|
|
|
onClick={ () =>
|
|
|
|
this.recordOrderEvent(
|
|
|
|
'orders_begin_fulfillment'
|
|
|
|
)
|
|
|
|
}
|
2019-04-15 07:06:34 +00:00
|
|
|
>
|
|
|
|
{ __( 'Begin fulfillment' ) }
|
|
|
|
</Button>
|
|
|
|
}
|
|
|
|
>
|
2020-02-14 02:23:21 +00:00
|
|
|
<OrderStatus
|
|
|
|
order={ order }
|
|
|
|
orderStatusMap={ getSetting( 'orderStatuses', {} ) }
|
|
|
|
/>
|
2019-04-15 07:06:34 +00:00
|
|
|
</ActivityCard>
|
|
|
|
);
|
|
|
|
} );
|
2018-11-30 22:13:05 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
2019-04-15 07:06:34 +00:00
|
|
|
{ cards }
|
2020-08-03 16:38:57 +00:00
|
|
|
<ActivityOutboundLink
|
|
|
|
href={ 'edit.php?post_type=shop_order' }
|
|
|
|
onClick={ () => this.recordOrderEvent( 'orders_manage' ) }
|
|
|
|
>
|
2019-04-15 07:06:34 +00:00
|
|
|
{ __( 'Manage all orders', 'woocommerce-admin' ) }
|
|
|
|
</ActivityOutboundLink>
|
2018-11-30 22:13:05 +00:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
render() {
|
|
|
|
const { orders, isRequesting, isError, orderStatuses } = this.props;
|
2018-07-09 15:46:31 +00:00
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
if ( isError ) {
|
|
|
|
if ( ! orderStatuses.length ) {
|
|
|
|
return (
|
|
|
|
<EmptyContent
|
|
|
|
title={ __(
|
|
|
|
"You currently don't have any actionable statuses. " +
|
|
|
|
'To display orders here, select orders that require further review in settings.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
actionLabel={ __( 'Settings', 'woocommerce-admin' ) }
|
2020-02-14 02:23:21 +00:00
|
|
|
actionURL={ getAdminLink(
|
|
|
|
'admin.php?page=wc-admin&path=/analytics/settings'
|
|
|
|
) }
|
2019-04-15 07:06:34 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2019-02-20 01:51:43 +00:00
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
const title = __(
|
|
|
|
'There was an error getting your orders. Please try again.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
);
|
|
|
|
const actionLabel = __( 'Reload', 'woocommerce-admin' );
|
|
|
|
const actionCallback = () => {
|
|
|
|
// @todo Add tracking for how often an error is displayed, and the reload action is clicked.
|
|
|
|
window.location.reload();
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<EmptyContent
|
|
|
|
title={ title }
|
|
|
|
actionLabel={ actionLabel }
|
|
|
|
actionURL={ null }
|
|
|
|
actionCallback={ actionCallback }
|
|
|
|
/>
|
|
|
|
</Fragment>
|
|
|
|
);
|
2019-02-20 01:51:43 +00:00
|
|
|
}
|
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
const title =
|
|
|
|
isRequesting || orders.length
|
|
|
|
? __( 'Orders', 'woocommerce-admin' )
|
2020-01-08 17:25:13 +00:00
|
|
|
: __( 'No orders to fulfill', 'woocommerce-admin' );
|
2018-11-30 20:45:44 +00:00
|
|
|
|
2018-07-16 16:28:26 +00:00
|
|
|
return (
|
2018-11-30 20:45:44 +00:00
|
|
|
<Fragment>
|
2019-06-17 08:09:59 +00:00
|
|
|
<ActivityHeader title={ title } />
|
2019-04-15 07:06:34 +00:00
|
|
|
<Section>
|
|
|
|
{ isRequesting ? (
|
|
|
|
<ActivityCardPlaceholder
|
|
|
|
className="woocommerce-order-activity-card"
|
|
|
|
hasAction
|
|
|
|
hasDate
|
|
|
|
lines={ 2 }
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
this.renderOrders()
|
|
|
|
) }
|
|
|
|
</Section>
|
2018-11-30 20:45:44 +00:00
|
|
|
</Fragment>
|
2018-07-16 16:28:26 +00:00
|
|
|
);
|
2019-04-15 07:06:34 +00:00
|
|
|
}
|
2018-06-07 16:05:22 +00:00
|
|
|
}
|
|
|
|
|
2018-07-09 15:46:31 +00:00
|
|
|
OrdersPanel.propTypes = {
|
2019-02-20 01:51:43 +00:00
|
|
|
orders: PropTypes.array.isRequired,
|
2018-11-30 16:12:34 +00:00
|
|
|
isError: PropTypes.bool,
|
|
|
|
isRequesting: PropTypes.bool,
|
2018-06-07 16:05:22 +00:00
|
|
|
};
|
|
|
|
|
2018-08-07 20:11:30 +00:00
|
|
|
OrdersPanel.defaultProps = {
|
2019-02-20 01:51:43 +00:00
|
|
|
orders: [],
|
2018-11-30 16:12:34 +00:00
|
|
|
isError: false,
|
|
|
|
isRequesting: false,
|
2018-08-07 20:11:30 +00:00
|
|
|
};
|
|
|
|
|
2020-04-02 21:54:38 +00:00
|
|
|
OrdersPanel.contextType = CurrencyContext;
|
|
|
|
|
2018-11-30 16:12:34 +00:00
|
|
|
export default compose(
|
2019-03-19 10:57:11 +00:00
|
|
|
withSelect( ( select, props ) => {
|
2019-04-15 07:06:34 +00:00
|
|
|
const { hasActionableOrders } = props;
|
2019-07-16 21:04:28 +00:00
|
|
|
const {
|
|
|
|
getItems,
|
|
|
|
getItemsTotalCount,
|
|
|
|
getItemsError,
|
|
|
|
isGetItemsRequesting,
|
|
|
|
getReportItems,
|
|
|
|
getReportItemsError,
|
|
|
|
isReportItemsRequesting,
|
|
|
|
} = select( 'wc-api' );
|
2020-03-25 03:20:17 +00:00
|
|
|
const { getSetting: getMutableSetting } = select( SETTINGS_STORE_NAME );
|
2019-10-07 11:51:25 +00:00
|
|
|
const {
|
|
|
|
woocommerce_actionable_order_statuses: orderStatuses = DEFAULT_ACTIONABLE_STATUSES,
|
2020-03-25 03:20:17 +00:00
|
|
|
} = getMutableSetting( 'wc_admin', 'wcAdminSettings', {} );
|
2019-03-19 10:57:11 +00:00
|
|
|
if ( ! orderStatuses.length ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
return {
|
|
|
|
orders: [],
|
|
|
|
isError: true,
|
|
|
|
isRequesting: false,
|
|
|
|
orderStatuses,
|
|
|
|
};
|
2019-03-19 10:57:11 +00:00
|
|
|
}
|
|
|
|
|
2019-07-17 18:36:32 +00:00
|
|
|
if ( hasActionableOrders ) {
|
|
|
|
// Query the core Orders endpoint for the most up-to-date statuses.
|
|
|
|
const actionableOrdersQuery = {
|
|
|
|
page: 1,
|
|
|
|
per_page: QUERY_DEFAULTS.pageSize,
|
|
|
|
status: orderStatuses,
|
|
|
|
_fields: [ 'id', 'date_created_gmt', 'status' ],
|
|
|
|
};
|
2020-02-14 02:23:21 +00:00
|
|
|
const actionableOrders = Array.from(
|
|
|
|
getItems( 'orders', actionableOrdersQuery ).values()
|
|
|
|
);
|
|
|
|
const isRequestingActionable = isGetItemsRequesting(
|
|
|
|
'orders',
|
|
|
|
actionableOrdersQuery
|
|
|
|
);
|
2019-07-17 18:36:32 +00:00
|
|
|
|
|
|
|
if ( isRequestingActionable ) {
|
|
|
|
return {
|
2020-02-14 02:23:21 +00:00
|
|
|
isError: Boolean(
|
|
|
|
getItemsError( 'orders', actionableOrdersQuery )
|
|
|
|
),
|
2019-07-17 18:36:32 +00:00
|
|
|
isRequesting: isRequestingActionable,
|
|
|
|
orderStatuses,
|
|
|
|
};
|
|
|
|
}
|
2019-07-16 21:04:28 +00:00
|
|
|
|
|
|
|
// Retrieve the Order stats data from our reporting table.
|
2019-04-15 07:06:34 +00:00
|
|
|
const ordersQuery = {
|
|
|
|
page: 1,
|
|
|
|
per_page: QUERY_DEFAULTS.pageSize,
|
|
|
|
extended_info: true,
|
2019-07-16 21:04:28 +00:00
|
|
|
order_includes: map( actionableOrders, 'id' ),
|
2020-03-27 19:01:19 +00:00
|
|
|
_fields: [
|
|
|
|
'order_id',
|
|
|
|
'order_number',
|
|
|
|
'status',
|
|
|
|
'data_created_gmt',
|
|
|
|
'total_sales',
|
|
|
|
'extended_info.customer',
|
|
|
|
'extended_info.products',
|
|
|
|
],
|
2019-04-15 07:06:34 +00:00
|
|
|
};
|
|
|
|
|
2019-07-17 15:56:59 +00:00
|
|
|
const reportOrders = getReportItems( 'orders', ordersQuery ).data;
|
2020-02-14 02:23:21 +00:00
|
|
|
const isError = Boolean(
|
|
|
|
getReportItemsError( 'orders', ordersQuery )
|
|
|
|
);
|
|
|
|
const isRequesting = isReportItemsRequesting(
|
|
|
|
'orders',
|
|
|
|
ordersQuery
|
|
|
|
);
|
2019-07-17 15:56:59 +00:00
|
|
|
let orders = [];
|
|
|
|
|
|
|
|
if ( reportOrders && reportOrders.length ) {
|
|
|
|
// Merge the core endpoint data with our reporting table.
|
|
|
|
const actionableOrdersById = keyBy( actionableOrders, 'id' );
|
2020-02-14 02:23:21 +00:00
|
|
|
orders = reportOrders.map( ( order ) =>
|
|
|
|
merge(
|
|
|
|
{},
|
|
|
|
order,
|
|
|
|
actionableOrdersById[ order.order_id ] || {}
|
|
|
|
)
|
2019-07-17 15:56:59 +00:00
|
|
|
);
|
|
|
|
}
|
2019-04-15 07:06:34 +00:00
|
|
|
|
|
|
|
return { orders, isError, isRequesting, orderStatuses };
|
2019-03-19 10:57:11 +00:00
|
|
|
}
|
|
|
|
|
2019-07-17 18:36:32 +00:00
|
|
|
// Get a count of all orders for messaging purposes.
|
2019-10-07 11:51:25 +00:00
|
|
|
// @todo Add a property to settings api for this?
|
2019-07-17 18:36:32 +00:00
|
|
|
const allOrdersQuery = {
|
|
|
|
page: 1,
|
|
|
|
per_page: 1,
|
|
|
|
_fields: [ 'id' ],
|
|
|
|
};
|
|
|
|
|
|
|
|
getItems( 'orders', allOrdersQuery );
|
2020-02-14 02:23:21 +00:00
|
|
|
const totalNonActionableOrders = getItemsTotalCount(
|
|
|
|
'orders',
|
|
|
|
allOrdersQuery
|
|
|
|
);
|
2019-07-16 21:04:28 +00:00
|
|
|
const isError = Boolean( getItemsError( 'orders', allOrdersQuery ) );
|
|
|
|
const isRequesting = isGetItemsRequesting( 'orders', allOrdersQuery );
|
2018-11-30 16:12:34 +00:00
|
|
|
|
2019-04-15 07:06:34 +00:00
|
|
|
return {
|
|
|
|
hasNonActionableOrders: totalNonActionableOrders > 0,
|
|
|
|
isError,
|
|
|
|
isRequesting,
|
|
|
|
orderStatuses,
|
|
|
|
};
|
2018-11-30 16:12:34 +00:00
|
|
|
} )
|
|
|
|
)( OrdersPanel );
|