<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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">inventory_stock_listing.inventory_stock_listing_data_stock</item>
        </item>
    </argument>
    <settings>
        <buttons>
            <button name="add" class="Magento\InventoryAdminUi\Ui\Component\Listing\Stock\Buttons\NewButton"/>
        </buttons>
        <spinner>inventory_stock_listing_columns</spinner>
        <deps>
            <dep>inventory_stock_listing.inventory_stock_listing_data_stock</dep>
        </deps>
    </settings>
    <dataSource name="inventory_stock_listing_data_stock" component="Magento_Ui/js/grid/provider">
        <settings>
            <storageConfig>
                <param name="indexField" xsi:type="string">stock_id</param>
            </storageConfig>
            <updateUrl path="mui/index/render"/>
        </settings>
        <aclResource>Magento_InventoryApi::stock</aclResource>
        <dataProvider class="Magento\InventoryAdminUi\Ui\DataProvider\StockDataProvider" name="inventory_stock_listing_data_stock">
            <settings>
                <requestFieldName>id</requestFieldName>
                <primaryFieldName>stock_id</primaryFieldName>
            </settings>
        </dataProvider>
    </dataSource>
    <listingToolbar name="listing_top">
        <settings>
            <sticky>true</sticky>
        </settings>
        <bookmark name="bookmarks"/>
        <columnsControls name="columns_controls"/>
        <filterSearch name="name"/>
        <filters name="listing_filters">
            <settings>
                <templates>
                    <filters>
                        <select>
                            <param name="template" xsi:type="string">ui/grid/filters/elements/ui-select</param>
                            <param name="component" xsi:type="string">Magento_Ui/js/form/element/ui-select</param>
                        </select>
                    </filters>
                </templates>
            </settings>
        </filters>
        <massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions" class="Magento\InventoryAdminUi\Ui\Component\Listing\Stock\MassAction">
            <action name="delete">
                <settings>
                    <confirm>
                        <message translate="true">Delete selected items?</message>
                        <title translate="true">Delete items</title>
                    </confirm>
                    <url path="inventory/stock/massDelete"/>
                    <type>delete</type>
                    <label translate="true">Delete</label>
                </settings>
            </action>
        </massaction>
        <paging name="listing_paging"/>
    </listingToolbar>
    <columns name="inventory_stock_listing_columns" class="Magento\InventoryAdminUi\Ui\Component\Listing\Stock\Columns">
        <settings>
            <editorConfig>
                <param name="clientConfig" xsi:type="array">
                    <item name="saveUrl" xsi:type="url" path="inventory/stock/inlineEdit"/>
                    <item name="validateBeforeSave" xsi:type="boolean">false</item>
                </param>
                <param name="indexField" xsi:type="string">stock_id</param>
                <param name="enabled" xsi:type="boolean">true</param>
                <param name="selectProvider" xsi:type="string">inventory_stock_listing.inventory_stock_listing.inventory_stock_listing_columns.ids</param>
            </editorConfig>
            <childDefaults>
                <param name="fieldAction" xsi:type="array">
                    <item name="provider" xsi:type="string">inventory_stock_listing.inventory_stock_listing.inventory_stock_listing_columns_editor</item>
                    <item name="target" xsi:type="string">startEdit</item>
                    <item name="params" xsi:type="array">
                        <item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
                        <item name="1" xsi:type="boolean">true</item>
                    </item>
                </param>
            </childDefaults>
        </settings>
        <selectionsColumn name="ids" sortOrder="10">
            <settings>
                <indexField>stock_id</indexField>
            </settings>
        </selectionsColumn>
        <column name="stock_id" sortOrder="20">
            <settings>
                <filter>textRange</filter>
                <label translate="true">ID</label>
                <sorting>asc</sorting>
            </settings>
        </column>
        <column name="name" sortOrder="30">
            <settings>
                <filter>text</filter>
                <label translate="true">Name</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">true</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <column name="assigned_sources"
                component="Magento_InventoryAdminUi/js/stock/grid/cell/assigned-sources"
                sortOrder="40">
            <settings>
                <label translate="true">Assigned Sources</label>
                <sortable>false</sortable>
            </settings>
        </column>
        <actionsColumn name="actions" class="Magento\InventoryAdminUi\Ui\Component\Listing\Stock\Column\EditAction" sortOrder="100">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="editUrlPath" xsi:type="string">inventory/stock/edit</item>
                </item>
            </argument>
            <settings>
                <indexField>stock_id</indexField>
            </settings>
        </actionsColumn>
    </columns>
</listing>
