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.

SidebarWishlist - minor changes

DanielŻuławski94a30c2fac26
diff --git a/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml b/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml
index 215e481a7..f716c4aff 100644
--- a/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/SidebarWishlist.cshtml
@@ -8,7 +8,7 @@
<li class="nav-item">
<a href="#" target="_self" class="nav-link">
<b-icon icon="heart" :variant="[darkMode ? 'white' : 'dark']" @@click="updateWishlist()" v-b-toggle.sidebar-wishlist></b-icon>
- <span class="qty-indicator wishlist-qty">
+ <span class="qty-indicator wishlist-qty" ref="wishlistQty">
@Loc["Wishlist.HeaderQuantity", Model]
</span>
</a>
@@ -22,7 +22,7 @@
<template v-slot:title v-else>
@Loc["Wishlist.Mini.NoItems"]
</template>
- <div class="d-flex justify-content-center align-items-center h-100" v-if="wishlistitems == undefined">
+ <div class="d-flex justify-content-center align-items-center h-100" v-if="loader">
<div class="spinner-border text-info" role="status">
</div>
</div>
@@ -53,7 +53,7 @@
</div>
</template>
</template>
- <template v-else-if="wishindicator !== undefined">
+ <template v-else>
<div class="d-flex flex-column justify-content-center align-items-center">
<b-icon icon="cart-x" font-scale="7.5" variant="secondary"></b-icon>
<div class="text-center text-muted mt-3">@Loc["Wishlist.Mini.NoDataText"]</div>
diff --git a/src/Web/Grand.Web/wwwroot/theme/script/app.js b/src/Web/Grand.Web/wwwroot/theme/script/app.js
index 64d5ef5b6..d3df35a6b 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/app.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/app.js
@@ -32,6 +32,7 @@
if (localStorage.fluid == "fluid") this.fluid = "fluid";
if (localStorage.fluid == "") this.fluid = "false";
if (localStorage.darkMode == "true") this.darkMode = true;
+ this.wishindicator = parseInt(this.$refs.wishlistQty.innerText);
this.updateCompareProductsQty();
this.backToTop();
},
@@ -242,20 +243,24 @@
))
},
updateWishlist: function () {
- axios({
- baseURL: '/wishlist',
- method: 'get',
- data: null,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-Response-View': 'Json'
- }
- }).then(response => (
- this.flywish = response.data,
- this.wishlistitems = response.data.Items,
- this.wishindicator = response.data.Items.length
- ))
+ if (parseInt(vm.$refs.wishlistQty.innerText) > 0) {
+ this.loader = true;
+ axios({
+ baseURL: '/wishlist',
+ method: 'get',
+ data: null,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-Response-View': 'Json'
+ }
+ }).then(response => (
+ this.loader = false,
+ this.flywish = response.data,
+ this.wishlistitems = response.data.Items,
+ this.wishindicator = response.data.Items.length
+ ))
+ }
},
getCompareList: function () {
if (this.compareProductsQty > 0) {