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

/** @var $block \Magento\Backend\Block\Page\Header */
$part = $block->getShowPart();
?>
<?php if ($part === 'logo') : ?>
        <?php $edition = $block->hasEdition() ? 'data-edition="' . $block->escapeHtml($block->getEdition()) . '"' : ''; ?>
        <?php $logoSrc = ($block->hasLogoImageSrc()) ? $block->escapeHtml($block->getLogoImageSrc()) : 'images/magento-logo.svg' ?>
        <a
            href="<?= $block->escapeUrl($block->getHomeLink()) ?>"
            <?= /* @noEscape */ $edition ?>
            class="logo">
            <img class="logo-img" src="<?= /* @noEscape */ $block->getViewFileUrl($logoSrc) ?>"
            alt="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>" title="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>"/>
        </a>
<?php elseif ($part === 'user') : ?>
        <div class="admin-user admin__action-dropdown-wrap">
            <a
                href="<?= /* @noEscape */ $block->getUrl('adminhtml/system_account/index') ?>"
                class="admin__action-dropdown"
                title="<?= $block->escapeHtml(__('My Account')) ?>"
                data-mage-init='{"dropdown":{}}'
                data-toggle="dropdown">
                <span class="admin__action-dropdown-text">
                    <span class="admin-user-account-text"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>
                </span>
            </a>
            <ul class="admin__action-dropdown-menu">
                <?php if ($block->getAuthorization()->isAllowed('Magento_Backend::myaccount')) : ?>
                <li>
                    <a
                        href="<?= /* @noEscape */ $block->getUrl('adminhtml/system_account/index') ?>"
                        <?= /* @noEscape */ $block->getUiId('user', 'account', 'settings') ?>
                        title="<?= $block->escapeHtml(__('Account Setting')) ?>">
                        <?= $block->escapeHtml(__('Account Setting')) ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>)
                    </a>
                </li>
                <?php endif; ?>
                <li>
                    <a
                        href="<?= /* @noEscape */ $block->getBaseUrl() ?>"
                        title="<?= $block->escapeHtml(__('Customer View')) ?>"
                        target="_blank" class="store-front">
                        <?= $block->escapeHtml(__('Customer View')) ?>
                    </a>
                </li>
                <li>
                    <a
                        href="<?= /* @noEscape */ $block->getLogoutLink() ?>"
                        class="account-signout"
                        title="<?= $block->escapeHtml(__('Sign Out')) ?>">
                        <?= $block->escapeHtml(__('Sign Out')) ?>
                    </a>
                </li>
            </ul>
        </div>

<?php elseif ($part === 'other') : ?>
    <?= $block->getChildHtml() ?>
<?php endif; ?>
