<?php
/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
?>
<div class="wtai-store-scope store-switcher store-view" data-bind="scope: 'wtaiStoreScope'">
    <span class="store-switcher-label">
        <?= $block->escapeHtml(__('Scope')) ?>:
    </span>
    <div class="dropdown">
        <button type="button" class="admin__action-dropdown" data-bind="text: storeName" data-role="title"></button>
        <ul class="dropdown-menu" data-role="content">
            <li class="store-switcher-all" data-bind="css: {
                'disabled': isCurrent()
            }">
                <!-- ko if: isCurrent() -->
                <span data-bind="text: allStoreViews"></span>
                <!-- /ko -->
                <!-- ko ifnot: isCurrent() -->
                <a href="#" data-bind="
                    text: allStoreViews,
                    attr: { 'data-value': allStoreViewsValue }
                "></a>
                <!-- /ko -->
            </li>
            <!-- ko foreach: { data: storesAvailable, as: 'website' } -->
            <li class="store-switcher-website">
                <span data-bind="text: website.label"></span>
            </li>
                <!-- ko foreach: { data: website.value, as: 'store' } -->
                <li class="store-switcher-store">
                    <span data-bind="text: store.label"></span>
                </li>
                    <!-- ko foreach: { data: store.value, as: 'view' } -->
                    <li class="store-switcher-store-view" data-bind="css: {
                        'disabled': $parents[2].isCurrent(view.label),
                        'current': $parents[2].isCurrent(view.label)
                    }">
                        <!-- ko if: $parents[2].isCurrent(view.label) -->
                        <span data-bind="text: view.label"></span>
                        <!-- /ko -->
                        <!-- ko ifnot: $parents[2].isCurrent(view.label) -->
                        <a href="#" data-bind="
                            text: view.label,
                            attr: { 'data-value': view.value }
                        "></a>
                        <!-- /ko -->
                    </li>
                    <!-- /ko -->
                <!-- /ko -->
            <!-- /ko -->
        </ul>
    </div>
    <div class="wtai-edit-loading-mask"></div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiStoreScope": {
                        "component": "WriteTextAI_WriteTextAI/js/edit/store-scope"
                    }
                }
            }
        }
    }
</script>
