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
Warehouse - added to quickview
DanielŻuławski8bd9f605d854
diff --git a/src/Web/Grand.Web/Views/Shared/_PricesQV.cshtml b/src/Web/Grand.Web/Views/Shared/_PricesQV.cshtmlindex 2b3bde236..02bec9b0a 100644--- a/src/Web/Grand.Web/Views/Shared/_PricesQV.cshtml+++ b/src/Web/Grand.Web/Views/Shared/_PricesQV.cshtml@@ -37,7 +37,7 @@</template><template v-if="!(PopupQuickViewVueModal.ProductPrice.IsAuction && PopupQuickViewVueModal.ProductPrice.DisableBuyButton)"><div v-bind:class="{ 'product-price col-12 px-0 d-inline-flex align-items-center': (PopupQuickViewVueModal.ProductPrice.PriceWithDiscount !== null), 'non-discounted-price col-12 px-0 d-flex align-items-center': (PopupQuickViewVueModal.ProductPrice.PriceWithDiscount == null) }">- <span :class="'price-value-' + PopupQuickViewVueModal.ProductPrice.ProductId " v-bind:class="{ 'actual-price': (PopupQuickViewVueModal.ProductPrice.PriceWithDiscount == null) }">+ <span :class="'price-value-' + PopupQuickViewVueModal.ProductPrice.ProductId"><template v-if="PopupQuickViewVueModal.ProductPrice.IsAuction"><strong class="actual-price bid">@Loc["Products.BuyNowPrice"]:</strong></template>diff --git a/src/Web/Grand.Web/Views/Shared/_ProductLayout.QuickViewVue.cshtml b/src/Web/Grand.Web/Views/Shared/_ProductLayout.QuickViewVue.cshtmlindex c22a77cc9..6bd96f1bb 100644--- a/src/Web/Grand.Web/Views/Shared/_ProductLayout.QuickViewVue.cshtml+++ b/src/Web/Grand.Web/Views/Shared/_ProductLayout.QuickViewVue.cshtml@@ -1,4 +1,4 @@-<b-modal id="ModalQuickView" ref="ModalQuickView" :dark-theme="darkMode" @@shown="initReservationQV(), getLinkedProductsQV(PopupQuickViewVueModal.Id)" size="xl" centered hide-footer hide-header>+<b-modal id="ModalQuickView" ref="ModalQuickView" :dark-theme="darkMode" @@shown="initReservationQV()" size="xl" centered hide-footer hide-header><template v-if="PopupQuickViewVueModal !== null"><form method="post" id="product-details-form" :action="'/' + PopupQuickViewVueModal.SeName"><div itemscope itemtype="http://schema.org/Product" :data-productid="PopupQuickViewVueModal.Id">@@ -63,6 +63,10 @@</div></template>+ @* WAREHOUSES *@++ <partial name="_WarehousesQV" />+@* RESERVATIONS *@<partial name="_ReservationInfoQV" />diff --git a/src/Web/Grand.Web/Views/Shared/_WarehousesQV.cshtml b/src/Web/Grand.Web/Views/Shared/_WarehousesQV.cshtmlnew file mode 100644index 000000000..165ff3e81--- /dev/null+++ b/src/Web/Grand.Web/Views/Shared/_WarehousesQV.cshtml@@ -0,0 +1,22 @@+@{+ var warehouseLink = @Url.Action("productdetails_warehousechange", "product");+}+<template v-if="PopupQuickViewVueModal.ProductWarehouses.length > 0">+ <div class="mb-3">+ <label for="warehouseId" class="col-form-label">@Loc["Products.Warehouse"]:</label>+ <template v-if="PopupQuickViewVueModal.ProductAttributes.length > 0">+ <select class="custom-select form-control" name="WarehouseId" id="WarehouseId" @@change="vm.attrchange(PopupQuickViewVueModal.Id)">+ <template v-for="warehouse in PopupQuickViewVueModal.ProductWarehouses">+ <option :selected="warehouse.Selected" :value="warehouse.WarehouseId">{{warehouse.Name}}</option>+ </template>+ </select>+ </template>+ <template v-else>+ <select class="custom-select form-control" name="WarehouseId" id="WarehouseId" @@change="warehouse_change_handler(PopupQuickViewVueModal.Id, '@warehouseLink')">+ <template v-for="warehouse in PopupQuickViewVueModal.ProductWarehouses">+ <option :selected="warehouse.Selected" :value="warehouse.WarehouseId">{{warehouse.Name}}</option>+ </template>+ </select>+ </template>+ </div>+</template>diff --git a/src/Web/Grand.Web/wwwroot/theme/script/app.js b/src/Web/Grand.Web/wwwroot/theme/script/app.jsindex a1767a316..fbab09ad9 100644--- a/src/Web/Grand.Web/wwwroot/theme/script/app.js+++ b/src/Web/Grand.Web/wwwroot/theme/script/app.js@@ -240,11 +240,13 @@})},initReservationQV: function () {- var productId = vm.PopupQuickViewVueModal.Id;- var fullDate = vm.PopupQuickViewVueModal.ReservationFullDate;- var year = vm.PopupQuickViewVueModal.ReservationYear;- var month = vm.PopupQuickViewVueModal.ReservationMonth;- Reservation.init(fullDate, year, month, "No available reservations", "/Product/GetDatesForMonth", productId, "/product/productdetails_attributechange?productId=" + productId + "&validateAttributeConditions=False");+ if (vm.PopupQuickViewVueModal !== null && vm.PopupQuickViewVueModal.ProductType == 20) {+ var productId = vm.PopupQuickViewVueModal.Id;+ var fullDate = vm.PopupQuickViewVueModal.ReservationFullDate;+ var year = vm.PopupQuickViewVueModal.ReservationYear;+ var month = vm.PopupQuickViewVueModal.ReservationMonth;+ Reservation.init(fullDate, year, month, "No available reservations", "/Product/GetDatesForMonth", productId, "/product/productdetails_attributechange?productId=" + productId + "&validateAttributeConditions=False");+ }},getLinkedProductsQV: function (id) {var data = { productId: id };@@ -261,6 +263,25 @@}).then(function (response) {vm.RelatedProducts = response.data;});+ },+ warehouse_change_handler(id, url) {+ var whId = document.getElementById('WarehouseId').value;+ var data = { warehouseId: whId }+ axios({+ url: url + '?productId=' + id,+ data: JSON.stringify(data),+ params: { product: id },+ method: 'post',+ headers: {+ 'Accept': 'application/json',+ 'Content-Type': 'application/json',+ 'X-Response-View': 'Json'+ }+ }).then(function (response) {+ if (response.data.stockAvailability) {+ vm.PopupQuickViewVueModal.StockAvailability = response.data.stockAvailability;+ }+ })}},});diff --git a/src/Web/Grand.Web/wwwroot/theme/script/public.axios.js b/src/Web/Grand.Web/wwwroot/theme/script/public.axios.jsindex a1603816f..ed9727165 100644--- a/src/Web/Grand.Web/wwwroot/theme/script/public.axios.js+++ b/src/Web/Grand.Web/wwwroot/theme/script/public.axios.js@@ -155,7 +155,6 @@ var AxiosCart = {var year = new Date(response.data.model.StartDate).getFullYear();var month = new Date(response.data.model.StartDate).getUTCMonth() + 1;-Object.assign(vm.PopupQuickViewVueModal, { ReservationFullDate: fullDate });Object.assign(vm.PopupQuickViewVueModal, { ReservationYear: year });Object.assign(vm.PopupQuickViewVueModal, { ReservationMonth: month });