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

// @codingStandardsIgnoreFile

?>
<?php
$product = $block->getProductData();
?>
<?php if ($product->getId()): ?>
<div class="customer-review view">
    <div class="product-details">
        <div class="product-media">
            <a class="product-photo" href="<?php /* @escapeNotVerified */ echo $product->getProductUrl() ?>">
                <?php /* customer_account_product_review_page */ ?>
                <?php echo $block->getImage($block->getProductData(), 'customer_account_product_review_page')->toHtml() ?>
            </a>
        </div>
        <div class="product-info">
            <h2 class="product-name"><?php echo $block->escapeHtml($product->getName()) ?></h2>
            <?php if ($block->getRating() && $block->getRating()->getSize()): ?>
                <span class="rating-average-label"><?php /* @escapeNotVerified */ echo __('Average Customer Rating:') ?></span>
                <?php echo $block->getReviewsSummaryHtml($product) ?>
            <?php endif; ?>
        </div>
    </div>

    <div class="review-details">
        <?php if ($block->getRating() && $block->getRating()->getSize()): ?>
            <div class="title">
                <strong><?php /* @escapeNotVerified */ echo __('Your Review'); ?></strong>
            </div>
            <div class="customer-review-rating">
                <?php foreach ($block->getRating() as $_rating): ?>
                <?php if ($_rating->getPercent()): ?>
                    <?php $rating = ceil($_rating->getPercent()) ?>
                    <div class="rating-summary item">
                        <span class="rating-label"><span><?php echo $block->escapeHtml($_rating->getRatingCode()) ?></span></span>
                        <div class="rating-result" title="<?php /* @escapeNotVerified */ echo $rating; ?>%">
                            <span style="width:<?php /* @escapeNotVerified */ echo $rating; ?>%">
                                <span><?php /* @escapeNotVerified */ echo $rating; ?>%</span>
                            </span>
                        </div>
                    </div>
                <?php endif; ?>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>

        <div class="review-title"><?php echo $block->escapeHtml($block->getReviewData()->getTitle()) ?></div>
        <div class="review-content"><?php echo nl2br($block->escapeHtml($block->getReviewData()->getDetail())) ?></div>
        <div class="review-date">
            <?php /* @escapeNotVerified */ echo __('Submitted on %1', '<time class="date">' . $block->dateFormat($block->getReviewData()->getCreatedAt()) . '</time>') ?>
        </div>
    </div>
</div>
<div class="actions-toolbar">
    <div class="secondary">
        <a class="action back" href="<?php /* @escapeNotVerified */ echo $block->getBackUrl() ?>"><span><?php /* @escapeNotVerified */ echo __('Back to My Reviews') ?></span></a>
    </div>
</div>
<?php endif; ?>
