<?php
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_MpMassUpload
 * @author    Webkul
 * @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */

$helper = $this->helper(\Webkul\Marketplace\Helper\Data::class);
$isPartner= $helper->isSeller();
$magentoCurrentUrl = $block->getCurrentUrl();
$allow_pro_type=$helper->getAllowedProductType();
$isSellerGroup = $helper->isSellerGroupModuleInstalled();
?>
<?php if ($isPartner): ?>
    <?php if (($isSellerGroup && ($helper->isAllowedAction('mpmassupload/product/view') ||
            $helper->isAllowedAction('mpmassupload/product/export') ||
            $helper->isAllowedAction('mpmassupload/dataflow/profile'))) ||
            !$isSellerGroup) { ?>
        <?php
        if ((strpos($magentoCurrentUrl, 'mpmassupload/product') === 1) ||
            (strpos($magentoCurrentUrl, 'mpmassupload/dataflow') === 1)) {
            $currentClass = "current active";
        } else {
            $currentClass = "";
        } ?>
        <li class="wk-mp-item-massupload level-0 <?= $block->escapeHtml($currentClass)?>" id="wk-mp-menu-massupload">
            <a href="#" onclick="return false;" class="">
                <span><?= $block->escapeHtml(__('Mass Upload'))?></span>
            </a>
            <div class="wk-mp-submenu">
                <strong class="wk-mp-submenu-title"><?= $block->escapeHtml(__('Mass Upload'))?></strong>
                <a href="#" class="action-close _close" data-role="wk-mp-close-submenu"></a>
                <ul>
                    <li data-ui-id="menu-webkul-massupload-menu" class="item-menu parent level-1">
                        <strong class="wk-mp-submenu-group-title">
                            <span><?= $block->escapeHtml(__('Menu'))?></span>
                        </strong>
                        <div class="wk-mp-submenu">
                            <ul>
                                <?php if (($isSellerGroup && $helper->isAllowedAction('mpmassupload/dataflow/profile'))
                                || !$isSellerGroup) {?>
                                        <li class="level-2">
                                            <a href="<?= $block->escapeHtml($block->getUrl(
                                                'mpmassupload/dataflow/profile',
                                                ['_secure' => $block->getRequest()->isSecure()]
                                            )); ?>">
                                                <span>
                                                        <?= $block->escapeHtml(__('Mass Upload Dataflow Profile'))?>
                                                </span>
                                            </a>
                                        </li>
                                <?php } ?>
                                <?php if (($isSellerGroup && $helper->isAllowedAction('mpmassupload/product/view')) ||
                                    !$isSellerGroup) { ?>
                                    <li class="level-2">
                                        <a href="<?= $block->escapeHtml($block->getUrl(
                                            'mpmassupload/product/view',
                                            ['_secure' => $block->getRequest()->isSecure()]
                                        )); ?>">
                                            <span><?= $block->escapeHtml(__('Mass Upload Product'))?></span>
                                        </a>
                                    </li>
                                <?php } ?>
                                <?php if (($isSellerGroup &&
                                $helper->isAllowedAction('mpmassupload/profilelisting/profilelist'))
                                || !$isSellerGroup) {?>
                                        <li class="level-2">
                                            <a href="<?= $block->escapeHtml($block->getUrl(
                                                'mpmassupload/profilelisting/profilelist',
                                                ['_secure' => $block->getRequest()->isSecure()]
                                            )); ?>">
                                                <span>
                                                    <?= $block->escapeHtml(__('Mass Upload Profile Listing'))?>
                                                </span>
                                            </a>
                                        </li>
                                <?php } ?>
                                <?php if (($isSellerGroup && $helper->isAllowedAction('mpmassupload/product/export')) ||
                                    !$isSellerGroup) { ?>
                                    <li class="level-2">
                                        <a href="<?= $block->escapeHtml($block->getUrl(
                                            'mpmassupload/product/export',
                                            ['_secure' => $block->getRequest()->isSecure()]
                                        )); ?>">
                                            <span><?= $block->escapeHtml(__('Mass Upload Product Export'))?></span>
                                        </a>
                                    </li>
                                <?php } ?>
                            </ul>
                        </div>
                    </li>
                </ul>
            </div>
        </li>
    <?php } ?>
<?php endif; ?>
