ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Views/Catalog/_VendorReviewOverview.cshtml
@model VendorReviewOverviewModel
@using System.Globalization
@{
    int ratingPercent = 0;
    if (Model.TotalReviews != 0)
    {
        ratingPercent = ((Model.RatingSum * 100) / Model.TotalReviews) / 5;
    }
}
@if (Model.AllowCustomerReviews)
{
    <div class="vendor-reviews-overview d-inline-flex align-items-center flex-wrap" @if (Model.TotalReviews > 0) { <text> itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" </text>  }>
        <div class="vendor-review-box d-inline-block order-1">
            <div class="ratings">
                <div class="rating-box">
                    <div class="rating" style="width: @(ratingPercent)%">
                    </div>
                </div>
            </div>
        </div>
        @if (Model.TotalReviews > 0)
        {
            <div class="vendor-review-links order-3 mt-1">
                <a class="btn btn-sm" href="@Url.RouteUrl("VendorReviews", new { VendorId = Model.VendorId })">
                    @Model.TotalReviews
                    @T("VendorReviews.Overview.Reviews")
                </a><a class="btn btn-outline-secondary btn-sm" href="@Url.RouteUrl("VendorReviews", new { VendorId = Model.VendorId })">@T("VendorReviews.Overview.AddNew")</a>
            </div>
            @*hidden microdata info*@
            decimal ratingValue = ratingPercent / (decimal)20;
            <div class="order-2 mr-2 review-count mt-1" itemprop="ratingValue">
                    <a class="btn btn-sm py-0 pr-0 review-scroll-button">
                        <strong>(@ratingValue.ToString("0.0", new CultureInfo("en-US")))</strong>
                    </a>
            </div>
            <span itemprop="reviewCount" style="display: none;">@Model.TotalReviews</span>
        }
        else
        {
            <div class="vendor-no-reviews order-3 mt-1">
                <a class="btn btn-sm" href="@Url.RouteUrl("VendorReviews", new { VendorId = Model.VendorId })">@T("VendorReviews.Overview.First")</a>
            </div>
        }
    </div>
}