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

// @codingStandardsIgnoreFile

/**
 * Make a Review Form at seller Collection page
 *
 * @var $block \Webkul\Marketplace\Block\Feedbackcollection
 */

$partner = [];
$viewModel = $block->getData("viewModel");
$moduleManager = $viewModel->getModuleManager();
if ($moduleManager->isOutputEnabled('Webkul_Marketplace')) {
    $helper = $this->helper('Webkul\Marketplace\Helper\Data');
}
$partner = $block->getProfileDetail();
?>
<div id="customer-reviews" class="box-collateral box-reviews">
    <div class="form-add">
    <?php if($block->getCustomerIsLogin()) { ?>
        <div class="show-review">   
            <h2><?php echo __('Make a review') ?></h2>
            <form id="review-form"
                method="post"
                action="<?php echo $block->getUrl(
                    'agorae/seller/newfeedback',
                    ['_secure' => $this->getRequest()->isSecure()]
                ) ?>"
                enctype="multipart/form-data" >
                <?php echo $block->getBlockHtml('formkey'); ?>
                <div class="fieldset">
                    <h4>
                        <?php echo __('You are making this review for') ?>
                        <span class="shop-title-collection-page">
                            <?php echo $partner->getShopTitle(); ?>
                        </span>
                    </h4>
                    <span id="input-message-box"></span>
                    <input type="hidden"
                        class="seller_id"
                        name="seller_id"
                        id="seller_id"
                        value="<?php echo $partner->getSellerId(); ?>"
                        title="seller id" />
                    <input type="hidden"
                        name="shop_url"
                        value="<?php echo $partner->getShopUrl(); ?>" />
                    <input type="hidden"
                        name="block_name"
                        value="<?php echo $block->getNameInLayout(); ?>" />
                    <ul class="form-list">
                        <li class="inline-label">
                            <label for="nickname_field" class="required">
                                <em>*</em>
                                <?php echo __("Your nickname ?") ?>
                            </label>
                            <div class="input-box">
                                <input type="text"
                                    value="<?php echo $block->getCustomerSessionName(); ?>"
                                    class="input-text required-entry widthinput nickname"
                                    id="nickname_field"
                                    name="feed_nickname">
                            </div>
                        </li>
                        <li class="inline-label">
                            <label for="summary_field" class="required">
                                <em>*</em>
                                <?php echo __('Summary of Your Review') ?>
                            </label>
                            <div class="input-box">
                                <input type="text"
                                    value=""
                                    class="input-text required-entry widthinput summary_field"
                                    id="summary_field"
                                    name="feed_summary">
                            </div>
                        </li>
                        <li>
                            <label for="review_field" class="required">
                                <em>*</em>
                                <?php echo __('Let us know your thoughts') ?>
                            </label>
                            <div class="input-box">
                                <textarea class="required-entry widthinput review_field validate-customer-password"
                                    rows="3"
                                    cols="5"
                                    id="review_field"
                                    name="feed_review"
                                    data-password-min-length="150">
                                </textarea>
                            </div>
                        </li>
                    </ul>
                    <h4>
                        <?php echo __('How do you rate') ?>
                        <span class="shop-title-collection-page">
                            <?php echo $partner->getShopTitle(); ?>
                        </span>
                        <?php echo __('?') ?>
                    </h4>

                    <table id="product-review-table" class="data-table review-summary-table ratings">
                        <colgroup>
                            <col width="1">
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                        </colgroup>
                        <thead>
                            <tr>
                                <th>&nbsp;</th>
                                <th>
                                    <div class="rating-box">
                                        <span class="rating-number">1</span>
                                        <span class="rating nobr" style="width:20%;">
                                            <?php //echo __('1 star') ?>
                                        </span>
                                    </div>
                                </th>
                                <th>
                                    <div class="rating-box">
                                        <span class="rating-number">2</span>
                                        <span class="rating nobr" style="width:40%;">
                                            <?php //echo __('2 star') ?>
                                        </span>
                                    </div>
                                </th>
                                <th>
                                    <div class="rating-box">
                                        <span class="rating-number">3</span>
                                        <span class="rating nobr" style="width:60%;">
                                            <?php //echo __('3 star') ?>
                                        </span>
                                    </div>
                                </th>
                                <th>
                                    <div class="rating-box">
                                        <span class="rating-number">4</span>
                                        <span class="rating nobr" style="width:80%;">
                                            <?php //echo __('4 star') ?>
                                        </span>
                                    </div>
                                </th>
                                <th>
                                    <div class="rating-box">
                                        <span class="rating-number">5</span>
                                        <span class="rating nobr" style="width:100%;">
                                            <?php //echo __('5 star') ?>
                                        </span>
                                    </div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="first odd">
                                <th><?php echo __('Price') ?></th>
                                <td class="value"><label><input type="radio" class="radio" value="20" id="Price_1" name="feed_price"/></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="40" id="Price_2" name="feed_price"></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="60" id="Price_3" name="feed_price"></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="80" id="Price_4" name="feed_price"></label></td>
                                <td class="value last"><label><input type="radio" class="radio" value="100" id="Price_5" name="feed_price" checked="checked"></label></td>
                            </tr>
                            <tr class="even">
                                <th><?php echo __('Value') ?></th>
                                <td class="value"><label><input type="radio" class="radio" value="20" id="Value_1" name="feed_value"/></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="40" id="Value_2" name="feed_value"></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="60" id="Value_3" name="feed_value"></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="80" id="Value_4" name="feed_value"></label></td>
                                <td class="value last"><label><input type="radio" class="radio" value="100" id="Value_5" name="feed_value" checked="checked"></label></td>
                            </tr>
                            <tr class="last odd">
                                <th><?php echo __('Quality') ?></th>
                                <td class="value"><label><input type="radio" class="radio" value="20" id="Quality_1" name="feed_quality"/></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="40" id="Quality_2" name="feed_quality"></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="60" id="Quality_3" name="feed_quality"></label></td>
                                <td class="value"><label><input type="radio" class="radio" value="80" id="Quality_4" name="feed_quality"></label></td>
                                <td class="value last"><label><input type="radio" class="radio" value="100" id="Quality_5" name="feed_quality" checked="checked"></label></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="buttons-set">
                    <button class="button"
                        title="<?php echo __('Submit Review') ?>" type="submit" id="wkagsubmitreview">
                        <span><span><?php echo __('Submit Review') ?></span></span>
                    </button>
                </div>
            </form>
        </div>
    <?php
    } else { ?>
        <?php $block->setCustomerSessionAfterAuthUrl();?>
        <center>
            <p class="loginmsg">
                <div class="cus-login-button button">
                    <a class="wk-agorae-login-model"
                        href="<?php echo $block->getUrl(
                            'customer/account/login/',
                            ['_secure' => $this->getRequest()->isSecure()]
                        ) ?>"
                        style="text-decoration:none;font-size:16px;color:#FFF;font-weight:bold">
                        <?php echo __('Login To Give Feedback'); ?>
                    </a>
                </div>
            </p>
        </center>
    <?php
    } ?>  
    </div>
</div>
<script>
    require([
        "jquery",
        "mage/mage"
    ], function($){
        var reviewDataForm = $('#review-form');
        reviewDataForm.mage('validation', {});
    });
</script>