<?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
 */
?>
<?php
    $productCount = $block->getTotalCount();
    $profileId = $block->getProfileId();
    $sellerId = $block->getRequest()->getParam('seller_id');
    $postData = $block->getProductPostData($profileId, 1);
    $postData['seller_id'] = $sellerId;
    $postData['profile_id'] = $profileId;
    $postData['row'] = 1;
    $postData['total_row_count'] = $productCount;
    $sellerGroupUrl = $block->getUrl('mpmassupload/run/index');
    $data = [
            "importUrl" => $block->getUrl(
                'mpmassupload/product/run'
            ),
            "finishUrl" => $block->getUrl('mpmassupload/product/finish'),
            "productCount" => $productCount,
            "profileId" => $block->getProfileId(),
            "sellerId" => $block->getSellerId(),
            "completeLabel" => __("Completed"),
            "deleteLabel" => __("Deleting Profile"),
            "noProductImportLabel" => __("No Product Imported"),
            "postData" => $postData,
            'sellerGroupUrl' => $sellerGroupUrl
        ];
        $data = $block->jsonEncode($data);
    ?>
<fieldset class="fieldset">
    <div class="wk-mu-note wk-mu-box">
        <?= $block->escapeHtml(__("Starting Execution...")); ?>
    </div>
    <div class="wk-mu-notice wk-mu-box">
        <?= $block->escapeHtml(__("Please don't close or refresh the window while importing products.")); ?>
    </div>
    <div class="wk-mu-success wk-mu-box">
        <?= $block->escapeHtml(__("Total %1 Product(s) to import.", $productCount)); ?>
    </div>
    <?php if ($productCount > 0): ?>
        <div class="wk-mu-info-bar">
            <div class="wk-mu-importing-loader"></div>
            <div class="wk-mu-info-bar-content">
                <?= $block->escapeHtml(__("Importing")); ?>
                <span class="wk-current">1</span> of <?= $block->escapeHtml($productCount);?>
            </div>
        </div>
        <div class="wk-mu-progress-bar">
            <div class="wk-mu-progress-bar-current"></div>
        </div>
    <?php else: ?>
        <div class="wk-mu-note wk-mu-box">
            <?= $block->escapeHtml(__("No Product to import.")); ?>
        </div>
        <div class="wk-mu-note wk-mu-box">
            <?= $block->escapeHtml(__("Finsihed Execution.")); ?>
        </div>
    <?php endif; ?>
</fieldset>
<script type="text/x-magento-init">
    {
        "body": {
            "Webkul_MpMassUpload/js/profile": <?= /* @noEscape */ $data ?>
        }
    }
</script>
