/** @format */ /** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Component, Fragment } from '@wordpress/element'; import { compose } from '@wordpress/compose'; import { Button } from '@wordpress/components'; import { withSelect, withDispatch } from '@wordpress/data'; import moment from 'moment'; import { partial } from 'lodash'; /** * Internal dependencies */ import Header from 'layout/header/index'; import Card from 'components/card'; import DatePicker from 'components/date-picker'; import FilterPicker, { FILTER_PARAM } from 'components/filter-picker'; import AdvancedFilters from 'components/advanced-filters'; import { filters, filterPaths, advancedFilterConfig } from './constants'; import './style.scss'; class OrdersReport extends Component { constructor( props ) { super( props ); this.toggleStatus = this.toggleStatus.bind( this ); } toggleStatus( order ) { const { requestUpdateOrder } = this.props; const updatedOrder = { ...order }; const status = updatedOrder.status === 'completed' ? 'processing' : 'completed'; updatedOrder.status = status; requestUpdateOrder( updatedOrder ); } render() { const { orders, orderIds, query, path } = this.props; return (
{ 'advanced' === query[ FILTER_PARAM ] && ( ) }

Below is a temporary example

{ orderIds && orderIds.map( id => { const order = orders[ id ]; return ( ); } ) }
Id Date Total Status Action
{ id } { moment( order.date_created ).format( 'LL' ) } { order.total } { order.status }
); } } export default compose( withSelect( select => { const { getOrders, getOrderIds } = select( 'wc-admin' ); return { orders: getOrders(), orderIds: getOrderIds(), }; } ), withDispatch( dispatch => { return { requestUpdateOrder: function( updatedOrder ) { dispatch( 'wc-admin' ).requestUpdateOrder( updatedOrder ); }, }; } ) )( OrdersReport );