<?php
/**
 * Copyright © 2016 maijindou.com All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
/** @var \Magento\Review\Block\Customer\ListCustomer $block */
?>
<?php if ($block->getReviews() && count($block->getReviews())): ?>
    <div class="table-wrapper reviews">
        <table class="data table table-reviews" id="my-reviews-table">
            <caption class="table-caption"><?php /* @escapeNotVerified */ echo __('Product Reviews') ?></caption>
            <thead>
                <tr>
                    <th scope="col" class="col date"><?php /* @escapeNotVerified */ echo __('Created') ?></th>
                    <th scope="col" class="col item"><?php /* @escapeNotVerified */ echo __('Product Name') ?></th>
                    <th scope="col" class="col summary"><?php /* @escapeNotVerified */ echo __('Rating') ?></th>
                    <th scope="col" class="col description"><?php /* @escapeNotVerified */ echo __('Review') ?></th>
                    <th scope="col" class="col actions">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($block->getReviews() as $_review): ?>
                <tr>
                    <td data-th="<?php echo $block->escapeHtml(__('Created')) ?>" class="col date"><?php /* @escapeNotVerified */ echo $block->dateFormat($_review->getReviewCreatedAt()); ?></td>
                    <td data-th="<?php echo $block->escapeHtml(__('Product Name')) ?>" class="col item">
                        <strong class="product-name">
                            <a href="<?php /* @escapeNotVerified */ echo $block->getProductLink() ?>id/<?php /* @escapeNotVerified */ echo $_review->getEntityPkValue() ?>"><?php echo $block->escapeHtml($_review->getName()) ?></a>
                        </strong>
                    </td>
                    <td data-th="<?php echo $block->escapeHtml(__('Rating')) ?>" class="col summary">
                    <?php if ($_review->getSum()): ?>
                        <div class="rating-summary">
                            <span class="label"><span><?php /* @escapeNotVerified */ echo __('Rating') ?>:</span></span>
                            <div class="rating-result" title="<?php /* @escapeNotVerified */ echo($_review->getSum() / $_review->getCount()) ?>%">
                                <span style="width:<?php /* @escapeNotVerified */ echo($_review->getSum() / $_review->getCount()) ?>%;"><span><?php /* @escapeNotVerified */ echo($_review->getSum() / $_review->getCount()) ?>%</span></span>
                            </div>
                        </div>
                    <?php endif; ?>
                    </td>
                    <td data-th="<?php echo $block->escapeHtml(__('Review')) ?>" class="col description">
                        <?php echo $this->helper('Magento\Review\Helper\Data')->getDetailHtml($_review->getDetail()) ?>
                    </td>
                    <td data-th="<?php echo $block->escapeHtml(__('Actions')) ?>" class="col actions">
                        <a href="<?php /* @escapeNotVerified */ echo $block->getReviewLink() ?>id/<?php /* @escapeNotVerified */ echo $_review->getReviewId() ?>" class="action more">
                            <span><?php /* @escapeNotVerified */ echo __('See Details') ?></span>
                        </a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <?php if ($block->getToolbarHtml()): ?>
        <div class="toolbar products-reviews-toolbar bottom">
            <?php echo $block->getToolbarHtml() ?>
        </div>
    <?php endif; ?>
<?php else: ?>
    <div class="message info empty"><span><?php /* @escapeNotVerified */ echo __('You have submitted no reviews.') ?></span></div>
<?php endif; ?>
<div class="actions-toolbar">
    <div class="secondary">
        <a class="action back" href="<?php echo $block->escapeUrl($block->getBackUrl()) ?>">
            <span><?php /* @escapeNotVerified */ echo __('Back') ?></span>
        </a>
    </div>
</div>
