<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/* @var $block \Magento\Sales\Block\Adminhtml\Order\Create\Store\Select */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<div class="store-scope form-inline">
    <div class="admin__fieldset tree-store-scope">
        <?php $showHelpHint = 0; ?>
        <?php foreach ($block->getWebsiteCollection() as $_website): ?>
            <?php $showWebsite = false; ?>
            <?php foreach ($block->getGroupCollection($_website) as $_group): ?>
                <?php $showGroup = false; ?>
                <?php foreach ($block->getStoreCollection($_group) as $_store): ?>
                    <?php if ($showWebsite == false): ?>
                        <?php $showWebsite = true; ?>
                        <div class="admin__field field-website_label">
                            <label class="admin__field-label" for="">
                                <span><?= $block->escapeHtml($_website->getName()) ?></span>
                            </label>
                            <div class="admin__field-control">
                                <div class="admin__field admin__field-option">
                                    <?php if ($showHelpHint == 0): $showHelpHint = 1;  ?>
                                        <?= $block->getHintHtml(); ?>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if ($showGroup == false): ?>
                        <?php $showGroup = true; ?>
                        <div class="admin__field field-group_label">
                            <label class="admin__field-label" for="">
                                <span><?= $block->escapeHtml($_group->getName()) ?></span>
                            </label>
                            <div class="admin__field-control"></div>
                        </div>
                    <?php endif; ?>

                    <div class="admin__field field-store_label">
                        <label class="admin__field-label" for="">
                            <span><?= $block->escapeHtml($_group->getName()) ?></span>
                        </label>
                        <div class="admin__field-control">
                            <div class="nested">
                                <div class="admin__field admin__field-option">
                                    <input type="radio"
                                           id="store_<?= (int) $_store->getId() ?>" 
                                           class="admin__control-radio select-store-radio" 
                                           value="<?= (int) $_store->getId() ?>"/>
                                    <label class="admin__field-label" for="store_<?= (int) $_store->getId() ?>">
                                        <?= $block->escapeHtml($_store->getName()) ?>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
                <?php if ($showGroup): ?>
                <?php endif; ?>
            <?php endforeach; ?>
        <?php endforeach; ?>
    </div>
</div>
