<?php 
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_Marketplace
 * @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);
$profile_hint_status = $helper->getProfileHintStatus();
?>
<div class="field required" id="wantptr">
    <label for="wantpartner" class="label"><?= $block->escapeHtml(__('Do You Want To Become A Seller / Vendor?')) ?> </label>
    <?php
    if ($profile_hint_status && $helper->getProfileHintBecomeSeller()) {?>
        <img src="<?= /* @noEscape */ $this->getViewFileUrl('Webkul_Marketplace::images/quest.png'); ?>" class='questimg' title="<?= $block->escapeHtml($helper->getProfileHintBecomeSeller()) ?>"/>
        <?php
    } ?>    
    <div class="control">
        <input type="radio" id="wantpartner" class="wantpartner" name="is_seller" value='1' title="<?= $block->escapeHtml(__('Agree as Seller')) ?>"  /> <?= $block->escapeHtml(__("Yes")); ?>&nbsp;&nbsp;
        <input type="radio" id="wantpartner0" class="wantpartner" name="is_seller" value='0' title="<?= $block->escapeHtml(__('Disagree as Seller')) ?>" checked /> <?= $block->escapeHtml(__("No")); ?>
    </div>
</div>
<div id="seller-shop-field-wrapper"> 
    <script id="wantptr-template" type="text/x-magento-template">
        <div id="<%- data.id %>" class="profileurl field required">
            <label class="label">
                <%- data.label %>
                <?php
                if ($helper->getProfileHintStatus() && $helper->getProfileHintShopurl()) {?>
                    <img src="<?= /* @noEscape */ $this->getViewFileUrl('Webkul_Marketplace::images/quest.png'); ?>" class='questimg' title="<?= /* @noEscape */ $helper->getProfileHintShopurl()?>"/>
                    <?php
                } ?>
            </label>
            <div class="control" id="wk-mp-become-seller-box-wrapper" data-role="wk-mp-become-seller-box-wrapper">
                <input type="text" class="input-text required-entry" name="profileurl" id="profileurl" data-role="shop-url" placeholder="<%- data.title %>" title="<%- data.title %>" value=""/>
                <div id="wk-load" class="no-display">
                    <img height="16px" width="16px" src="<%- data.src %>" />
                </div>
                <span class="required-entry" type="text"> 
                    <%- data.text %>
                </span>
            </div>

            <div id="wk-load" class="no-display">
                <img height="16px" width="16px" src="<%- data.src %>" />
            </div>
        </div>
    </script>
</div>
<?php
$shopurl_hint = '';
if ($profile_hint_status && $helper->getProfileHintShopurl()) {
    $shopurl_hint = '<img src="'.$this->getViewFileUrl('Webkul_Marketplace::images/quest.png').'" class="questimg" title="'.$helper->getProfileHintShopurl().'"/>';

} else {
    $shopurl_hint = '';
} ?>

<?php
$formData = [
    'ajaxSaveUrl' => $block->getUrl("marketplace/seller/usernameverify", ["_secure" => $this->getRequest()->isSecure()]),
    'successMessage' => __("Congratulations! Shop name is available."),
    'errorMessage' => __("Sorry! But this shop name is not available, please set another shop name."),
    'loaderImage' => $this->getViewFileUrl('Webkul_Marketplace::images/ajax-loader-tr.gif'),
    'button' => 'button.submit'
];
$serializedFormData = $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($formData);
?>

<script type="text/x-magento-init">
    {
        "#form-validate": {
            "verifySellerShop": <?= /* @noEscape */ $serializedFormData; ?>
        }
    }
</script>
