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

/**
 * Favourite Sellers list display to customers
 *
 * @var $block \Webkul\Agorae\Block\FavouriteSellerList
 */

$collection = $block->getFavouriteSellerList();
$data = $collection->getData();
?>
<div class="wk-mp-design">
    <fieldset class="fieldset info wk-mp-fieldset">
        <legend class="legend">
            <span><?= /* @noEscape*/ __('My Favourite Sellers') ?></span>
        </legend>
        <div class="grid">
            <div class="hor-scroll">
                <form action="<?= /* @noEscape*/ $block->getCurrentSiteUrl()?>"
                method="get" id="form-productlist-filter"
                name="formFavouriteSellerFilter" data-mage-init='{"validation":{}}'>
                    <table cellspacing="0" class="border wk-mp-list-table">
                        <thead>
                            <tr id="wk-mp-tr-heading">
                                <th><span><?= /* @noEscape*/ __('Seller Name') ?></span></th>
                                <th><span>&nbsp;</span></th>
                            </tr>
                        </thead>
                        <tbody class="wk-mp-body">
                            <tr>
                                <td>
                                    <input type="text" class="input-text" name="s"
                                    placeholder='<?= /* @noEscape*/ __('search by seller name') ?>'
                                    value="<?= /* @noEscape*/ $block->getFilterParam() ?>"/>
                                </td>
                                <td>
                                    <button class="button" title="Save" type="submit">
                                        <span><span><span><?= /* @noEscape*/ __('Submit') ?></span></span></span>
                                    </button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </form>
                
                <?php if ($collection && !empty($collection->getSize())): ?>
                    <form action="<?= /* @noEscape*/ $block->getUrl('agorae/favouriteseller/massDelete', ['_secure' =>
                    $block->getRequest()->isSecure()])?>" 
                    method="post" id="form-favouriteseller-massdelete" 
                    name="formFavouriteSellerMassDelete" data-mage-init='{"validation":{}}'>
                        <?= /* @noEscape*/ $block->getBlockHtml('formkey')?>
                        <button class="button" title="<?= /* @noEscape*/ __('Delete Sellers') ?>"
                        type="submit" style="float: left;padding: 5px 5px 5px 0;" 
                        id="mass-delete-butn">
                            <span><span><?= /* @noEscape*/ __('Delete Sellers') ?></span></span>
                        </button>
                        <table cellspacing="0" class="border wk-mp-list-table wk-mp-list-container-table">
                            <thead>
                                <tr class="wk-content">
                                    <th class="wk-check-first-td">
                                        <span>
                                            <input type="checkbox" name="mpselecctall" value="all" id="mpselecctall"/>
                                        </span>
                                    </th>
                                    <th class="wk-first-td">
                                        <span class="label pro-status">
                                            <?= /* @noEscape*/ __('Seller')?>
                                        </span>
                                    </th>
                                    <th>
                                        <span class="label pro-status">
                                            <?= /* @noEscape*/ __('Name')?>
                                        </span>
                                    </th>
                                    <th>
                                        <span class="label pro-status">
                                            <?= /* @noEscape*/ __('Seller Collection')?>
                                        </span>
                                    </th>
                                    <th>
                                        <span class="label">
                                            <?= /* @noEscape*/ __('Action')?>
                                        </span>
                                    </th>                       
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $i = 0;
                                foreach ($data as $seller) {
                                    $i++;
                                    ?>
                                    <tr class="wk-row-view
                                    <?= /* @noEscape*/ $class =
                                    ($i == $collection->getSize())? 'wk-last_tr':''?>">
                                        <td class="wk-check-first-td">
                                            <span>
                                                <input type="checkbox" name="seller_mass_delete[]" 
                                                class="mpcheckbox" 
                                                value="<?= /* @noEscape*/ $seller['seller_id']; ?>"/>
                                            </span>
                                        </td>
                                        <td class="wk-first_td">
                                            <input type="hidden" class="hidden-id"
                                            value="<?= /* @noEscape*/ $seller['seller_id']; ?>" />
                                            <div class="label name">
                                                <div class="wk-pro-divide1">
                                                    <a href="<?= /* @noEscape*/
                                                    $block->getSellerProfileUrl($seller['shop_url']) ?>"
                                                    title="<?= /* @noEscape*/ $seller['shop_url'] ?>">
                                                        <img class="image" src="<?= /* @noEscape*/
                                                        $block->getSellerLogo($seller['logo_pic']) ?>"
                                                        alt="no-image">
                                                    </a>
                                                </div>
                                            </div>
                                        </td>
                                        <td>        
                                            <span class="label pro-status">
                                                <?= /* @noEscape*/ $block->getCustomerName($seller['seller_id'])?>
                                            </span>
                                        </td>
                                        <td>        
                                            <a href="<?= /* @noEscape*/
                                            $block->getSellerCollectionUrl($seller['shop_url'])?>">
                                            <?= /* @noEscape*/ __('Collection');?>
                                            </a>
                                        </td>
                                        <td>
                                            <span class="label wk-action">
                                                <img src="<?= /* @noEscape*/
                                                $block->getViewFileUrl('Webkul_Marketplace::images/icon-trash.png'); ?>"
                                                alt="<?= /* @noEscape*/ __('Delete')?>"
                                                title="<?= /* @noEscape*/ __('Delete')?>"
                                                class="mp-delete"
                                                data-url="<?= /* @noEscape*/$block->getUrl('agorae/favouriteseller/
                                                delete/', ['id'=>$seller['seller_id'], '_secure' => $block->
                                                getRequest()->isSecure()]) ?>"/>
                                            </span> 
                                        </td>                       
                                    </tr>
                                    <?php
                                } ?>
                            </tbody>
                        </table>
                    </form>                     
                <?php else: ?>
                    <div class="wk-emptymsg">
                        <?= /* @noEscape*/ __('No Favourite Seller Available') ?>
                    </div>
                <?php endif ?>                  
            </div>
        </div>
        <?php if ($block->getPagerHtml()): ?>
            <div class="order-products-toolbar toolbar bottom"><?= /* @noEscape*/ $block->getPagerHtml(); ?></div>
        <?php endif ?>  
    </fieldset> 
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "favouriteSellerList": {}
        }
    }
</script>
