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.

6.2 KB
Raw Blame
@model ProductReviewsModel

<template v-if="productreviews.Model.AddProductReview.CanCurrentCustomerLeaveReview">
    <div class="mb-3">
        <a class="btn btn-info" @@click="productreviews.addProductReview()">@Loc["Reviews.Overview.AddNew"]</a>
    </div>
</template>
<template v-else>
    <div class="alert alert-danger">
        @Loc["reviews.onlyregistereduserscanwritereviews"]
    </div>
</template>
<partial name="Partials/ProductReview.Modal.cshtml" model="Model"/>
<template id="product-review-list" v-if="productreviews.Model !== null">
    <div class="product-review-list">
        <template v-if="productreviews.Model.Items.length > 0">
            <h5 class="mb-3">
                <strong>@Loc["Reviews.ExistingReviews"]</strong>
            </h5>
            <template v-for="review in productreviews.Model.Items">
                <div class="card product-review-item mb-3">
                    <div class="card-header">
                        <div class="review-info d-inline-flex w-100">
                            <div class="user d-inline-flex align-items-center">
                                <small class="text-muted me-2">@Loc["Reviews.From"]:</small>
                                <h6 class="mb-0">{{review.CustomerName}}</h6>
                            </div>
                            <i class="b-icon bi bi-calendar2-check text-info mx-2" aria-hidden="true"></i>
                            <small class="date text-muted">
                                <span class="ms-1">@Loc["Reviews.Date"]:</span>
                                <span>{{review.WrittenOnStr}}</span>
                            </small>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="review-title mb-3">
                            <h5 class="mb-0">{{review.Title}}</h5>
                            <b-form-rating id="rating-inline2" class="p-0" variant="warning" no-border size="sm" show-value precision="2" readonly inline :value="review.Rating"></b-form-rating>
                        </div>
                        <div class="review-content">
                            <div class="review-text">
                                {{review.ReviewText}}
                            </div>
                        </div>
                    </div>
                    <template v-if="review.ReplyText !== null">
                        <div class="reply-content">
                            <blockquote class="administration-response px-3">
                                <h5 class="administration-response-header">@Loc["Reviews.AdministrationResponse"]</h5>
                                <span>{{review.ReplyText}}</span>
                                <figcaption class="blockquote-footer">
                                    {{review.Signature}}
                                </figcaption>
                            </blockquote>
                        </div>
                    </template>
                    <div class="card-footer">
                        <div class="product-review-helpfulness d-inline-flex justify-content-end align-items-center flex-wrap">
                            <span class="question">@Loc["Reviews.Helpfulness.WasHelpful?"]</span>
                            <span class="vote-options btn-group">
                                <span :id="'vote-yes-' + review.Helpfulness.ProductReviewId" @@click="productreviews.setProductReviewHelpfulness('@Url.RouteUrl("SetProductReviewHelpfulness")', 'true', review.Id, '@Model.ProductId', '@Loc[" Reviews.Helpfulness.WasHelpful?"]')" class="btn btn-sm btn-outline vote">
                                    <i class="b-icon text-success bi bi-hand-thumbs-up" aria-hidden="true"></i>
                                </span>
                                <span :id="'vote-no-' + review.Helpfulness.ProductReviewId" @@click="productreviews.setProductReviewHelpfulness('@Url.RouteUrl("SetProductReviewHelpfulness")', 'false', review.Id, '@Model.ProductId', '@Loc[" Reviews.Helpfulness.WasHelpful?"]')" class="btn btn-sm btn-outline vote">
                                    <i class="b-icon text-danger bi bi-hand-thumbs-down" aria-hidden="true"></i>
                                </span>
                            </span>
                            <span class="vote-stats d-inline-flex">
                                (<span :id="'helpfulness-vote-yes-' + review.Helpfulness.ProductReviewId">{{review.Helpfulness.HelpfulYesTotal}}</span>/<span :id="'helpfulness-vote-no-' + review.Helpfulness.ProductReviewId">{{review.Helpfulness.HelpfulNoTotal}}</span>)
                            </span>
                        </div>
                    </div>
                </div>
            </template>
        </template>
        <template v-else>
            <div class="alert alert-info">@Loc["Products.Reviews.Empty"]</div>
        </template>
    </div>
</template>

<script type="application/json" data-grand-vm="reviews">@Json.Serialize(new {
                                                            name = "productreviews",
                                                            modalId = "ModalProductReview",
                                                            methods = new {
                                                                setHelpfulness = "setProductReviewHelpfulness",
                                                                addReview = "addProductReview",
                                                                submitReview = "submitProductReview"
                                                            },
                                                            addReviewKey = "AddProductReview",
                                                            overviewKey = "ProductReviewOverviewModel",
                                                            overviewVm = "productreviewsoverview",
                                                            helpfulness = new { reviewIdParam = "productReviewId", ownerIdParam = "productId" },
                                                            model = Model,
                                                            res = new { warning = Loc["common.warning"].ToString() }
                                                        })</script>