Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

3.9 KB
Raw Blame
@model CustomerProductReviewsModel
@inject IPageHeadBuilder pagebuilder
@inject IContextAccessor contextAccessor
@{
    Layout = "_TwoColumns";

    var supportRtl = contextAccessor.WorkContext.WorkingLanguage.Rtl;

    //title
    pagebuilder.AddTitleParts(Loc["Title.Account"]);
}

@section left
{
    @await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = AccountNavigationEnum.Reviews })
}

@*
    Needs an island: the rating on each review is a <b-form-rating>, and a
    component tag outside every island stays an unknown element - no error, no
    stars, nothing to show that anything is missing. This page had 39 of them.
*@
<div class="page account-page product-reviews-page ps-lg-3 pt-lg-0 pt-3" vue-island>
    <h1 class="h2 generalTitle">@Loc["Account.Reviews"]</h1>
    @if (Model.Reviews.Any())
    {
        <div class="product-review-list">
            @foreach (var review in Model.Reviews)
            {
                var ratingStars = review.Rating;
                <div class="card product-review-item mb-3">
                    <header class="card-header">
                        <div class="review-info d-inline-flex w-100">
                            <i class="b-icon bi bi-calendar2-check text-info mx-2" aria-hidden="true"></i>
                            <small class="date d-flex text-muted">
                                @if (supportRtl)
                                {
                                    <span class="ms-1">@Loc["Reviews.Date"]:</span>
                                    <span>@Convert.ToDateTime(review.CreatedOn).ToString("tt HH:mm yyyy/MM/dd")</span>
                                }
                                else
                                {
                                    <span class="me-1">@Loc["Reviews.Date"]:</span>
                                    <span>@review.CreatedOn.ToString("g")</span>
                                }
                            </small>
                        </div>
                    </header>
                    <div class="card-body">
                        <div class="review-title mb-3">
                            <div class="user d-inline-flex align-items-center w-100">
                                <a href="@Url.RouteUrl("Product", new { SeName = review.ProductSeName })">
                                    <h6 class="mb-0">@review.ProductName</h6>
                                </a>
                            </div>
                            <partial name="Partials/Rating" model="(double)ratingStars" />
                        </div>
                        <div class="review-content">
                            @* v-pre: this is customer-written text inside an island,
                               so a review containing {{ }} would otherwise be compiled
                               as a template expression and silently disappear. *@
                            <div class="review-text" v-pre>
                                @review.ReviewText
                            </div>
                        </div>
                    </div>
                    <footer class="card-footer">
                        @if (!string.IsNullOrEmpty(review.ReplyText))
                        {
                            <div class="reply-content">
                                <blockquote class="administration-response">
                                    <h5 class="administration-response-header">@Loc["Reviews.AdministrationResponse"]</h5>
                                    <i>@review.ReplyText</i>
                                    <p class="h6 mb-0 mt-2">@review.Signature</p>
                                </blockquote>
                            </div>
                        }
                    </footer>
                </div>
            }
        </div>
    }
    else
    {
        <div class="no-data alert alert-info my-3">
            @Loc["Account.Reviews.NoExists"]
        </div>
    }
</div>