<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Advanced Reports Base for Magento 2
 */-->

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"
    class="Amasty\Reports\Ui\Component\Listing">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">amasty_report_sales_overview_listing.amasty_report_sales_overview_listing_data_source</item>
            <item name="deps" xsi:type="string">amasty_report_sales_overview_listing.amasty_report_sales_overview_listing_data_source</item>
        </item>
        <item name="spinner" xsi:type="string">amreports_sales_overview_columns</item>
    </argument>
    <dataSource name="amasty_report_sales_overview_listing_data_source">
        <argument name="dataProvider" xsi:type="configurableObject">
            <argument name="class" xsi:type="string">Amasty\Reports\Ui\DataProvider\Listing\Sales\DataProvider</argument>
            <argument name="name" xsi:type="string">amasty_report_sales_overview_listing_data_source</argument>
            <argument name="primaryFieldName" xsi:type="string">entity_id</argument>
            <argument name="requestFieldName" xsi:type="string">id</argument>
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="update_url" xsi:type="url" path="mui/index/render"/>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                    <item name="amreports_reload" xsi:type="boolean">true</item>
                    <item name="storageConfig" xsi:type="array">
                        <item name="cacheRequests" xsi:type="boolean">false</item>
                    </item>
                </item>
            </argument>
        </argument>
    </dataSource>
    <listingToolbar name="listing_top">
        <bookmark name="bookmarks"/>
        <columnsControls name="columns_controls"/>
        <component name="reports_export_button" class="Magento\Ui\Component\ExportButton">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="selectProvider" xsi:type="string">amasty_report_sales_overview_listing.amasty_report_sales_overview_listing.amreports_sales_overview_columns.ids</item>
                    <item name="component" xsi:type="string">Amasty_Reports/js/grid/export</item>
                    <item name="displayArea" xsi:type="string">dataGridActions</item>
                    <item name="options" xsi:type="array">
                        <item name="cvs" xsi:type="array">
                            <item name="value" xsi:type="string">csv</item>
                            <item name="label" xsi:type="string" translate="true">CSV</item>
                            <item name="url" xsi:type="string">amasty_reports/report_sales_overview/ExportGridToCsv</item>
                        </item>
                        <item name="xml" xsi:type="array">
                            <item name="value" xsi:type="string">xml</item>
                            <item name="label" xsi:type="string" translate="true">Excel XML</item>
                            <item name="url" xsi:type="string">amasty_reports/report_sales_overview/ExportGridToXml</item>
                        </item>
                    </item>
                </item>
            </argument>
        </component>
        <paging name="listing_paging"/>
        <radioset name="radioset">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="elementTmpl" xsi:type="string">Amasty_Reports/grid/sales/checkbox-set</item>
                    <item name="template" xsi:type="string">Amasty_Reports/grid/sales/checkbox-set</item>
                    <item name="component" xsi:type="string">Amasty_Reports/js/form/element/checkbox-set</item>
                    <item name="displayArea" xsi:type="string">dataGridActions</item>
                    <item name="prefer" xsi:type="string">toggle</item>
                    <item name="options" xsi:type="array">
                        <item name="0" xsi:type="array">
                            <item name="label" xsi:type="string">Value</item>
                            <item name="value" xsi:type="string">0</item>
                        </item>
                        <item name="1" xsi:type="array">
                            <item name="label" xsi:type="string">Percent, %</item>
                            <item name="value" xsi:type="string">1</item>
                        </item>
                    </item>
                </item>
            </argument>
        </radioset>
    </listingToolbar>
    <columns name="amreports_sales_overview_columns">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Amasty_Reports/js/grid/sales/listing</item>
                <item name="template" xsi:type="string">Amasty_Reports/grid/sales/listing_with_total</item>
                <item name="childDefaults" xsi:type="array">
                    <item name="footerTmpl" xsi:type="string">Amasty_Reports/grid/sales/columns/total</item>
                </item>
                <item name="imports" xsi:type="array">
                    <item name="totals" xsi:type="string">${ $.provider }:data.totals</item>
                </item>
            </item>
        </argument>

        <selectionsColumn name="ids">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">period</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </selectionsColumn>

        <column name="period">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Period</item>
                </item>
            </argument>
        </column>
        <column name="total_orders">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Number of Orders</item>
                </item>
            </argument>
        </column>
        <column name="percent_total_orders">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Number of Orders, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="total_items">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Items Ordered</item>
                </item>
            </argument>
        </column>
        <column name="percent_total_items">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Items Ordered, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="subtotal" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Subtotal</item>
                </item>
            </argument>
        </column>
        <column name="percent_subtotal">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Subtotal, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="tax" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Tax</item>
                </item>
            </argument>
        </column>
        <column name="percent_tax">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Tax, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="shipping" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Shipping</item>
                </item>
            </argument>
        </column>
        <column name="percent_shipping">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Shipping, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="discounts" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Discounts</item>
                </item>
            </argument>
        </column>
        <column name="percent_discounts">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Discounts, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="total" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Total</item>
                </item>
            </argument>
        </column>
        <column name="percent_total">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Total, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="invoiced" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Invoiced</item>
                </item>
            </argument>
        </column>
        <column name="percent_invoiced">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Invoiced, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="refunded" class="Amasty\Reports\Ui\Component\Listing\Column\Price">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Refunded</item>
                </item>
            </argument>
        </column>
        <column name="percent_refunded">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Refunded, %</item>
                    <item name="visible" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>
