<?php
?>

<?php
$sellerBlock = $this->getLayout()->createBlock(
    \Webkul\Marketplace\Block\Adminhtml\Items\Column\Name\Seller::class
);
if ($_item = $block->getItem()): ?>
    <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div>
    <div class="product-sku-block">
        <span><?= $block->escapeHtml(__('SKU')) ?>:</span>
        <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($block->getSku())) ?>

        <!-- Marketplace seller Name -->
        <br/>
        <?php
            $userInfo = $sellerBlock->getUserInfo($_item->getProductId());
        if ($userInfo!='') { ?>
                <strong>
                    <?= $block->escapeHtml(__('By Seller')) ?>:
                </strong>
                <a href=<?= $block->escapeUrl($sellerBlock->getCustomerUrl($userInfo['id']));?>>
                    <?= $block->escapeHtml($userInfo['name'])?>
                </a>
                <?php
        } ?>
        <!-- end -->
    </div>
    <?php if ($block->getOrderOptions()): ?>
        <dl class="item-options">
        <?php foreach ($block->getOrderOptions() as $_option): ?>
            <dt><?= $block->escapeHtml($_option['label']) ?>:</dt>
            <dd>
            <?php if (isset($_option['custom_view']) && $_option['custom_view']): ?>
                <?= $block->escapeHtml($_option['value']) ?>
            <?php else: ?>
                <?= $block->escapeHtml($block->truncateString($_option['value'], 55, '', $_remainder)) ?>
                <?php if ($_remainder):?>
                    ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span>
                    <script>
                        require(['prototype'], function(){
                            <?php $escapedId = $block->escapeJs($_id) ?>
                            $('<?= /* @noEscape */ $escapedId ?>').hide();
                            $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();});
                            $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout',  function(){$('<?= /* @noEscape */ $escapedId ?>').hide();});
                        });
                    </script>
                <?php endif;?>
            <?php endif;?>
            </dd>
        <?php endforeach; ?>
        </dl>
    <?php endif; ?>
    <?php if ($block->getLinks()): ?>
        <dl class="item-options">
            <dt><?= $block->escapeHtml($block->getLinksTitle()) ?>:</dt>
            <?php foreach ($block->getLinks()->getPurchasedItems() as $_link): ?>
                <dd><?= $block->escapeHtml($_link->getLinkTitle()) ?> (<?= $block->escapeHtml($_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought() ? $_link->getNumberOfDownloadsBought() : __('U'))) ?>)</dd>
            <?php endforeach; ?>
        </dl>
    <?php endif; ?>
    <?= $block->escapeHtml($_item->getDescription()) ?>
<?php endif; ?>
