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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
vendor page - vendor reviews and vendor contact
DanielŻuławskie091e3d64e52
diff --git a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web/Endpoints/EndpointProvider.csindex 317a1d976..8b5b3ed48 100644--- a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs+++ b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs@@ -203,7 +203,7 @@ namespace Grand.Web.Endpoints//contact vendorendpointRouteBuilder.MapControllerRoute("ContactVendor",- pattern + "vendor/contact/{vendorId}",+ pattern + "vendor/contact/{vendorId?}",new { controller = "Vendor", action = "ContactVendor" });}diff --git a/src/Web/Grand.Web/Views/Catalog/Components/VendorContact/Default.cshtml b/src/Web/Grand.Web/Views/Catalog/Components/VendorContact/Default.cshtmlnew file mode 100644index 000000000..97fb5eaa5--- /dev/null+++ b/src/Web/Grand.Web/Views/Catalog/Components/VendorContact/Default.cshtml@@ -0,0 +1,111 @@+@model ContactVendorModel+@await Component.InvokeAsync("Widget", new { widgetZone = "contactvendor_top" })+@if (Model.SuccessfullySent)+{+ <div class="result alert alert-info text-center my-3">+ @Model.Result+ </div>+}+else+{+ <template v-if="contactvendor.Message.Result !== null">+ <div v-bind:class="{'alert alert-info': contactvendor.Message.SuccessfullySent, 'alert alert-danger': !contactvendor.Message.SuccessfullySent}">+ {{contactvendor.Message.Result}}+ </div>+ </template>+ <template v-else>+ <validation-observer v-slot="{ handleSubmit }">+ <form asp-route="ContactVendor" id="vendorContact" method="post" ref="form" v-on:submit.prevent="handleSubmit(formSubmit($event))">+ <input type="hidden" asp-for="@Model.VendorId" />+ <div asp-validation-summary="ModelOnly" class="message-error"></div>+ <div class="form-fields d-flex row">+ <div class="form-group col-12 col-sm-6">+ <validation-provider tag="div" rules="required" name="FullName" v-slot="{ errors, classes }">+ <label asp-for="FullName" class="col-form-label">@Loc["ContactVendor.FullName"]:</label>+ <span class="required">*</span>+ <input asp-for="FullName" v-model="contactvendor.FullName" placeholder="@Loc["ContactVendor.FullName.Hint"]" v-bind:class="[classes , 'form-control']" />+ <span class="field-validation-error">{{ errors[0] }}</span>+ <span asp-validation-for="FullName"></span>+ </validation-provider>+ </div>+ <div class="form-group col-12 col-sm-6">+ <validation-provider tag="div" rules="required|email" name="Email" v-slot="{ errors, classes }">+ <label asp-for="Email" class="col-form-label">@Loc["ContactVendor.Email"]:</label>+ <span class="required">*</span>+ <input asp-for="Email" v-model="contactvendor.Email" placeholder="@Loc["ContactVendor.Email.Hint"]" v-bind:class="[classes , 'form-control']" />+ <span class="field-validation-error">{{ errors[0] }}</span>+ <span asp-validation-for="Email"></span>+ </validation-provider>+ </div>+ @if (Model.SubjectEnabled)+ {+ <div class="form-group col-12">+ <validation-provider tag="div" rules="required" name="Subject" v-slot="{ errors, classes }">+ <label asp-for="Subject" class="col-form-label">@Loc["ContactVendor.Subject"]:</label>+ <span class="required">*</span>+ <input asp-for="Subject" v-model="contactvendor.Subject" placeholder="@Loc["ContactVendor.Subject.Hint"]" v-bind:class="[classes , 'form-control']" />+ <span class="field-validation-error">{{ errors[0] }}</span>+ <span asp-validation-for="Subject"></span>+ </validation-provider>+ </div>+ }+ <div class="form-group col-12">+ <validation-provider tag="div" rules="required" name="Enquiry" v-slot="{ errors, classes }">+ <label asp-for="Enquiry" class="col-form-label">@Loc["ContactVendor.Enquiry"]:</label>+ <span class="required">*</span>+ <textarea asp-for="Enquiry" v-model="contactvendor.Enquiry" placeholder="@Loc["ContactVendor.Enquiry.Hint"]" v-bind:class="[classes , 'form-control']" rows="4"></textarea>+ <span class="field-validation-error">{{ errors[0] }}</span>+ <span asp-validation-for="Enquiry"></span>+ </validation-provider>+ </div>+ @if (Model.DisplayCaptcha)+ {+ <div class="captcha-box px-3">+ <captcha />+ </div>+ }+ </div>+ <div class="btn-group text-sm-center pt-3 pb-3">+ <input type="submit" name="send-email" class="btn btn-info contact-us-button" data-form="contactvendor.test('/vendor/contact/@Model.VendorId')" value="@Loc["ContactVendor.Button"]" />+ </div>+ </form>+ </validation-observer>+ </template>+ <script asp-location="Footer" asp-order="300">+ var contactvendor = new Vue({+ data: () => ({+ @{+ <text>+ FullName: '@Html.Raw(Model.FullName)',+ Email: '@Html.Raw(Model.Email)',+ Subject: '@Html.Raw(Model.Subject)',+ Enquiry: '@Html.Raw(Model.Enquiry)',+ Message: {+ Result: null,+ SuccessfullySent: false+ }+ </text>+ }+ }),+ methods: {+ test(url) {+ var bodyFormData = new FormData(document.getElementById("vendorContact"));+ axios({+ url: url,+ data: bodyFormData,+ method: 'post',+ headers: {+ 'Accept': 'application/json',+ 'Content-Type': 'application/json',+ 'X-Response-View': 'Json'+ }+ }).then(function (response) {+ contactvendor.Message.Result = response.data.Result;+ contactvendor.Message.SuccessfullySent = response.data.SuccessfullySent;+ })+ }+ }+ });+ </script>+}+@await Component.InvokeAsync("Widget", new { widgetZone = "contactvendor_bottom" })diff --git a/src/Web/Grand.Web/Views/Catalog/Components/VendorReviews/Default.cshtml b/src/Web/Grand.Web/Views/Catalog/Components/VendorReviews/Default.cshtmlnew file mode 100644index 000000000..6266d4580--- /dev/null+++ b/src/Web/Grand.Web/Views/Catalog/Components/VendorReviews/Default.cshtml@@ -0,0 +1,190 @@+@model VendorReviewsModel++<div class="mb-3">+ <a class="btn btn-info" @@click="vendorreviews.addVendorReview('@Url.RouteUrl("VendorReviews", new { vendorId = Model.VendorId })')">@Loc["Reviews.Overview.AddNew"]</a>+</div>+@if (Model.AddVendorReview.DisplayCaptcha)+{+ <div id="captcha-container">+ <div class="captcha-box" id="captcha-box">+ <captcha />+ </div>+ </div>+}+<partial name="_VendorReview.Modal" />+<template id="vendor-review-list" v-if="vendorreviews.Model.Items.length > 0">+ <div class="vendor-review-list">+ <h5 class="mb-3"><strong>@Loc["Reviews.ExistingReviews"]</strong></h5>+ <template v-for="review in vendorreviews.Model.Items">+ <div class="card vendor-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 mr-2">@Loc["Reviews.From"]:</small>+ <h6 class="mb-0">{{review.CustomerName}}</h6>+ </div>+ <b-icon icon="calendar2-check" variant="info" class="mx-2"></b-icon>+ <small class="date text-muted">+ <span class="ml-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>+ <div class="card-footer">+ <div class="vendor-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.VendorReviewId" @@click="vendorreviews.setVendorReviewHelpfulness('@Url.RouteUrl("SetVendorReviewHelpfulness")', 'true', review.Id, '@Model.VendorId', '@Loc[" Reviews.Helpfulness.WasHelpful?"]')" class="btn btn-sm btn-outline vote"><b-icon variant="success" icon="hand-thumbs-up"></b-icon></span>+ <span :id="'vote-no-' + review.Helpfulness.VendorReviewId" @@click="vendorreviews.setVendorReviewHelpfulness('@Url.RouteUrl("SetVendorReviewHelpfulness")', 'false', review.Id, '@Model.VendorId', '@Loc[" Reviews.Helpfulness.WasHelpful?"]')" class="btn btn-sm btn-outline vote"><b-icon variant="danger" icon="hand-thumbs-down"></b-icon></span>+ </span>+ <span class="vote-stats d-inline-flex">+ (<span :id="'helpfulness-vote-yes-' + review.Helpfulness.VendorReviewId">{{review.Helpfulness.HelpfulYesTotal}}</span>/<span :id="'helpfulness-vote-no-' + review.Helpfulness.VendorReviewId">{{review.Helpfulness.HelpfulNoTotal}}</span>)+ </span>+ </div>+ </div>+ </div>+ </template>+ <template v-else>+ <p class="text-muted">@Loc["Vendor.Reviews.Empty"]</p>+ </template>+ </div>+</template>++<script asp-location="Footer" asp-order="300">+ var vendorreviews = new Vue({+ data: function () {+ return {+ Model: null,+ rating: null,+ captcha: null,+ PopupVendorReviewVueModal: null,+ }+ },+ created() {+ this.Model = @Json.Serialize(Model);+ },+ methods: {+ setVendorReviewHelpfulness(url, wasHelpful, reviewId, vendorId, toastTitle) {+ axios({+ url: url,+ method: 'post',+ params: { "vendorReviewId": reviewId, "vendorId": vendorId, "washelpful": wasHelpful },+ headers: {+ 'X-Response-View': 'Json'+ },+ }).then(function (response) {+ document.getElementById("helpfulness-vote-yes-" + reviewId + "").innerHTML = response.data.TotalYes+ document.getElementById("helpfulness-vote-no-" + reviewId + "").innerHTML = response.data.TotalNo;+ new Vue({+ el: ".modal-place",+ methods: {+ toast() {+ this.$bvToast.toast(response.data.Result, {+ title: toastTitle,+ variant: 'info',+ autoHideDelay: 3000,+ solid: true+ })+ }+ },+ mounted: function () {+ this.toast();+ }+ });+ }).catch(function (error) {+ alert(error);+ })+ },+ addVendorReview: function (url) {+ axios({+ url: url,+ method: 'get',+ headers: {+ 'Accept': 'application/json',+ 'Content-Type': 'application/json',+ 'X-Response-View': 'Json'+ }+ }).then(function (response) {+ vendorreviews.PopupVendorReviewVueModal = response.data;+ vm.$refs['ModalVendorReview'].show();+ });+ },+ modalReviewShown: function () {+ if (vendorreviews.PopupVendorReviewVueModal.AddVendorReview.DisplayCaptcha && document.querySelector("#ModalVendorReview .captcha-box") == null) {+ var html = document.getElementById("captcha-box");+ document.getElementById("captcha-popup").prepend(html);+ }+ vendorreviews.PopupVendorReviewVueModal = Object.assign({}, vendorreviews.PopupVendorReviewVueModal, { ReviewTitle: '', ReviewText: '' })+ },+ modalReviewClose: function () {+ if (vendorreviews.PopupVendorReviewVueModal.AddVendorReview.DisplayCaptcha && document.querySelector("#ModalVendorReview .captcha-box") !== null) {+ var html = document.getElementById("captcha-box");+ document.getElementById("captcha-container").prepend(html);+ }+ },+ submitVendorReview: function () {+ var form = document.getElementById("addReviewForm");+ var url = form.getAttribute("action");+ var resultTitle = form.getAttribute("data-title");+ var bodyFormData = new FormData(form);+ axios({+ method: "post",+ url: url,+ data: bodyFormData,+ headers: {+ "Content-Type": "multipart/form-data",+ 'X-Response-View': 'Json'+ },+ }).then(function (response) {+ vendorreviews.PopupVendorReviewVueModal = response.data;+ vendorreviews.Model.Items = response.data.Items;++ var result = response.data.AddVendorReview.Result;+ var variant = "";++ if (response.data.AddVendorReview.SuccessfullyAdded) {++ variant = "info";+ vm.$refs['ModalVendorReview'].hide();++ } else {+ variant = "danger";+ }++ new Vue({+ el: ".modal-place",+ methods: {+ toast() {+ this.$bvToast.toast(result, {+ title: resultTitle,+ variant: variant,+ autoHideDelay: 3000,+ solid: true+ })+ }+ },+ mounted: function () {+ this.toast();+ }+ });++ if (response.data.VendorReviewOverview !== null) {+ vendorreviewsoverview.Model = response.data.VendorReviewOverview;+ }+ });+ return+ }+ }+ });+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web/Views/Catalog/Vendor.cshtml b/src/Web/Grand.Web/Views/Catalog/Vendor.cshtmlindex 16023f3c1..b69ed992e 100644--- a/src/Web/Grand.Web/Views/Catalog/Vendor.cshtml+++ b/src/Web/Grand.Web/Views/Catalog/Vendor.cshtml@@ -25,22 +25,9 @@<div class="col-xl-10 col-lg-9 col-md-8 align-items-center d-flex"><div><h1 class="h2 generalTitle w-100">- @Model.Name+ {{catalog.Model.Name}}</h1>- @if (Model.AllowCustomersToContactVendors)- {- <button class="btn btn-sm btn-info contact-vendor-button float-xs-right" onclick="location = ('@Url.RouteUrl("ContactVendor", new { vendorId = Model.Id })')">- @Loc["ContactVendor"]- </button>- }@await Component.InvokeAsync("Widget", new { widgetZone = "vendordetails_top", additionalData = Model.Id })- @*Rendering description section*@- @if (!String.IsNullOrWhiteSpace(Model.Description))- {- <article class="text-xs-center generalMarginSupporter vendor-description">- @Html.Raw(Model.Description)- </article>- }@*rendering review section*@@if (Model.VendorReviewOverview.AllowCustomerReviews){@@ -53,86 +40,105 @@</div><div class="row"><div class="col-12">- @if (Model.Address != null)- {- <ul class="info px-0 mb-0">- @if (Model.Address.CompanyEnabled && !String.IsNullOrEmpty(Model.Address.Company))- {- <li class="company">- <label class="col-form-label">@Loc["Address.Fields.Company"]:</label>- @Model.Address.Company- </li>- }- @if (Model.Address.StreetAddressEnabled && !String.IsNullOrEmpty(Model.Address.Address1))- {- <li class="address1">- <label class="col-form-label w-100">@Loc["Address.Fields.Address1"]:</label>- @Model.Address.Address1- </li>- }- @if (Model.Address.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.Address.Address2))- {- <li class="address2">- <label class="col-form-label">@Loc["Address.Fields.Address2"]:</label>- @Model.Address.Address2- </li>- }- @if (Model.Address.CityEnabled || Model.Address.StateProvinceEnabled || Model.Address.ZipPostalCodeEnabled)- {- var cityStateZip = "";- if (Model.Address.CityEnabled && !String.IsNullOrEmpty(Model.Address.City))- {- cityStateZip = Model.Address.City;- if (Model.Address.StateProvinceEnabled || Model.Address.ZipPostalCodeEnabled)+ <b-tabs class="mt-3" content-class="mt-3" align="center">+ <template v-if="catalog.Model.Description !== null">+ <b-tab id="description-tab" title="@Loc["vendor.Description"]" active>+ <article class="text-xs-center generalMarginSupporter vendor-description" v-html="catalog.Model.Description"></article>+ </b-tab>+ </template>+ @if (Model.Address != null)+ {+ <b-tab id="address-tab" title="@Loc["Vendor.Address"]">+ <ul class="info px-0 mb-0">+ @if (Model.Address.CompanyEnabled && !String.IsNullOrEmpty(Model.Address.Company))+ {+ <li class="company">+ <label class="col-form-label">@Loc["Address.Fields.Company"]:</label>+ @Model.Address.Company+ </li>+ }+ @if (Model.Address.StreetAddressEnabled && !String.IsNullOrEmpty(Model.Address.Address1)){- cityStateZip += ",";+ <li class="address1">+ <label class="col-form-label w-100">@Loc["Address.Fields.Address1"]:</label>+ @Model.Address.Address1+ </li>}- }- if (Model.Address.StateProvinceEnabled)- {- if (!String.IsNullOrEmpty(cityStateZip))+ @if (Model.Address.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.Address.Address2)){- cityStateZip += " ";+ <li class="address2">+ <label class="col-form-label">@Loc["Address.Fields.Address2"]:</label>+ @Model.Address.Address2+ </li>}- cityStateZip += Model.Address.StateProvinceName;- }- if (Model.Address.ZipPostalCodeEnabled)- {- if (!String.IsNullOrEmpty(cityStateZip))+ @if (Model.Address.CityEnabled || Model.Address.StateProvinceEnabled || Model.Address.ZipPostalCodeEnabled){- cityStateZip += " ";+ var cityStateZip = "";+ if (Model.Address.CityEnabled && !String.IsNullOrEmpty(Model.Address.City))+ {+ cityStateZip = Model.Address.City;+ if (Model.Address.StateProvinceEnabled || Model.Address.ZipPostalCodeEnabled)+ {+ cityStateZip += ",";+ }+ }+ if (Model.Address.StateProvinceEnabled)+ {+ if (!String.IsNullOrEmpty(cityStateZip))+ {+ cityStateZip += " ";+ }+ cityStateZip += Model.Address.StateProvinceName;+ }+ if (Model.Address.ZipPostalCodeEnabled)+ {+ if (!String.IsNullOrEmpty(cityStateZip))+ {+ cityStateZip += " ";+ }+ cityStateZip += Model.Address.ZipPostalCode;+ }+ if (!String.IsNullOrEmpty(cityStateZip))+ {+ <li class="city-state-zip">+ @cityStateZip+ </li>+ }}- cityStateZip += Model.Address.ZipPostalCode;- }- if (!String.IsNullOrEmpty(cityStateZip))- {- <li class="city-state-zip">- @cityStateZip- </li>- }- }- @if (Model.Address.CountryEnabled && !String.IsNullOrEmpty(Model.Address.CountryName))- {- <li class="country">- @Model.Address.CountryName- </li>- }- @if (Model.Address.PhoneEnabled && !String.IsNullOrEmpty(Model.Address.PhoneNumber))- {- <li class="phone">- <label class="col-form-label">@Loc["Address.Fields.PhoneNumber"]:</label>- @Model.Address.PhoneNumber- </li>- }- @if (Model.Address.FaxEnabled && !String.IsNullOrEmpty(Model.Address.FaxNumber))- {- <li class="fax">- <label class="col-form-label">@Loc["Address.Fields.FaxNumber"]:</label>- @Model.Address.FaxNumber- </li>- }- </ul>- }+ @if (Model.Address.CountryEnabled && !String.IsNullOrEmpty(Model.Address.CountryName))+ {+ <li class="country">+ @Model.Address.CountryName+ </li>+ }+ @if (Model.Address.PhoneEnabled && !String.IsNullOrEmpty(Model.Address.PhoneNumber))+ {+ <li class="phone">+ <label class="col-form-label">@Loc["Address.Fields.PhoneNumber"]:</label>+ @Model.Address.PhoneNumber+ </li>+ }+ @if (Model.Address.FaxEnabled && !String.IsNullOrEmpty(Model.Address.FaxNumber))+ {+ <li class="fax">+ <label class="col-form-label">@Loc["Address.Fields.FaxNumber"]:</label>+ @Model.Address.FaxNumber+ </li>+ }+ </ul>+ </b-tab>+ }+ <template v-if="catalog.Model.VendorReviewOverview.AllowCustomerReviews">+ <b-tab id="review-tab" title="@Loc["vendor.Reviews"]" :active="active ? true : false">+ @await Component.InvokeAsync("VendorReviews", new { vendorId = Model.Id })+ </b-tab>+ </template>+ <template v-if="catalog.Model.AllowCustomersToContactVendors">+ <b-tab id="contact-tab" title="@Loc["ContactVendor"]">+ @await Component.InvokeAsync("VendorContact", new { vendorId = Model.Id })+ </b-tab>+ </template>+ </b-tabs></div></div></div>diff --git a/src/Web/Grand.Web/Views/Catalog/_VendorReview.Modal.cshtml b/src/Web/Grand.Web/Views/Catalog/_VendorReview.Modal.cshtmlnew file mode 100644index 000000000..acacc393e--- /dev/null+++ b/src/Web/Grand.Web/Views/Catalog/_VendorReview.Modal.cshtml@@ -0,0 +1,50 @@+@{+ var vendorlink = @Url.RouteUrl("Vendor");+}++<b-modal id="ModalVendorReview" ref="ModalVendorReview" :dark-theme="darkMode" size="xl" @@shown="vendorreviews.modalReviewShown()" @@hide="vendorreviews.modalReviewClose()" centered hide-footer hide-header>+ <template v-if="vendorreviews.PopupVendorReviewVueModal !== null">+ <h2 class="generalTitle h3">@Loc["Reviews.VendorReviewsFor"] <a href="@vendorlink">{{vendorreviews.PopupVendorReviewVueModal.VendorName}}</a></h2>+ <a class="modal-close" @@click="$bvModal.hide('ModalVendorReview')"><b-icon icon="x"></b-icon></a>+ <template v-if="!vendorreviews.PopupVendorReviewVueModal.AddVendorReview.SuccessfullyAdded">+ <div class="write-review" id="review-form">+ <h5 class="generalTitle"><strong>@Loc["Reviews.Write"]</strong></h5>+ <validation-observer v-slot="{ handleSubmit }">+ <form id="addReviewForm" :action="'/vendoreviews/' + vendorreviews.PopupVendorReviewVueModal.VendorId" method="post" ref="modalForm" v-on:submit.prevent="handleSubmit(vendorreviews.submitVendorReview)" :data-title="'@Loc["Reviews.VendorReviewsFor"] ' + vendorreviews.PopupVendorReviewVueModal.VendorName">+ <input type="hidden" name="VendorId" :value="vendorreviews.PopupVendorReviewVueModal.VendorId" />+ <div asp-validation-summary="ModelOnly" class="message-error alert alert-danger my-3"></div>+ <fieldset>+ <div class="form-fields">+ <div class="form-group">+ <validation-provider tag="div" rules="required" name="AddVendorReview.Title" v-slot="{ errors, classes }">+ <label for="AddVendorReview_Title" class="col-form-label">@Loc["Reviews.Fields.Title"]:</label>+ <input data-val-required="@Loc["reviews.fields.title.required"]" v-model="vendorreviews.PopupVendorReviewVueModal.ReviewTitle" id="AddVendorReview_Title" name="AddVendorReview.Title" v-bind:class="[classes , 'form-control review-title']" :disabled="!vendorreviews.PopupVendorReviewVueModal.AddVendorReview.CanCurrentCustomerLeaveReview" />+ <span class="field-validation-error">{{ errors[0] }}</span>+ </validation-provider>+ </div>+ <div class="form-group">+ <validation-provider tag="div" rules="required" name="AddVendorReview.ReviewText" v-slot="{ errors, classes }">+ <label for="AddVendorReview_ReviewText" class="col-form-label">@Loc["Reviews.Fields.ReviewText"]:</label>+ <textarea data-val-required="@Loc["reviews.fields.reviewtext.required"]" v-model="vendorreviews.PopupVendorReviewVueModal.ReviewText" id="AddVendorReview_ReviewText" name="AddVendorReview.ReviewText" v-bind:class="[classes , 'form-control review-text']" :disabled="!vendorreviews.PopupVendorReviewVueModal.AddVendorReview.CanCurrentCustomerLeaveReview"></textarea>+ <span class="field-validation-error">{{ errors[0] }}</span>+ </validation-provider>+ </div>+ <div class="form-group review-rating d-flex flex-wrap">+ <label for="AddVendorReview_Rating" class="col-form-label w-100">@Loc["Reviews.Fields.Rating"]:</label>+ <b-form-rating v-model="value" variant="warning" show-value value="5" inline></b-form-rating>+ <input class="sr-only" id="AddVendorReview_Rating" name="AddVendorReview.Rating" v-model="value" />+ </div>+ <template v-if="vendorreviews.PopupVendorReviewVueModal.AddVendorReview.DisplayCaptcha">+ <div id="captcha-popup"></div>+ </template>+ </div>+ </fieldset>+ <div class="buttons my-3">+ <input type="submit" class="btn btn-info write-vendor-review-button" value="@Loc[" Reviews.SubmitButton"]" :disabled="!vendorreviews.PopupVendorReviewVueModal.AddVendorReview.CanCurrentCustomerLeaveReview" />+ </div>+ </form>+ </validation-observer>+ </div>+ </template>+ </template>+</b-modal>\ No newline at end of filediff --git a/src/Web/Grand.Web/Views/Catalog/_VendorReviewOverview.cshtml b/src/Web/Grand.Web/Views/Catalog/_VendorReviewOverview.cshtmlindex b87935f45..0f1c22f19 100644--- a/src/Web/Grand.Web/Views/Catalog/_VendorReviewOverview.cshtml+++ b/src/Web/Grand.Web/Views/Catalog/_VendorReviewOverview.cshtml@@ -9,36 +9,55 @@}@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-reviews-overview d-inline-flex align-items-center flex-wrap" @if (Model.TotalReviews > 0) { <text> itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" </text> }>+ @{double ratingValue = 0;if (Model.TotalReviews != 0){ratingValue = Convert.ToDouble(((Model.RatingSum * (double)100) / Model.TotalReviews) / (double)100);}}- <div class="rating">- <b-form-rating id="rating-inline" class="p-0" variant="warning" no-border size="sm" show-value precision="2" readonly inline value="@(ratingValue.ToString("0.00", CultureInfo.InvariantCulture))"></b-form-rating>- <span class="h6 mb-0 text-info">@Model.TotalReviews @Loc["Reviews.Overview.Reviews"]</span>- @if (Model.TotalReviews > 0)- {- <div class="product-review-links order-3">- <a class="btn btn-sm btn-outline-info" href="@Url.RouteUrl("VendorReviews", new { VendorId = Model.VendorId })">- @Loc["VendorReviews.Overview.AddNew"]- </a>- </div>- @* Rendering microdata info*@- double ratingValuee = ratingPercent / (double)20;- <span itemprop="reviewCount" style="display: none;">(@ratingValuee.ToString("0.0", new CultureInfo("en-US")))</span>- }- else- {- <div class="vendor-no-reviews order-3">- <a class="btn btn-sm btn-outline-info" href="@Url.RouteUrl("VendorReviews", new { VendorId = Model.VendorId })">- @Loc["VendorReviews.Overview.First"]- </a>- </div>- }- </div>+ <div class="rating">+ <b-form-rating id="rating-inline" class="p-0" variant="warning" no-border size="sm" show-value precision="2" v-model="vendorreviewsoverview.rating" readonly inline value="@(ratingValue.ToString("0.00", CultureInfo.InvariantCulture))"></b-form-rating>+ <template v-if="vendorreviewsoverview.Model.TotalReviews > 0">+ <div class="product-review-links order-3">+ <b-button variant="outline-info" size="sm" class="review-scroll-button" @@click="active = true" href="#review-tab___BV_tab_button__">+ {{vendorreviewsoverview.Model.TotalReviews}}+ @Loc["Reviews.Overview.Reviews"]+ </b-button>+ </div>+ @{+ double ratingValuee = ratingPercent / (double)20;+ }+ <span itemprop="reviewCount" style="display: none;">(@ratingValuee.ToString("0.0", new CultureInfo("en-US")))</span>+ </template>+ <template v-else>+ <div class="vendor-no-reviews order-3">+ <a class="btn btn-sm btn-outline-info" @@click="vendorreviews.addVendorReview('@Url.RouteUrl("VendorReviews", new { vendorId = Model.VendorId })')">+ @Loc["VendorReviews.Overview.First"]+ </a>+ </div>+ </template>+ </div></div>-}\ No newline at end of file+}+<script asp-location="Footer" asp-order="300">+ var vendorreviewsoverview = new Vue({+ data: function () {+ return {+ Model: null,+ rating: 0+ }+ },+ created() {+ this.Model = @Json.Serialize(Model);+ },+ watch: {+ Model: function() {+ const RatingSum = this.Model.RatingSum;+ const TotalReviews = this.Model.TotalReviews;+ this.rating = RatingSum / TotalReviews;+ }+ }+ })+</script>diff --git a/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.css b/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.cssindex 765920ed1..453144e45 100644--- a/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.css+++ b/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.css@@ -123,6 +123,49 @@margin: 0 0 0 20px;}+/* tabs */++.nav-tabs .nav-link {+ position: relative;+ font-size: 18px;+ font-weight: 500;+ color: #666;+ border: 0;+ outline: none;+ border-radius: 0;+ border-top-left-radius: .25rem;+ border-top-right-radius: .25rem;+ -webkit-transition: all .2s ease;+ transition: all .2s ease;+}+.nav-tabs .nav-link.active {+ color: #000;+}+.nav-tabs .nav-link:hover:not(.active) {+ background-color: rgba(0,0,0,.08);+ color: #000;+}+.nav-tabs .nav-link::before {+ content: "";+ position: absolute;+ bottom: 0;+ left: 50%;+ right: 50%;+ height: 2px;+ background: rgba(0,0,0,.2);+ -webkit-transition: all 0.2s ease-out;+ transition: all 0.2s ease-out;+}+.nav-tabs .nav-link:hover::before {+ left: 0;+ right: 0;+}+.nav-tabs .nav-link.active::before {+ background: #0E606C;+ left: 0;+ right: 0;+}+/* pagintaion */.pagination {diff --git a/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.rtl.css b/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.rtl.cssindex 244011f58..0dab4967e 100644--- a/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.rtl.css+++ b/src/Web/Grand.Web/wwwroot/theme/css/catalog/catalog.rtl.css@@ -133,6 +133,49 @@margin: 0 20px 0 0;}+/* tabs */++.nav-tabs .nav-link {+ position: relative;+ font-size: 18px;+ font-weight: 500;+ color: #666;+ border: 0;+ outline: none;+ border-radius: 0;+ border-top-left-radius: .25rem;+ border-top-right-radius: .25rem;+ -webkit-transition: all .2s ease;+ transition: all .2s ease;+}+.nav-tabs .nav-link.active {+ color: #000;+}+.nav-tabs .nav-link:hover:not(.active) {+ background-color: rgba(0,0,0,.08);+ color: #000;+}+.nav-tabs .nav-link::before {+ content: "";+ position: absolute;+ bottom: 0;+ left: 50%;+ right: 50%;+ height: 2px;+ background: rgba(0,0,0,.2);+ -webkit-transition: all 0.2s ease-out;+ transition: all 0.2s ease-out;+}+.nav-tabs .nav-link:hover::before {+ left: 0;+ right: 0;+}+.nav-tabs .nav-link.active::before {+ background: #0E606C;+ left: 0;+ right: 0;+}+/* pagintaion */.pagination {