<?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

/**
 * Seller Reviews at seller collection and profile page
 *
 * @var $block \Webkul\Agorae\Block\Feedbackcollection
 */
$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">
    <h2><?php echo __('Reviews'); ?></h2>
    <div class="feedbacklist">
        <div class="feedback-list">
            <?php if(count($block->getCollection())==0){ ?>
                <div class="wk-emptymsg">
                    <?php echo __('no comment & review available'); ?>
                </div>
                <?php
            } else{ ?>
                <dl>
                    <?php foreach($block->getCollection() as $keyed){   ?>
                        <dd>
                            <table class="ratings-table">
                                <col width="1"/>
                                <col/>
                                <tbody>
                                    <tr>
                                        <th><?php echo __('Price') ?></th>
                                        <td>
                                            <div class="rating-box">
                                                <div class="rating"
                                                    style="width:<?php echo ceil(
                                                        $keyed['feed_price']
                                                    );?>%;"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th><?php echo __('Value') ?></th>
                                        <td>
                                            <div class="rating-box">
                                                <div class="rating"
                                                    style="width:<?php echo ceil(
                                                        $keyed['feed_value']
                                                    );?>%;"></div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th><?php echo __('Quality') ?></th>
                                        <td>
                                            <div class="rating-box">
                                                <div class="rating"
                                                    style="width:<?php echo ceil(
                                                        $keyed['feed_quality']
                                                    );?>%;"></div>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="review-meta">
                                <div class="feed-customer-name">
                                    <i class="wkagicon-username"></i>
                                    <?php
                                        $feedcustomer = $block->getCustomer()->load($keyed['buyer_id']);
                                        echo $feedcustomer->getName(); 
                                    ?>
                                </div>
                                <div class="feed-customer-email">
                                    <i class="wkagicon-useremail"></i>
                                    <?php echo $feedcustomer->getEmail(); ?>    
                                </div>
                                <div class="customer-feed-time">
                                    <i class="wkagicon-time"></i>
                                    <?php //echo $block->formatDate($keyed['created_at']);  ?>
                                    <?php echo date('d-M-Y G:i A',strtotime($keyed['created_at'])) ?>
                                </div>
                            </div>
                            <div class="customer-feed">
                                <?php echo $keyed['feed_review']; ?>
                            </div>
                        </dd>
                    <?php
                    } ?>
                </dl>
                <?php echo $block->getPagerHtml(); ?>
            <?php
            } ?>
        </div>
    </div>
</div>