<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">filoblu_change_size_items_listing.filoblu_change_size_items_listing_data_source</item>
            <item name="deps" xsi:type="string">filoblu_change_size_items_listing.filoblu_change_size_items_listing_data_source</item>
        </item>
        <item name="spinner" xsi:type="string">spinner_columns</item>
    </argument>
    <dataSource name="filoblu_change_size_items_listing_data_source">
        <argument name="dataProvider" xsi:type="configurableObject">
            <argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
            <argument name="name" xsi:type="string">filoblu_change_size_items_listing_data_source</argument>
            <argument name="primaryFieldName" xsi:type="string">item_id</argument>
            <argument name="requestFieldName" xsi:type="string">item_id</argument>
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                    <item name="update_url" xsi:type="url" path="mui/index/render"/>
                    <item name="storageConfig" xsi:type="array">
                        <item name="indexField" xsi:type="string">item_id</item>
                    </item>
                </item>
            </argument>
        </argument>
    </dataSource>
    <listingToolbar name="listing_top">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="sticky" xsi:type="boolean">true</item>
            </item>
        </argument>
        <bookmark name="bookmarks"/>
        <columnsControls name="columns_controls"/>
        <exportButton name="export_button"/>
        <filters name="listing_filters" />
        <paging name="listing_paging"/>
    </listingToolbar>
    <columns name="spinner_columns">
        <column name="parent_order_increment_id" class="FiloBlu\Rma\Ui\Component\Listing\Columns\ChangeSizeItems\ParentOrderIncrementId" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                    <item name="filter" xsi:type="string">text</item>
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="label" xsi:type="string" translate="true">Parent Order</item>
                    <item name="sortOrder" xsi:type="number">3</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="rma_increment_id" class="FiloBlu\Rma\Ui\Component\Listing\Columns\ChangeSizeItems\RmaIncrementId" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                    <item name="filter" xsi:type="string">text</item>
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="label" xsi:type="string" translate="true">RMA</item>
                    <item name="sortOrder" xsi:type="number">5</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="parent_product_sku" component="Magento_Ui/js/grid/columns/column" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="label" xsi:type="string" translate="true">Parent Product SKU</item>
                    <item name="sortOrder" xsi:type="number">7</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="new_product_sku" component="Magento_Ui/js/grid/columns/column" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="label" xsi:type="string" translate="true">New Product SKU</item>
                    <item name="sortOrder" xsi:type="number">8</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="change_size_order_increment_id" class="FiloBlu\Rma\Ui\Component\Listing\Columns\ChangeSizeItems\ChangeSizeOrderIncrementId" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                    <item name="filter" xsi:type="string">text</item>
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="label" xsi:type="string" translate="true">Change Size Order</item>
                    <item name="sortOrder" xsi:type="number">9</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                </item>
            </argument>
        </column>
        <column name="action" class="FiloBlu\Rma\Ui\Component\Listing\Columns\ChangeSizeItems\GenerateChangeSizeOrder">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/actions</item>
                    <item name="indexField" xsi:type="string">item_id</item>
                    <item name="label" xsi:type="string" translate="true">Action</item>
                    <item name="sortOrder" xsi:type="number">20</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                    <item name="actions" xsi:type="array">
                        <item name="edit" xsi:type="array">
                            <item name="type" xsi:type="string">edit</item>
                            <item name="label" xsi:type="string" translate="true">Generate CS Order</item>
                            <item name="url" xsi:type="boolean">false</item>
                            <item name="target" xsi:type="string">edit</item>
                            <item name="visible" xsi:type="boolean">true</item> <!-- Imposta la visibilità del pulsante basata sulla logica -->
                        </item>
                    </item>
                </item>
            </argument>
        </column>
    </columns>
</listing>
