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
Add ShippingController to Grand.Web.Store and StoreId support to Admin Shipping for delivery dates, warehouses, pickup points, shipping methods, and restrictions (#702)
Copilot307c7c2b41e0
diff --git a/src/Business/Grand.Business.Checkout/Services/Shipping/DeliveryDateService.cs b/src/Business/Grand.Business.Checkout/Services/Shipping/DeliveryDateService.csindex c8aa1636d..eba13f0e7 100644--- a/src/Business/Grand.Business.Checkout/Services/Shipping/DeliveryDateService.cs+++ b/src/Business/Grand.Business.Checkout/Services/Shipping/DeliveryDateService.cs@@ -1,5 +1,6 @@using Grand.Business.Core.Interfaces.Checkout.Shipping;using Grand.Data;+using Grand.Domain;using Grand.Domain.Shipping;using Grand.Infrastructure.Caching;using Grand.Infrastructure.Caching.Constants;@@ -51,16 +52,19 @@ public class DeliveryDateService : IDeliveryDateService/// <summary>/// Gets all delivery dates/// </summary>+ /// <param name="storeId">Store identifier; empty to return all delivery dates</param>+ /// <param name="pageIndex">Page index</param>+ /// <param name="pageSize">Page size</param>/// <returns>Delivery dates</returns>- public virtual async Task<IList<DeliveryDate>> GetAllDeliveryDates()+ public virtual async Task<IPagedList<DeliveryDate>> GetAllDeliveryDates(string storeId = "", int pageIndex = 0, int pageSize = int.MaxValue){- return await _cacheBase.GetAsync(CacheKey.DELIVERYDATE_ALL, async () =>- {- var query = from dd in _deliveryDateRepository.Table- orderby dd.DisplayOrder- select dd;- return await Task.FromResult(query.ToList());- });+ var query = _deliveryDateRepository.Table;++ if (!string.IsNullOrEmpty(storeId))+ query = query.Where(dd => dd.StoreId == storeId);+ query = query.OrderBy(dd => dd.DisplayOrder);++ return await PagedList<DeliveryDate>.Create(query, pageIndex, pageSize);}/// <summary>diff --git a/src/Business/Grand.Business.Checkout/Services/Shipping/PickupPointService.cs b/src/Business/Grand.Business.Checkout/Services/Shipping/PickupPointService.csindex 202dfefea..137023b7e 100644--- a/src/Business/Grand.Business.Checkout/Services/Shipping/PickupPointService.cs+++ b/src/Business/Grand.Business.Checkout/Services/Shipping/PickupPointService.cs@@ -1,5 +1,6 @@using Grand.Business.Core.Interfaces.Checkout.Shipping;using Grand.Data;+using Grand.Domain;using Grand.Domain.Shipping;using Grand.Infrastructure.Caching;using Grand.Infrastructure.Caching.Constants;@@ -51,16 +52,19 @@ public class PickupPointService : IPickupPointService/// <summary>/// Gets all pickup points/// </summary>+ /// <param name="storeId">Store identifier; empty to return all pickup points</param>+ /// <param name="pageIndex">Page index</param>+ /// <param name="pageSize">Page size</param>/// <returns>Warehouses</returns>- public virtual async Task<IList<PickupPoint>> GetAllPickupPoints()+ public virtual async Task<IPagedList<PickupPoint>> GetAllPickupPoints(string storeId = "", int pageIndex = 0, int pageSize = int.MaxValue){- return await _cacheBase.GetAsync(CacheKey.PICKUPPOINTS_ALL, async () =>- {- var query = from pp in _pickupPointsRepository.Table- orderby pp.DisplayOrder- select pp;- return await Task.FromResult(query.ToList());- });+ var query = _pickupPointsRepository.Table;++ if (!string.IsNullOrEmpty(storeId))+ query = query.Where(pp => pp.StoreId == storeId);++ query = query.OrderBy(pp => pp.DisplayOrder);+ return await PagedList<PickupPoint>.Create(query, pageIndex, pageSize);}/// <summary>diff --git a/src/Business/Grand.Business.Checkout/Services/Shipping/ShippingMethodService.cs b/src/Business/Grand.Business.Checkout/Services/Shipping/ShippingMethodService.csindex b1df7253d..064ab2785 100644--- a/src/Business/Grand.Business.Checkout/Services/Shipping/ShippingMethodService.cs+++ b/src/Business/Grand.Business.Checkout/Services/Shipping/ShippingMethodService.cs@@ -72,17 +72,19 @@ public class ShippingMethodService : IShippingMethodService/// </summary>/// <param name="filterByCountryId">The country ident to filter by</param>/// <param name="customer"></param>+ /// <param name="storeId">The store identifier to filter by</param>/// <returns>Shipping methods</returns>public virtual async Task<IList<ShippingMethod>> GetAllShippingMethods(string filterByCountryId = "",- Customer customer = null)+ Customer customer = null, string storeId = ""){- var shippingMethods = await _cacheBase.GetAsync(CacheKey.SHIPPINGMETHOD_ALL, async () =>- {- var query = from sm in _shippingMethodRepository.Table- orderby sm.DisplayOrder- select sm;- return await Task.FromResult(query.ToList());- });+ var query = _shippingMethodRepository.Table;++ if (!string.IsNullOrEmpty(storeId))+ query = query.Where(sm => sm.StoreId == storeId || string.IsNullOrEmpty(sm.StoreId));++ query = query.OrderBy(sm => sm.DisplayOrder);++ var shippingMethods = await Task.FromResult(query.ToList());if (!string.IsNullOrEmpty(filterByCountryId))shippingMethods = shippingMethods.Where(x => !x.CountryRestrictionExists(filterByCountryId)).ToList();diff --git a/src/Business/Grand.Business.Checkout/Services/Shipping/WarehouseService.cs b/src/Business/Grand.Business.Checkout/Services/Shipping/WarehouseService.csindex 15d12b870..ab8bfaa2a 100644--- a/src/Business/Grand.Business.Checkout/Services/Shipping/WarehouseService.cs+++ b/src/Business/Grand.Business.Checkout/Services/Shipping/WarehouseService.cs@@ -1,5 +1,6 @@using Grand.Business.Core.Interfaces.Checkout.Shipping;using Grand.Data;+using Grand.Domain;using Grand.Domain.Shipping;using Grand.Infrastructure.Caching;using Grand.Infrastructure.Caching.Constants;@@ -51,16 +52,19 @@ public class WarehouseService : IWarehouseService/// <summary>/// Gets all warehouses/// </summary>+ /// <param name="storeId">Store identifier; empty to return all warehouses</param>+ /// <param name="pageIndex">Page index</param>+ /// <param name="pageSize">Page size</param>/// <returns>Warehouses</returns>- public virtual async Task<IList<Warehouse>> GetAllWarehouses()+ public virtual async Task<IPagedList<Warehouse>> GetAllWarehouses(string storeId = "", int pageIndex = 0, int pageSize = int.MaxValue){- return await _cacheBase.GetAsync(CacheKey.WAREHOUSES_ALL, async () =>- {- var query = from wh in _warehouseRepository.Table- orderby wh.DisplayOrder- select wh;- return await Task.FromResult(query.ToList());- });+ var query = _warehouseRepository.Table;++ if (!string.IsNullOrEmpty(storeId))+ query = query.Where(wh => wh.StoreId == storeId);+ query = query.OrderBy(wh => wh.DisplayOrder);++ return await PagedList<Warehouse>.Create(query, pageIndex, pageSize);}/// <summary>diff --git a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IDeliveryDateService.cs b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IDeliveryDateService.csindex a045d1a17..94e6162d0 100644--- a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IDeliveryDateService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IDeliveryDateService.cs@@ -1,4 +1,5 @@-using Grand.Domain.Shipping;+using Grand.Domain;+using Grand.Domain.Shipping;namespace Grand.Business.Core.Interfaces.Checkout.Shipping;@@ -14,8 +15,11 @@ public interface IDeliveryDateService/// <summary>/// Gets all delivery dates/// </summary>+ /// <param name="storeId">Store identifier; empty to return all delivery dates</param>+ /// <param name="pageIndex">Page index</param>+ /// <param name="pageSize">Page size</param>/// <returns>Delivery dates</returns>- Task<IList<DeliveryDate>> GetAllDeliveryDates();+ Task<IPagedList<DeliveryDate>> GetAllDeliveryDates(string storeId = "", int pageIndex = 0, int pageSize = int.MaxValue);/// <summary>/// Inserts a delivery datediff --git a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IPickupPointService.cs b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IPickupPointService.csindex 51f2db5e3..1d1aadea9 100644--- a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IPickupPointService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IPickupPointService.cs@@ -1,4 +1,5 @@-using Grand.Domain.Shipping;+using Grand.Domain;+using Grand.Domain.Shipping;namespace Grand.Business.Core.Interfaces.Checkout.Shipping;@@ -14,8 +15,11 @@ public interface IPickupPointService/// <summary>/// Gets all pickup points/// </summary>+ /// <param name="storeId">Store identifier; empty to return all pickup points</param>+ /// <param name="pageIndex">Page index</param>+ /// <param name="pageSize">Page size</param>/// <returns>PickupPoints</returns>- Task<IList<PickupPoint>> GetAllPickupPoints();+ Task<IPagedList<PickupPoint>> GetAllPickupPoints(string storeId = "", int pageIndex = 0, int pageSize = int.MaxValue);/// <summary>/// Gets active pickup pointsdiff --git a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShippingMethodService.cs b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShippingMethodService.csindex 0c2db327a..bc2d7e11a 100644--- a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShippingMethodService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShippingMethodService.cs@@ -18,8 +18,9 @@ public interface IShippingMethodService/// </summary>/// <param name="filterByCountryId">The country identifier to filter by</param>/// <param name="customer"></param>+ /// <param name="storeId">The store identifier to filter by</param>/// <returns>Shipping methods</returns>- Task<IList<ShippingMethod>> GetAllShippingMethods(string filterByCountryId = "", Customer customer = null);+ Task<IList<ShippingMethod>> GetAllShippingMethods(string filterByCountryId = "", Customer customer = null, string storeId = "");/// <summary>/// Inserts a shipping methoddiff --git a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IWarehouseService.cs b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IWarehouseService.csindex fd7cef34c..a47591d94 100644--- a/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IWarehouseService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IWarehouseService.cs@@ -1,4 +1,5 @@-using Grand.Domain.Shipping;+using Grand.Domain;+using Grand.Domain.Shipping;namespace Grand.Business.Core.Interfaces.Checkout.Shipping;@@ -14,8 +15,11 @@ public interface IWarehouseService/// <summary>/// Gets all warehouses/// </summary>+ /// <param name="storeId">Store identifier; empty to return all warehouses</param>+ /// <param name="pageIndex">Page index</param>+ /// <param name="pageSize">Page size</param>/// <returns>Warehouses</returns>- Task<IList<Warehouse>> GetAllWarehouses();+ Task<IPagedList<Warehouse>> GetAllWarehouses(string storeId = "", int pageIndex = 0, int pageSize = int.MaxValue);/// <summary>/// Inserts a warehousediff --git a/src/Core/Grand.Domain/Shipping/DeliveryDate.cs b/src/Core/Grand.Domain/Shipping/DeliveryDate.csindex c81289bf7..70a151649 100644--- a/src/Core/Grand.Domain/Shipping/DeliveryDate.cs+++ b/src/Core/Grand.Domain/Shipping/DeliveryDate.cs@@ -26,4 +26,9 @@ public class DeliveryDate : BaseEntity, ITranslationEntity/// Gets or sets the collection of locales/// </summary>public IList<TranslationEntity> Locales { get; set; } = new List<TranslationEntity>();++ /// <summary>+ /// Gets or sets the store identifier. Empty means available to all stores.+ /// </summary>+ public string StoreId { get; set; }}\ No newline at end of filediff --git a/src/Core/Grand.Domain/Shipping/ShippingMethod.cs b/src/Core/Grand.Domain/Shipping/ShippingMethod.csindex 7a907089e..060c45f00 100644--- a/src/Core/Grand.Domain/Shipping/ShippingMethod.cs+++ b/src/Core/Grand.Domain/Shipping/ShippingMethod.cs@@ -46,4 +46,9 @@ public class ShippingMethod : BaseEntity, ITranslationEntity/// Gets or sets the collection of locales/// </summary>public IList<TranslationEntity> Locales { get; set; } = new List<TranslationEntity>();++ /// <summary>+ /// Gets or sets the store identifier. Empty means available to all stores.+ /// </summary>+ public string StoreId { get; set; }}\ No newline at end of filediff --git a/src/Core/Grand.Domain/Shipping/Warehouse.cs b/src/Core/Grand.Domain/Shipping/Warehouse.csindex d39645359..0422da638 100644--- a/src/Core/Grand.Domain/Shipping/Warehouse.cs+++ b/src/Core/Grand.Domain/Shipping/Warehouse.cs@@ -41,4 +41,9 @@ public class Warehouse : BaseEntity/// Gets or sets the display order/// </summary>public int DisplayOrder { get; set; }++ /// <summary>+ /// Gets or sets the store identifier. Empty means available to all stores.+ /// </summary>+ public string StoreId { get; set; }}\ No newline at end of filediff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.csindex 469f91791..98660c4e5 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs@@ -16,6 +16,7 @@ using Grand.Business.Core.Interfaces.Common.Seo;using Grand.Business.Core.Interfaces.Storage;using Grand.Data;using Grand.Data.Tests.MongoDb;+using Grand.Domain;using Grand.Domain.Catalog;using Grand.Domain.Customers;using Grand.Domain.Directory;@@ -117,8 +118,8 @@ public class ProductImportDataObjectTests_deliveryDateServiceMock.Setup(c => c.GetDeliveryDateById(It.IsAny<string>())).Returns(Task.FromResult(new DeliveryDate()));- _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates())- .Returns(Task.FromResult<IList<DeliveryDate>>(new List<DeliveryDate> { new() }));+ _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))+ .Returns(Task.FromResult<IPagedList<DeliveryDate>>(new PagedList<DeliveryDate>(new List<DeliveryDate> { new() }, 0, int.MaxValue)));_taxServiceMock.Setup(c => c.GetTaxCategoryById(It.IsAny<string>())).Returns(Task.FromResult(new TaxCategory()));@@ -127,8 +128,8 @@ public class ProductImportDataObjectTests_warehouseServiceMock.Setup(c => c.GetWarehouseById(It.IsAny<string>())).Returns(Task.FromResult(new Warehouse()));- _warehouseServiceMock.Setup(c => c.GetAllWarehouses())- .Returns(Task.FromResult<IList<Warehouse>>(new List<Warehouse> { new() }));+ _warehouseServiceMock.Setup(c => c.GetAllWarehouses(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))+ .Returns(Task.FromResult<IPagedList<Warehouse>>(new PagedList<Warehouse>(new List<Warehouse> { new() }, 0, int.MaxValue)));_measureServiceMock.Setup(c => c.GetMeasureUnitById(It.IsAny<string>())).Returns(Task.FromResult(new MeasureUnit()));@@ -180,8 +181,8 @@ public class ProductImportDataObjectTests_deliveryDateServiceMock.Setup(c => c.GetDeliveryDateById(It.IsAny<string>())).Returns(Task.FromResult(new DeliveryDate()));- _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates())- .Returns(Task.FromResult<IList<DeliveryDate>>(new List<DeliveryDate> { new() }));+ _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))+ .Returns(Task.FromResult<IPagedList<DeliveryDate>>(new PagedList<DeliveryDate>(new List<DeliveryDate> { new() }, 0, int.MaxValue)));_taxServiceMock.Setup(c => c.GetTaxCategoryById(It.IsAny<string>())).Returns(Task.FromResult(new TaxCategory()));@@ -190,8 +191,8 @@ public class ProductImportDataObjectTests_warehouseServiceMock.Setup(c => c.GetWarehouseById(It.IsAny<string>())).Returns(Task.FromResult(new Warehouse()));- _warehouseServiceMock.Setup(c => c.GetAllWarehouses())- .Returns(Task.FromResult<IList<Warehouse>>(new List<Warehouse> { new() }));+ _warehouseServiceMock.Setup(c => c.GetAllWarehouses(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))+ .Returns(Task.FromResult<IPagedList<Warehouse>>(new PagedList<Warehouse>(new List<Warehouse> { new() }, 0, int.MaxValue)));_measureServiceMock.Setup(c => c.GetMeasureUnitById(It.IsAny<string>())).Returns(Task.FromResult(new MeasureUnit()));@@ -234,8 +235,8 @@ public class ProductImportDataObjectTests_deliveryDateServiceMock.Setup(c => c.GetDeliveryDateById(It.IsAny<string>())).Returns(Task.FromResult(new DeliveryDate()));- _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates())- .Returns(Task.FromResult<IList<DeliveryDate>>(new List<DeliveryDate> { new() }));+ _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))+ .Returns(Task.FromResult<IPagedList<DeliveryDate>>(new PagedList<DeliveryDate>(new List<DeliveryDate> { new() }, 0, int.MaxValue)));_taxServiceMock.Setup(c => c.GetTaxCategoryById(It.IsAny<string>())).Returns(Task.FromResult(new TaxCategory()));@@ -244,8 +245,8 @@ public class ProductImportDataObjectTests_warehouseServiceMock.Setup(c => c.GetWarehouseById(It.IsAny<string>())).Returns(Task.FromResult(new Warehouse()));- _warehouseServiceMock.Setup(c => c.GetAllWarehouses())- .Returns(Task.FromResult<IList<Warehouse>>(new List<Warehouse> { new() }));+ _warehouseServiceMock.Setup(c => c.GetAllWarehouses(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))+ .Returns(Task.FromResult<IPagedList<Warehouse>>(new PagedList<Warehouse>(new List<Warehouse> { new() }, 0, int.MaxValue)));_measureServiceMock.Setup(c => c.GetMeasureUnitById(It.IsAny<string>())).Returns(Task.FromResult(new MeasureUnit()));diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/DeliveryDates.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/DeliveryDates.cshtmlindex e208abef2..9bb949940 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/DeliveryDates.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/DeliveryDates.cshtml@@ -74,6 +74,10 @@title: "@Loc["Admin.Configuration.Shipping.DeliveryDates.Fields.Name"]",width: 300,template: '<a class="k-link" href="EditDeliveryDate/#=Id#">#=kendo.htmlEncode(Name)#</a>',+ }, {+ field: "StoreName",+ title: "@Loc["Admin.Configuration.Shipping.DeliveryDates.Fields.Store"]",+ width: 200}, {field: "DisplayOrder",title: "@Loc["Admin.Configuration.Shipping.DeliveryDates.Fields.DisplayOrder"]",diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Methods.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Methods.cshtmlindex 85ab20dd4..17a577506 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Methods.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Methods.cshtml@@ -78,6 +78,10 @@field: "Description",title: "@Loc["Admin.Configuration.Shipping.Methods.Fields.Description"]",width: 400+ }, {+ field: "StoreName",+ title: "@Loc["Admin.Configuration.Shipping.Methods.Fields.Store"]",+ width: 200},{field: "DisplayOrder",title: "@Loc["Admin.Configuration.Shipping.Methods.Fields.DisplayOrder"]",diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtmlindex 6cf68a374..6685d6d62 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml@@ -59,6 +59,13 @@<span asp-validation-for="DisplayOrder"></span></div></div>+ <div class="form-group">+ <admin-label asp-for="StoreId"/>+ <div class="col-md-9 col-sm-9">+ <admin-select asp-for="StoreId" asp-items="Model.AvailableStores"/>+ <span asp-validation-for="StoreId"></span>+ </div>+ </div></div></div><vc:admin-widget widget-zone="delivery_date_details_bottom" additional-data="Model"/>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateMethod.cshtmlindex 52f2d8821..18cbc85f4 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml@@ -55,6 +55,13 @@<span asp-validation-for="DisplayOrder"></span></div></div>+ <div class="form-group">+ <admin-label asp-for="StoreId"/>+ <div class="col-md-9 col-sm-9">+ <admin-select asp-for="StoreId" asp-items="Model.AvailableStores"/>+ <span asp-validation-for="StoreId"></span>+ </div>+ </div></div></div><vc:admin-widget widget-zone="shipping_method_details_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtmlindex ba77bdf4b..5e9c37311 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml@@ -50,6 +50,13 @@<span asp-validation-for="DisplayOrder"></span></div></div>+ <div class="form-group">+ <admin-label asp-for="StoreId"/>+ <div class="col-md-9 col-sm-9">+ <admin-select asp-for="StoreId" asp-items="Model.AvailableStores"/>+ <span asp-validation-for="StoreId"></span>+ </div>+ </div></div><vc:admin-widget widget-zone="warehouse_details_bottom" additional-data="Model"/></div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/PickupPoints.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/PickupPoints.cshtmlindex bfee2d048..bd021a43b 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/PickupPoints.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/PickupPoints.cshtml@@ -73,6 +73,10 @@title: "@Loc["Admin.Configuration.Shipping.PickupPoint.Fields.Name"]",template: '<a class="k-link" href="EditPickupPoint/#=Id#">#=kendo.htmlEncode(Name)#</a>',},+ {+ field: "StoreName",+ title: "@Loc["Admin.Configuration.Shipping.PickupPoint.Fields.Stores"]",+ },{field: "Description",title: "@Loc["Admin.Configuration.Shipping.PickupPoint.Fields.Description"]"diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Restrictions.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Restrictions.cshtmlindex 302bc9ac0..536b9e504 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Restrictions.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Restrictions.cshtml@@ -5,6 +5,7 @@ViewBag.Title = Loc["Admin.Configuration.Shipping.Restrictions"];}<form asp-area="@Constants.AreaAdmin" asp-controller="Shipping" asp-action="Restrictions" method="post">+ <input type="hidden" asp-for="StoreId" /><div class="row"><div class="col-md-12">@@ -22,6 +23,22 @@</div></div><div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <label class="col-md-3 control-label">@Loc["Admin.Configuration.Shipping.Methods.Fields.Store"]</label>+ <div class="col-md-9 col-sm-9">+ <select id="storeFilter" class="form-control"+ onchange="window.location='@Url.Action("Restrictions", "Shipping", new { area = Constants.AreaAdmin })' + '?storeId=' + this.value">+ @foreach (var s in Model.AvailableStores)+ {+ <option selected="@s.Selected" value="@s.Value">@s.Text</option>+ }+ </select>+ </div>+ </div>+ </div>+ </div><admin-tabstrip name="shippingrestriction-edit"><items><tabstrip-item text="@Loc["Admin.Configuration.Shipping.Restrictions.Country"]" tab-index="0">diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Warehouses.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Warehouses.cshtmlindex 3fe994bc3..fc3c8028d 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Warehouses.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Warehouses.cshtml@@ -79,6 +79,10 @@title: "@Loc["Admin.Configuration.Shipping.Warehouses.Fields.Name"]",template: '<a class="k-link" href="EditWarehouse/#=Id#">#=kendo.htmlEncode(Name)#</a>',},+ {+ field: "StoreName",+ title: "@Loc["Admin.Configuration.Shipping.Warehouses.Fields.Store"]",+ },{field: "DisplayOrder",title: "@Loc["Admin.Configuration.Shipping.Warehouses.Fields.DisplayOrder"]",diff --git a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs b/src/Web/Grand.Web.Admin/Controllers/ShippingController.csindex 7724c6d6d..8f92de5fb 100644--- a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs@@ -99,6 +99,36 @@ public class ShippingController : BaseAdminControllermodel.Address.PhoneEnabled = true;model.Address.FaxEnabled = true;model.Address.CompanyEnabled = true;++ model.AvailableStores.Add(new SelectListItem {+ Text = _translationService.GetResource("Admin.Configuration.Shipping.Warehouses.SelectStore"), Value = ""+ });+ foreach (var s in await _storeService.GetAllStores())+ model.AvailableStores.Add(new SelectListItem {+ Text = s.Shortcut, Value = s.Id, Selected = s.Id == model.StoreId+ });+ }++ protected virtual async Task PrepareDeliveryDateModel(DeliveryDateModel model)+ {+ model.AvailableStores.Add(new SelectListItem {+ Text = _translationService.GetResource("Admin.Configuration.Shipping.DeliveryDates.SelectStore"), Value = ""+ });+ foreach (var s in await _storeService.GetAllStores())+ model.AvailableStores.Add(new SelectListItem {+ Text = s.Shortcut, Value = s.Id, Selected = s.Id == model.StoreId+ });+ }++ protected virtual async Task PrepareShippingMethodModel(ShippingMethodModel model)+ {+ model.AvailableStores.Add(new SelectListItem {+ Text = _translationService.GetResource("Admin.Configuration.Shipping.Methods.SelectStore"), Value = ""+ });+ foreach (var s in await _storeService.GetAllStores())+ model.AvailableStores.Add(new SelectListItem {+ Text = s.Shortcut, Value = s.Id, Selected = s.Id == model.StoreId+ });}protected virtual async Task PreparePickupPointModel(PickupPointModel model)@@ -131,7 +161,7 @@ public class ShippingController : BaseAdminControllerText = _translationService.GetResource("Admin.Configuration.Shipping.PickupPoint.SelectStore"), Value = ""});foreach (var c in await _storeService.GetAllStores())- model.AvailableStores.Add(new SelectListItem { Text = c.Shortcut, Value = c.Id });+ model.AvailableStores.Add(new SelectListItem { Text = c.Shortcut, Value = c.Id, Selected = c.Id == model.StoreId });model.AvailableWarehouses.Add(new SelectListItem {Text = _translationService.GetResource("Admin.Configuration.Shipping.PickupPoint.SelectWarehouse"),@@ -216,8 +246,13 @@ public class ShippingController : BaseAdminController[HttpPost]public async Task<IActionResult> Methods(DataSourceRequest command){+ var storeMap = (await _storeService.GetAllStores()).ToDictionary(s => s.Id, s => s.Shortcut);var shippingMethodsModel = (await _shippingMethodService.GetAllShippingMethods())- .Select(x => x.ToModel())+ .Select(x => {+ var m = x.ToModel();+ m.StoreName = !string.IsNullOrEmpty(x.StoreId) && storeMap.TryGetValue(x.StoreId, out var name) ? name : "";+ return m;+ }).ToList();var gridModel = new DataSourceResult {Data = shippingMethodsModel,@@ -233,6 +268,7 @@ public class ShippingController : BaseAdminControllervar model = new ShippingMethodModel();//localesawait AddLocales(_languageService, model.Locales);+ await PrepareShippingMethodModel(model);return View(model);}@@ -250,6 +286,7 @@ public class ShippingController : BaseAdminController}//If we got this far, something failed, redisplay form+ await PrepareShippingMethodModel(model);return View(model);}@@ -267,7 +304,7 @@ public class ShippingController : BaseAdminControllerlocale.Name = sm.GetTranslation(x => x.Name, languageId, false);locale.Description = sm.GetTranslation(x => x.Description, languageId, false);});-+ await PrepareShippingMethodModel(model);return View(model);}@@ -290,6 +327,7 @@ public class ShippingController : BaseAdminController}//If we got this far, something failed, redisplay form+ await PrepareShippingMethodModel(model);return View(model);}@@ -377,8 +415,13 @@ public class ShippingController : BaseAdminController[HttpPost]public async Task<IActionResult> DeliveryDates(DataSourceRequest command){+ var storeMap = (await _storeService.GetAllStores()).ToDictionary(s => s.Id, s => s.Shortcut);var deliveryDatesModel = (await _deliveryDateService.GetAllDeliveryDates())- .Select(x => x.ToModel())+ .Select(x => {+ var m = x.ToModel();+ m.StoreName = !string.IsNullOrEmpty(x.StoreId) && storeMap.TryGetValue(x.StoreId, out var name) ? name : "";+ return m;+ }).ToList();var gridModel = new DataSourceResult {Data = deliveryDatesModel,@@ -395,6 +438,7 @@ public class ShippingController : BaseAdminController};//localesawait AddLocales(_languageService, model.Locales);+ await PrepareDeliveryDateModel(model);return View(model);}@@ -413,6 +457,7 @@ public class ShippingController : BaseAdminController}//If we got this far, something failed, redisplay form+ await PrepareDeliveryDateModel(model);return View(model);}@@ -433,6 +478,7 @@ public class ShippingController : BaseAdminControllerlocale.Name = deliveryDate.GetTranslation(x => x.Name, languageId, false);});+ await PrepareDeliveryDateModel(model);return View(model);}@@ -456,8 +502,8 @@ public class ShippingController : BaseAdminController: RedirectToAction("DeliveryDates");}-//If we got this far, something failed, redisplay form+ await PrepareDeliveryDateModel(model);return View(model);}@@ -492,8 +538,13 @@ public class ShippingController : BaseAdminController[HttpPost]public async Task<IActionResult> Warehouses(DataSourceRequest command){+ var storeMap = (await _storeService.GetAllStores()).ToDictionary(s => s.Id, s => s.Shortcut);var warehousesModel = (await _warehouseService.GetAllWarehouses())- .Select(x => x.ToModel())+ .Select(x => {+ var m = x.ToModel();+ m.StoreName = !string.IsNullOrEmpty(x.StoreId) && storeMap.TryGetValue(x.StoreId, out var name) ? name : "";+ return m;+ }).ToList();var gridModel = new DataSourceResult {Data = warehousesModel,@@ -594,8 +645,13 @@ public class ShippingController : BaseAdminController[HttpPost]public async Task<IActionResult> PickupPoints(DataSourceRequest command){+ var storeMap = (await _storeService.GetAllStores()).ToDictionary(s => s.Id, s => s.Shortcut);var pickupPointsModel = (await _pickupPointService.GetAllPickupPoints())- .Select(x => x.ToModel())+ .Select(x => {+ var m = x.ToModel();+ m.StoreName = !string.IsNullOrEmpty(x.StoreId) && storeMap.TryGetValue(x.StoreId, out var name) ? name : "";+ return m;+ }).ToList();var gridModel = new DataSourceResult {@@ -690,12 +746,18 @@ public class ShippingController : BaseAdminController#region Restrictions- public async Task<IActionResult> Restrictions()+ public async Task<IActionResult> Restrictions(string storeId = ""){var model = new ShippingMethodRestrictionModel();+ var stores = await _storeService.GetAllStores();+ model.StoreId = storeId;+ model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });+ foreach (var s in stores)+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id, Selected = s.Id == storeId });+var countries = await _countryService.GetAllCountries(showHidden: true);- var shippingMethods = await _shippingMethodService.GetAllShippingMethods();+ var shippingMethods = await _shippingMethodService.GetAllShippingMethods(storeId);var customerGroups = await _groupService.GetAllCustomerGroups();foreach (var country in countries)@@ -736,10 +798,10 @@ public class ShippingController : BaseAdminController[HttpPost][ActionName("Restrictions")][RequestFormLimits(ValueCountLimit = 2048)]- public async Task<IActionResult> RestrictionSave(IDictionary<string, string[]> model)+ public async Task<IActionResult> RestrictionSave(IDictionary<string, string[]> model, string storeId = ""){var countries = await _countryService.GetAllCountries(showHidden: true);- var shippingMethods = await _shippingMethodService.GetAllShippingMethods();+ var shippingMethods = await _shippingMethodService.GetAllShippingMethods(storeId);var customerGroups = await _groupService.GetAllCustomerGroups();foreach (var shippingMethod in shippingMethods){@@ -751,7 +813,7 @@ public class ShippingController : BaseAdminController//selected tabawait SaveSelectedTabIndex();- return RedirectToAction("Restrictions");+ return RedirectToAction("Restrictions", new { storeId });}private async Task SaveRestrictedGroup(IDictionary<string, string[]> model, ShippingMethod shippingMethod,diff --git a/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs b/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.csindex 53c02f22e..8a3da1eea 100644--- a/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs+++ b/src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs@@ -11,12 +11,14 @@ public class ShippingMethodProfile : Profile, IAutoMapperProfilepublic ShippingMethodProfile(){CreateMap<ShippingMethod, ShippingMethodModel>()- .ForMember(dest => dest.Locales, mo => mo.Ignore());+ .ForMember(dest => dest.Locales, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableStores, mo => mo.Ignore());CreateMap<ShippingMethodModel, ShippingMethod>().ForMember(dest => dest.Id, mo => mo.Ignore()).ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()))- .ForMember(dest => dest.RestrictedCountries, mo => mo.Ignore());+ .ForMember(dest => dest.RestrictedCountries, mo => mo.Ignore())+ .ForMember(dest => dest.RestrictedGroups, mo => mo.Ignore());}public int Order => 0;diff --git a/src/Web/Grand.Web.AdminShared/Models/Shipping/DeliveryDateModel.cs b/src/Web/Grand.Web.AdminShared/Models/Shipping/DeliveryDateModel.csindex d20b4bd60..ee9b19f4e 100644--- a/src/Web/Grand.Web.AdminShared/Models/Shipping/DeliveryDateModel.cs+++ b/src/Web/Grand.Web.AdminShared/Models/Shipping/DeliveryDateModel.cs@@ -1,6 +1,7 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;using Grand.Web.Common.Models;+using Microsoft.AspNetCore.Mvc.Rendering;namespace Grand.Web.AdminShared.Models.Shipping;@@ -18,6 +19,13 @@ public class DeliveryDateModel : BaseEntityModel, ILocalizedModel<DeliveryDateLopublic string ColorSquaresRgb { get; set; }public IList<DeliveryDateLocalizedModel> Locales { get; set; } = new List<DeliveryDateLocalizedModel>();++ [GrandResourceDisplayName("Admin.Configuration.Shipping.DeliveryDates.Fields.Store")]+ public IList<SelectListItem> AvailableStores { get; set; } = new List<SelectListItem>();++ public string StoreId { get; set; }++ public string StoreName { get; set; }}public class DeliveryDateLocalizedModel : ILocalizedModelLocaldiff --git a/src/Web/Grand.Web.AdminShared/Models/Shipping/PickupPointModel.cs b/src/Web/Grand.Web.AdminShared/Models/Shipping/PickupPointModel.csindex 5e1000417..2ef2d8501 100644--- a/src/Web/Grand.Web.AdminShared/Models/Shipping/PickupPointModel.cs+++ b/src/Web/Grand.Web.AdminShared/Models/Shipping/PickupPointModel.cs@@ -35,6 +35,8 @@ public class PickupPointModel : BaseEntityModelpublic string StoreId { get; set; }+ public string StoreName { get; set; }+[GrandResourceDisplayName("Admin.Configuration.Shipping.PickupPoint.Fields.PickupFee")]public double PickupFee { get; set; }diff --git a/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodModel.cs b/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodModel.csindex 48151cb96..b6b994647 100644--- a/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodModel.cs+++ b/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodModel.cs@@ -1,6 +1,7 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;using Grand.Web.Common.Models;+using Microsoft.AspNetCore.Mvc.Rendering;namespace Grand.Web.AdminShared.Models.Shipping;@@ -18,6 +19,13 @@ public class ShippingMethodModel : BaseEntityModel, ILocalizedModel<ShippingMethpublic int DisplayOrder { get; set; }public IList<ShippingMethodLocalizedModel> Locales { get; set; } = new List<ShippingMethodLocalizedModel>();++ [GrandResourceDisplayName("Admin.Configuration.Shipping.Methods.Fields.Store")]+ public IList<SelectListItem> AvailableStores { get; set; } = new List<SelectListItem>();++ public string StoreId { get; set; }++ public string StoreName { get; set; }}public class ShippingMethodLocalizedModel : ILocalizedModelLocaldiff --git a/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodRestrictionModel.cs b/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodRestrictionModel.csindex c29147db0..f792a133d 100644--- a/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodRestrictionModel.cs+++ b/src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodRestrictionModel.cs@@ -1,6 +1,7 @@using Grand.Infrastructure.Models;using Grand.Web.AdminShared.Models.Directory;using Grand.Web.Common.Models;+using Microsoft.AspNetCore.Mvc.Rendering;namespace Grand.Web.AdminShared.Models.Shipping;@@ -10,6 +11,9 @@ public class ShippingMethodRestrictionModel : BaseModelpublic IList<CountryModel> AvailableCountries { get; set; } = new List<CountryModel>();public IList<CustomerGroupModel> AvailableCustomerGroups { get; set; } = new List<CustomerGroupModel>();+ public string StoreId { get; set; }+ public IList<SelectListItem> AvailableStores { get; set; } = new List<SelectListItem>();+//[country id] / [shipping method id] / [restricted]public IDictionary<string, IDictionary<string, bool>> Restricted { get; set; } =new Dictionary<string, IDictionary<string, bool>>();diff --git a/src/Web/Grand.Web.AdminShared/Models/Shipping/WarehouseModel.cs b/src/Web/Grand.Web.AdminShared/Models/Shipping/WarehouseModel.csindex 153ca8bd8..4f00c111e 100644--- a/src/Web/Grand.Web.AdminShared/Models/Shipping/WarehouseModel.cs+++ b/src/Web/Grand.Web.AdminShared/Models/Shipping/WarehouseModel.cs@@ -1,6 +1,7 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;using Grand.Web.AdminShared.Models.Common;+using Microsoft.AspNetCore.Mvc.Rendering;namespace Grand.Web.AdminShared.Models.Shipping;@@ -26,4 +27,11 @@ public class WarehouseModel : BaseEntityModel[GrandResourceDisplayName("Admin.Configuration.Shipping.Warehouses.Fields.DisplayOrder")]public int DisplayOrder { get; set; }++ [GrandResourceDisplayName("Admin.Configuration.Shipping.Warehouses.Fields.Store")]+ public IList<SelectListItem> AvailableStores { get; set; } = new List<SelectListItem>();++ public string StoreId { get; set; }++ public string StoreName { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.csindex 9e75ecc3a..8a61e1b01 100644--- a/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs+++ b/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs@@ -30,7 +30,6 @@ using Grand.Web.Common.Extensions;using Grand.Web.Common.Localization;using Microsoft.AspNetCore.Mvc.Rendering;using System.Net;-using System.Text;using ProductExtensions = Grand.Domain.Catalog.ProductExtensions;namespace Grand.Web.AdminShared.Services;@@ -249,8 +248,7 @@ public class ProductViewModelService({ArgumentNullException.ThrowIfNull(model);- model.PrimaryStoreCurrencyCode =- (await currencyService.GetCurrencyById(currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;+ model.PrimaryStoreCurrencyCode = (await currencyService.GetCurrencyById(currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;model.BaseWeightIn = (await measureService.GetMeasureWeightById(measureSettings.BaseWeightId))?.Name;model.BaseDimensionIn = (await measureService.GetMeasureDimensionById(measureSettings.BaseDimensionId))?.Name;@@ -307,7 +305,7 @@ public class ProductViewModelService(Text = translationService.GetResource("Admin.Catalog.Products.Fields.DeliveryDate.None"),Value = ""});- var deliveryDates = await deliveryDateService.GetAllDeliveryDates();+ var deliveryDates = await deliveryDateService.GetAllDeliveryDates(model.StoreId);foreach (var deliveryDate in deliveryDates)model.AvailableDeliveryDates.Add(new SelectListItem {Text = deliveryDate.Name,@@ -315,7 +313,7 @@ public class ProductViewModelService(});//warehouses- var warehouses = await warehouseService.GetAllWarehouses();+ var warehouses = await warehouseService.GetAllWarehouses(model.StoreId);model.AvailableWarehouses.Add(new SelectListItem {Text = translationService.GetResource("Admin.Catalog.Products.Fields.Warehouse.None"),Value = ""@@ -438,7 +436,7 @@ public class ProductViewModelService(if (!product.UseMultipleWarehouses)return;- var warehouses = await warehouseService.GetAllWarehouses();+ var warehouses = await warehouseService.GetAllWarehouses(product.Stores.Count == 1 ? product.Stores.First() : null);foreach (var warehouse in warehouses){@@ -706,8 +704,6 @@ public class ProductViewModelService(//warehousesawait SaveProductWarehouseInventory(product, model.ProductWarehouseInventoryModels);--await productService.UpdateProduct(product);return product;diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtmlindex bee83c203..3d5fe2803 100644--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml@@ -71,29 +71,6 @@<span asp-validation-for="StoreInformationSettings.DefaultStoreTheme"></span></div></div>-<div class="form-group">- <div class="col-8 col-md-4 col-sm-4 text-right">- <label class="control-label">- @Loc["Admin.Settings.GeneralCommon.PremiumThemes"]- <i class="help icon-question" data-container="body" data-placement="top" data-toggle="tooltip" title="" data-original-title="You can download themes from the extensions page at www.grandnode.com."></i>- </label>- </div>- <div class="col-4 col-md-8 col-sm-8" id="premium_themes">- <script>- $.getJSON("https://grandnode.com/themes.json", function (data) {- var items = [];- $.each(data, function (key, value) {- items.push("<li id='theme-" + key + "'><a href='" + value.Url + "' target='_blank' ><img src='" + value.PictureUrl + "' /><span>" + value.Name + "<span></a></li>");- });-- $("<ul/>", {- "class": "premium-list",- html: items.join("")- }).appendTo("#premium_themes");- });- </script>- </div>-</div><div class="form-group"><div class="col-8 col-md-4 col-sm-4 text-right"><admin-label asp-for="StoreInformationSettings.AllowCustomerToSelectTheme" class="control-label"/>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateDeliveryDate.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateDeliveryDate.cshtmlnew file mode 100644index 000000000..121dadfea--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateDeliveryDate.cshtml@@ -0,0 +1,36 @@+@model DeliveryDateModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.DeliveryDates.AddNew"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="CreateDeliveryDate" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.DeliveryDates.AddNew"]+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("DeliveryDates", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.DeliveryDates.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdateDeliveryDate" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateMethod.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateMethod.cshtmlnew file mode 100644index 000000000..e6f930fbf--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateMethod.cshtml@@ -0,0 +1,36 @@+@model ShippingMethodModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Methods.AddNew"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="CreateMethod" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Methods.AddNew"]+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("Methods", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.Methods.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdateMethod" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreatePickupPoint.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreatePickupPoint.cshtmlnew file mode 100644index 000000000..19a36daa9--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreatePickupPoint.cshtml@@ -0,0 +1,36 @@+@model PickupPointModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.PickupPoints.AddNew"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="CreatePickupPoint" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.PickupPoints.AddNew"]+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("PickupPoints", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.PickupPoints.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdatePickupPoint" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateWarehouse.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateWarehouse.cshtmlnew file mode 100644index 000000000..68a5bd717--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateWarehouse.cshtml@@ -0,0 +1,36 @@+@model WarehouseModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Warehouses.AddNew"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="CreateWarehouse" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Warehouses.AddNew"]+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("Warehouses", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.Warehouses.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdateWarehouse" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/DeliveryDates.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/DeliveryDates.cshtmlnew file mode 100644index 000000000..afe539af5--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/DeliveryDates.cshtml@@ -0,0 +1,79 @@+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.DeliveryDates"];+ Layout = Constants.LayoutStore;+}++<div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.DeliveryDates"]+ </div>+ <div class="actions btn-group btn-group-devided">+ <a href="@Url.Action("CreateDeliveryDate", "Shipping", new { area = Constants.AreaStore })" class="btn green">+ <i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"]</span>+ </a>+ </div>+ </div>+ <div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="x_content">+ <div id="deliverydate-grid"></div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</div>++<script>+ $(document).ready(function () {+ $("#deliverydate-grid").kendoGrid({+ dataSource: {+ transport: {+ read: {+ url: "@Html.Raw(Url.Action("DeliveryDatesListData", "Shipping", new { area = Constants.AreaStore }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ }+ },+ schema: {+ data: "Data",+ total: "Total",+ errors: "Errors"+ },+ error: function (e) {+ display_kendoui_grid_error(e);+ this.cancelChanges();+ },+ serverPaging: false,+ serverFiltering: false,+ serverSorting: false+ },+ pageable: {+ refresh: true,+ numeric: false,+ previousNext: false,+ info: false+ },+ scrollable: false,+ columns: [+ {+ field: "Name",+ title: "@Loc["Admin.Configuration.Shipping.DeliveryDates.Fields.Name"]",+ template: '<a class="k-link" href="@Url.Action("EditDeliveryDate", "Shipping", new { area = Constants.AreaStore })/#=Id#">#=kendo.htmlEncode(Name)#</a>'+ },+ {+ field: "DisplayOrder",+ title: "@Loc["Admin.Configuration.Shipping.DeliveryDates.Fields.DisplayOrder"]",+ width: 120+ }+ ]+ });+ });+</script>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditDeliveryDate.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditDeliveryDate.cshtmlnew file mode 100644index 000000000..7501aab05--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditDeliveryDate.cshtml@@ -0,0 +1,40 @@+@model DeliveryDateModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.DeliveryDates.EditDeliveryDateDetails"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="EditDeliveryDate" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.DeliveryDates.EditDeliveryDateDetails"] - @Model.Name+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("DeliveryDates", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.DeliveryDates.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided util-btn-margin-bottom-5">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ <span id="deliverydate-delete" class="btn red">+ <i class="fa fa-trash-o"></i> <span class="d-none d-sm-inline">@Loc["Admin.Common.Delete"]</span>+ </span>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdateDeliveryDate" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>+<admin-delete-confirmation button-id="deliverydate-delete" action-name="DeleteDeliveryDate"/>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditMethod.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditMethod.cshtmlnew file mode 100644index 000000000..2fc82104d--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditMethod.cshtml@@ -0,0 +1,40 @@+@model ShippingMethodModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Methods.EditMethodDetails"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="EditMethod" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Methods.EditMethodDetails"] - @Model.Name+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("Methods", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.Methods.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ <span id="method-delete" class="btn red">+ <i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]+ </span>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdateMethod" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>+<admin-delete-confirmation button-id="method-delete" action-name="DeleteMethod"/>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditPickupPoint.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditPickupPoint.cshtmlnew file mode 100644index 000000000..2cf964a70--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditPickupPoint.cshtml@@ -0,0 +1,40 @@+@model PickupPointModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.PickupPoints.EditDetails"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="EditPickupPoint" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.PickupPoints.EditDetails"] - @Model.Name+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("PickupPoints", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.PickupPoints.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided util-btn-margin-bottom-5">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ <span id="pickuppoint-delete" class="btn red">+ <i class="fa fa-trash-o"></i> <span class="d-none d-sm-inline">@Loc["Admin.Common.Delete"]</span>+ </span>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdatePickupPoint" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>+<admin-delete-confirmation button-id="pickuppoint-delete" action-name="DeletePickupPoint"/>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditWarehouse.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditWarehouse.cshtmlnew file mode 100644index 000000000..c319e6af6--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditWarehouse.cshtml@@ -0,0 +1,40 @@+@model WarehouseModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Warehouses.EditWarehouseDetails"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="EditWarehouse" method="post">+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Warehouses.EditWarehouseDetails"] - @Model.Name+ <small>+ <i class="fa fa-arrow-circle-left"></i>+ <a href="@Url.Action("Warehouses", "Shipping", new { area = Constants.AreaStore })">@Loc["Admin.Configuration.Shipping.Warehouses.BackToList"]</a>+ </small>+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided util-btn-margin-bottom-5">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]+ </button>+ <span id="warehouse-delete" class="btn red">+ <i class="fa fa-trash-o"></i> <span class="d-none d-sm-inline">@Loc["Admin.Common.Delete"]</span>+ </span>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <partial name="Partials/CreateOrUpdateWarehouse" model="Model"/>+ </div>+ </div>+ </div>+ </div>+</form>+<admin-delete-confirmation button-id="warehouse-delete" action-name="DeleteWarehouse"/>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Methods.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Methods.cshtmlnew file mode 100644index 000000000..8ced8c017--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Methods.cshtml@@ -0,0 +1,83 @@+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Methods"];+ Layout = Constants.LayoutStore;+}++<div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Methods"]+ </div>+ <div class="actions btn-group btn-group-devided">+ <a href="@Url.Action("CreateMethod", "Shipping", new { area = Constants.AreaStore })" class="btn green">+ <i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"]</span>+ </a>+ </div>+ </div>+ <div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="x_content">+ <div id="shippingmethod-grid"></div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</div>++<script>+ $(document).ready(function () {+ $("#shippingmethod-grid").kendoGrid({+ dataSource: {+ transport: {+ read: {+ url: "@Html.Raw(Url.Action("MethodsListData", "Shipping", new { area = Constants.AreaStore }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ }+ },+ schema: {+ data: "Data",+ total: "Total",+ errors: "Errors"+ },+ error: function (e) {+ display_kendoui_grid_error(e);+ this.cancelChanges();+ },+ serverPaging: false,+ serverFiltering: false,+ serverSorting: false+ },+ pageable: {+ refresh: true,+ numeric: false,+ previousNext: false,+ info: false+ },+ scrollable: false,+ columns: [+ {+ field: "Name",+ title: "@Loc["Admin.Configuration.Shipping.Methods.Fields.Name"]",+ template: '<a class="k-link" href="@Url.Action("EditMethod", "Shipping", new { area = Constants.AreaStore })/#=Id#">#=kendo.htmlEncode(Name)#</a>'+ },+ {+ field: "Description",+ title: "@Loc["Admin.Configuration.Shipping.Methods.Fields.Description"]"+ },+ {+ field: "DisplayOrder",+ title: "@Loc["Admin.Configuration.Shipping.Methods.Fields.DisplayOrder"]",+ width: 120+ }+ ]+ });+ });+</script>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtmlnew file mode 100644index 000000000..bb285baa1--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml@@ -0,0 +1,56 @@+@using Microsoft.AspNetCore.Mvc.Razor+@model DeliveryDateModel++@{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].Name"/>+ <span asp-validation-for="@Model.Locales[item].Name"></span>+ </div>+ </div>+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;+}++<div asp-validation-summary="All"></div>+<input asp-for="Id" type="hidden"/>++<div class="form-horizontal">+ <localized-editor localized-template="@template" name="deliverydate-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()">+ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Name"/>+ <span asp-validation-for="Name"></span>+ </div>+ </div>+ </div>+ </localized-editor>++ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="ColorSquaresRgb"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="ColorSquaresRgb"/>+ <div id="color-picker"></div>+ <script>+ $(document).ready(function () {+ $('#color-picker').farbtastic('#@Html.IdFor(model => model.ColorSquaresRgb)');+ });+ </script>+ <span asp-validation-for="ColorSquaresRgb"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="DisplayOrder"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="DisplayOrder"/>+ <span asp-validation-for="DisplayOrder"></span>+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateMethod.cshtmlnew file mode 100644index 000000000..52db9ba37--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml@@ -0,0 +1,57 @@+@using Microsoft.AspNetCore.Mvc.Razor+@model ShippingMethodModel++@{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].Name"/>+ <span asp-validation-for="@Model.Locales[item].Name"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Description"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="@Model.Locales[item].Description"></admin-textarea>+ <span asp-validation-for="@Model.Locales[item].Description"></span>+ </div>+ </div>+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;+}++<div asp-validation-summary="All"></div>+<input asp-for="Id" type="hidden"/>++<div class="form-horizontal">+ <localized-editor localized-template="@template" name="shipping-method-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()">+ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Name"/>+ <span asp-validation-for="Name"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Description"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="Description"></admin-textarea>+ <span asp-validation-for="Description"></span>+ </div>+ </div>+ </div>+ </localized-editor>++ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="DisplayOrder"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="DisplayOrder"/>+ <span asp-validation-for="DisplayOrder"></span>+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdatePickupPoint.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdatePickupPoint.cshtmlnew file mode 100644index 000000000..f901c52b9--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdatePickupPoint.cshtml@@ -0,0 +1,68 @@+@model PickupPointModel++<div asp-validation-summary="All"></div>+<input asp-for="Id" type="hidden"/>++<div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Name"/>+ <span asp-validation-for="Name"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Description"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Description"/>+ <span asp-validation-for="Description"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="AdminComment"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="AdminComment"></admin-textarea>+ <span asp-validation-for="AdminComment"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-input asp-for="Address" asp-template="Address"/>+ </div>+ <div class="form-group">+ <admin-label asp-for="AvailableWarehouses"/>+ <div class="col-md-9 col-sm-9">+ <admin-select asp-for="WarehouseId" asp-items="Model.AvailableWarehouses"/>+ <span asp-validation-for="WarehouseId"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="PickupFee"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="PickupFee"/>+ <span asp-validation-for="PickupFee"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Latitude"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Latitude"/>+ <span asp-validation-for="Latitude"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Longitude"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Longitude"/>+ <span asp-validation-for="Longitude"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="DisplayOrder"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="DisplayOrder"/>+ <span asp-validation-for="DisplayOrder"></span>+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtmlnew file mode 100644index 000000000..df6666ac8--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml@@ -0,0 +1,54 @@+@model WarehouseModel++<div asp-validation-summary="All"></div>+<input asp-for="Id" type="hidden"/>++<div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="Code"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Code"/>+ <span asp-validation-for="Code"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Name"/>+ <span asp-validation-for="Name"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="AdminComment"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="AdminComment"></admin-textarea>+ <span asp-validation-for="AdminComment"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Latitude"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Latitude"/>+ <span asp-validation-for="Latitude"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Longitude"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Longitude"/>+ <span asp-validation-for="Longitude"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-input asp-for="Address" asp-template="Address"/>+ </div>+ <div class="form-group">+ <admin-label asp-for="DisplayOrder"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="DisplayOrder"/>+ <span asp-validation-for="DisplayOrder"></span>+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/Restrictions.TabCountry.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/Restrictions.TabCountry.cshtmlnew file mode 100644index 000000000..bfa04e4f9--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/Restrictions.TabCountry.cshtml@@ -0,0 +1,81 @@+@model ShippingMethodRestrictionModel++<div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <div class="col-md-12 col-sm-12">+ <div class="note note-info">+ @Loc["Admin.Configuration.Shipping.Restrictions.DescriptionCountry"]+ </div>+ <br/>+ @if (Model.AvailableCountries.Count == 0)+ {+ <text>No countries defined</text>+ }+ else if (Model.AvailableShippingMethods.Count == 0)+ {+ <text>No shipping methods available</text>+ }+ else+ {+ <script>+ $(document).ready(function () {+ @foreach (var sm in Model.AvailableShippingMethods)+ {+ <text>+ $('#selectall-@(sm.Id)').click(function () {+ $('.restrict_@(sm.Id)').prop('checked', $(this).is(':checked')).change();+ });++ </text>+ }+ });+ </script>+ <table class="table table-bordered table-striped table-hover">+ <tbody>+ <tr>+ <th scope="col">+ <strong>@Loc["Admin.Configuration.Shipping.Restrictions.Country"]</strong>+ </th>+ @foreach (var sm in Model.AvailableShippingMethods)+ {+ <th scope="col">+ <strong>@sm.Name</strong>+ <label class='mt-checkbox mt-checkbox-outline control control-checkbox'>+ <input type="checkbox" id="selectall-@(sm.Id)"/>+ <div class="control__indicator"></div>+ </label>+ </th>+ }+ </tr>+ @{+ var altRow = true;+ }+ @foreach (var c in Model.AvailableCountries)+ {+ altRow = !altRow;+ <tr class="@(altRow ? "altrowstyle" : "rowstyle")">+ <td>+ <span>@c.Name</span>+ </td>+ @foreach (var sm in Model.AvailableShippingMethods)+ {+ var restrictedByCountryExists = Model.Restricted.TryGetValue(c.Id, out var restrictedByCountry);+ var restricted = restrictedByCountryExists && restrictedByCountry[sm.Id];+ var checkedValue = restricted ? "checked" : null;+ <td style="text-align:center">+ <label class='mt-checkbox mt-checkbox-outline control control-checkbox'>+ <input id="restrict_@(sm.Id)" class="restrict_@(sm.Id)" type="checkbox" value="@(c.Id)" name="restrict_@(sm.Id)" @checkedValue />+ <div class="control__indicator"></div>+ </label>+ </td>+ }+ </tr>+ }+ </tbody>+ </table>+ }+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/Restrictions.TabGroup.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/Restrictions.TabGroup.cshtmlnew file mode 100644index 000000000..f2ebdc89c--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/Restrictions.TabGroup.cshtml@@ -0,0 +1,81 @@+@model ShippingMethodRestrictionModel++<div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <div class="col-md-12 col-sm-12">+ <div class="note note-info">+ @Loc["Admin.Configuration.Shipping.Restrictions.DescriptionGroup"]+ </div>+ <br/>+ @if (Model.AvailableCustomerGroups.Count == 0)+ {+ <text>No customer groups available</text>+ }+ else if (Model.AvailableShippingMethods.Count == 0)+ {+ <text>No shipping methods available</text>+ }+ else+ {+ <script>+ $(document).ready(function () {+ @foreach (var sm in Model.AvailableShippingMethods)+ {+ <text>+ $('#selectgroupall-@(sm.Id)').click(function () {+ $('.restrictgroup_@(sm.Id)').prop('checked', $(this).is(':checked')).change();+ });++ </text>+ }+ });+ </script>+ <table class="table table-bordered table-striped table-hover">+ <tbody>+ <tr>+ <th scope="col">+ <strong>@Loc["Admin.Configuration.Shipping.Restrictions.Group"]</strong>+ </th>+ @foreach (var sm in Model.AvailableShippingMethods)+ {+ <th scope="col">+ <strong>@sm.Name</strong>+ <label class='mt-checkbox mt-checkbox-outline control control-checkbox'>+ <input type="checkbox" id="selectgroupall-@(sm.Id)"/>+ <div class="control__indicator"></div>+ </label>+ </th>+ }+ </tr>+ @{+ var altRow = true;+ }+ @foreach (var c in Model.AvailableCustomerGroups)+ {+ altRow = !altRow;+ <tr class="@(altRow ? "altrowstyle" : "rowstyle")">+ <td>+ <span>@c.Name</span>+ </td>+ @foreach (var sm in Model.AvailableShippingMethods)+ {+ var restricted = Model.RestictedGroup.TryGetValue(c.Id, out var shippingRestrictions) &&+ shippingRestrictions.TryGetValue(sm.Id, out var isRestricted) &&+ isRestricted;+ <td style="text-align:center">+ <label class='mt-checkbox mt-checkbox-outline control control-checkbox'>+ <input id="restrictgroup_@(sm.Id)" class="restrictgroup_@(sm.Id)" type="checkbox" value="@(c.Id)" name="restrictgroup_@(sm.Id)" @(restricted ? " checked=checked" : null)/>+ <div class="control__indicator"></div>+ </label>+ </td>+ }+ </tr>+ }+ </tbody>+ </table>+ }+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/PickupPoints.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/PickupPoints.cshtmlnew file mode 100644index 000000000..7e1bc3e9e--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/PickupPoints.cshtml@@ -0,0 +1,83 @@+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.PickupPoints"];+ Layout = Constants.LayoutStore;+}++<div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.PickupPoints"]+ </div>+ <div class="actions btn-group btn-group-devided">+ <a href="@Url.Action("CreatePickupPoint", "Shipping", new { area = Constants.AreaStore })" class="btn green">+ <i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"]</span>+ </a>+ </div>+ </div>+ <div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="x_content">+ <div id="pickuppoints-grid"></div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</div>++<script>+ $(document).ready(function () {+ $("#pickuppoints-grid").kendoGrid({+ dataSource: {+ transport: {+ read: {+ url: "@Html.Raw(Url.Action("PickupPointsListData", "Shipping", new { area = Constants.AreaStore }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ }+ },+ schema: {+ data: "Data",+ total: "Total",+ errors: "Errors"+ },+ error: function (e) {+ display_kendoui_grid_error(e);+ this.cancelChanges();+ },+ serverPaging: false,+ serverFiltering: false,+ serverSorting: false+ },+ pageable: {+ refresh: true,+ numeric: false,+ previousNext: false,+ info: false+ },+ scrollable: false,+ columns: [+ {+ field: "Name",+ title: "@Loc["Admin.Configuration.Shipping.PickupPoint.Fields.Name"]",+ template: '<a class="k-link" href="@Url.Action("EditPickupPoint", "Shipping", new { area = Constants.AreaStore })/#=Id#">#=kendo.htmlEncode(Name)#</a>'+ },+ {+ field: "Description",+ title: "@Loc["Admin.Configuration.Shipping.PickupPoint.Fields.Description"]"+ },+ {+ field: "DisplayOrder",+ title: "@Loc["Admin.Configuration.Shipping.PickupPoint.Fields.DisplayOrder"]",+ width: 120+ }+ ]+ });+ });+</script>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Providers.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Providers.cshtmlnew file mode 100644index 000000000..bb28545a2--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Providers.cshtml@@ -0,0 +1,120 @@+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Providers"];+ Layout = Constants.LayoutStore;+}++<div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption level-caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Providers"]+ </div>+ </div>+ <div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="x_content">+ <div id="shippingproviders-grid"></div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</div>++<script>+$(document).ready(function () {+ $("#shippingproviders-grid").kendoGrid({+ dataSource: {+ transport: {+ read: {+ url: "@Html.Raw(Url.Action("Providers", "Shipping", new { area = Constants.AreaStore }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ },+ update: {+ url: "@Html.Raw(Url.Action("ProviderUpdate", "Shipping", new { area = Constants.AreaStore }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ }+ },+ schema: {+ data: "Data",+ total: "Total",+ errors: "Errors",+ model: {+ id: "SystemName",+ fields: {+ FriendlyName: { editable: false, type: "string" },+ SystemName: { editable: false, type: "string" },+ DisplayOrder: { editable: false, type: "number" },+ IsActive: { editable: true, type: "boolean" }+ }+ }+ },+ requestEnd: function (e) {+ if (e.type == "update") {+ this.read();+ }+ },+ error: function (e) {+ display_kendoui_grid_error(e);+ this.cancelChanges();+ },+ serverPaging: true,+ serverFiltering: true,+ serverSorting: true+ },+ pageable: {+ refresh: true,+ numeric: false,+ previousNext: false,+ info: false+ },+ editable: {+ confirmation: false,+ mode: "inline"+ },+ scrollable: false,+ columns: [{+ field: "FriendlyName",+ title: "@Loc["Admin.Configuration.Shipping.Providers.Fields.FriendlyName"]",+ width: 250,+ template: '<a class="k-link" href="#=ConfigurationUrl#">#=FriendlyName#</a>',+ }, {+ field: "SystemName",+ title: "@Loc["Admin.Configuration.Shipping.Providers.Fields.SystemName"]",+ width: 250,+ template: '<a class="k-link" href="#=ConfigurationUrl#">#=SystemName#</a>',+ }, {+ field: "DisplayOrder",+ title: "@Loc["Admin.Configuration.Shipping.Providers.Fields.DisplayOrder"]",+ format: "{0:0}",+ width: 100+ }, {+ field: "IsActive",+ title: "@Loc["Admin.Configuration.Shipping.Providers.Fields.IsActive"]",+ width: 100,+ headerAttributes: { style: "text-align:center" },+ attributes: { style: "text-align:center" },+ template: '# if(IsActive) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'+ }, {+ command: {+ name: "edit",+ text: {+ edit: "@Loc["Admin.Common.Edit"]",+ update: "@Loc["Admin.Common.Update"]",+ cancel: "@Loc["Admin.Common.Cancel"]"+ }+ },+ title: "@Loc["Admin.Common.Edit"]",+ width: 150+ }]+ });+});+</script>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Restrictions.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Restrictions.cshtmlnew file mode 100644index 000000000..086a099d3--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Restrictions.cshtml@@ -0,0 +1,46 @@+@model ShippingMethodRestrictionModel++@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Restrictions"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="Restrictions" method="post">++ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-truck"></i>+ @Loc["Admin.Configuration.Shipping.Restrictions"]+ </div>+ <div class="actions">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ </div>+ </div>+ <div class="x_content form">+ <admin-tabstrip name="shippingrestriction-edit">+ <items>+ <tabstrip-item text="@Loc["Admin.Configuration.Shipping.Restrictions.Country"]" tab-index="0">+ <content>+ <div>+ <partial name="Partials/Restrictions.TabCountry" model="Model"/>+ </div>+ </content>+ </tabstrip-item>+ <tabstrip-item text="@Loc["Admin.Configuration.Shipping.Restrictions.Group"]" tab-index="1">+ <content>+ <div>+ <partial name="Partials/Restrictions.TabGroup" model="Model"/>+ </div>+ </content>+ </tabstrip-item>+ </items>+ </admin-tabstrip>+ </div>+ </div>+ </div>+ </div>+</form>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Settings.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Settings.cshtmlnew file mode 100644index 000000000..1c30ff6dd--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Settings.cshtml@@ -0,0 +1,165 @@+@model ShippingSettingsModel+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Settings"];+ Layout = Constants.LayoutStore;+}+<form asp-area="@Constants.AreaStore" asp-controller="Shipping" asp-action="Settings" method="post">++ <div asp-validation-summary="All"></div>+ <script>+ $(document).ready(function () {+ $("#@Html.IdFor(model => model.FreeShippingOverXEnabled)").click(toggleFreeShippingOverX);+ toggleFreeShippingOverX();+ });++ function toggleFreeShippingOverX() {+ if ($('#@Html.IdFor(model => model.FreeShippingOverXEnabled)').is(':checked')) {+ $('#pnlValueOfX').show();+ $('#pnlValueOfXincltax').show();+ } else {+ $('#pnlValueOfX').hide();+ $('#pnlValueOfXincltax').hide();+ }+ }+ </script>+ <div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-fw fa-sliders"></i>+ @Loc["Admin.Configuration.Shipping.Settings"]+ </div>+ <div class="actions">+ <div class="btn-group btn-group-devided">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]+ </button>+ </div>+ </div>+ </div>+ <div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="AllowPickUpInStore" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="AllowPickUpInStore"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="AllowPickUpInStore"></span>+ </div>+ </div>+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="FreeShippingOverXEnabled" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="FreeShippingOverXEnabled"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="FreeShippingOverXEnabled"></span>+ </div>+ </div>+ <div class="form-group" id="pnlValueOfX">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="FreeShippingOverXValue" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <admin-input asp-for="FreeShippingOverXValue"/>+ <span asp-validation-for="FreeShippingOverXValue"></span>+ </div>+ </div>+ <div class="form-group" id="pnlValueOfXincltax">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="FreeShippingOverXIncludingTax" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="FreeShippingOverXIncludingTax"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="FreeShippingOverXIncludingTax"></span>+ </div>+ </div>+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="EstimateShippingEnabled" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="EstimateShippingEnabled"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="EstimateShippingEnabled"></span>+ </div>+ </div>+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="DisplayShipmentEventsToCustomers" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="DisplayShipmentEventsToCustomers"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="DisplayShipmentEventsToCustomers"></span>+ </div>+ </div>+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="DisplayShipmentEventsToStoreOwner" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="DisplayShipmentEventsToStoreOwner"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="DisplayShipmentEventsToStoreOwner"></span>+ </div>+ </div>+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="SkipShippingMethodSelectionIfOnlyOne" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="SkipShippingMethodSelectionIfOnlyOne"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="SkipShippingMethodSelectionIfOnlyOne"></span>+ </div>+ </div>+ <div class="form-group">+ <div class="col-8 col-md-4 col-sm-4 text-right">+ <admin-label asp-for="AdditionalShippingChargeByQty" class="control-label"/>+ </div>+ <div class="col-4 col-md-8 col-sm-8">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="AdditionalShippingChargeByQty"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="AdditionalShippingChargeByQty"></span>+ </div>+ </div>+ <div class="panel panel-default">+ <div class="panel-heading">+ @Loc["Admin.Configuration.Shipping.Settings.shippingoriginaddress"]+ </div>+ <div class="form-group" id="pnlShippingOriginAddress">+ <div>+ <admin-input asp-for="ShippingOriginAddress" asp-template="Address"/>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</form>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Warehouses.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Warehouses.cshtmlnew file mode 100644index 000000000..1015048c9--- /dev/null+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Warehouses.cshtml@@ -0,0 +1,84 @@+@{+ ViewBag.Title = Loc["Admin.Configuration.Shipping.Warehouses"];+ Layout = Constants.LayoutStore;+}++<div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-list-alt"></i>+ @Loc["Admin.Configuration.Shipping.Warehouses"]+ </div>+ <div class="actions btn-group btn-group-devided">+ <a href="@Url.Action("CreateWarehouse", "Shipping", new { area = Constants.AreaStore })" class="btn green">+ <i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"]</span>+ </a>+ </div>+ </div>+ <div class="x_content form">+ <div class="form-horizontal">+ <div class="form-body">+ <div class="x_content">+ <div id="warehouse-grid"></div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</div>++<script>+ $(document).ready(function () {+ $("#warehouse-grid").kendoGrid({+ dataSource: {+ transport: {+ read: {+ url: "@Html.Raw(Url.Action("WarehousesListData", "Shipping", new { area = Constants.AreaStore }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ }+ },+ schema: {+ data: "Data",+ total: "Total",+ errors: "Errors"+ },+ error: function (e) {+ display_kendoui_grid_error(e);+ this.cancelChanges();+ },+ serverPaging: false,+ serverFiltering: false,+ serverSorting: false+ },+ pageable: {+ refresh: true,+ numeric: false,+ previousNext: false,+ info: false+ },+ scrollable: false,+ columns: [+ {+ field: "Code",+ title: "@Loc["Admin.Configuration.Shipping.Warehouses.Fields.Code"]",+ template: '<a class="k-link" href="@Url.Action("EditWarehouse", "Shipping", new { area = Constants.AreaStore })/#=Id#">#=kendo.htmlEncode(Code)#</a>'+ },+ {+ field: "Name",+ title: "@Loc["Admin.Configuration.Shipping.Warehouses.Fields.Name"]",+ template: '<a class="k-link" href="@Url.Action("EditWarehouse", "Shipping", new { area = Constants.AreaStore })/#=Id#">#=kendo.htmlEncode(Name)#</a>'+ },+ {+ field: "DisplayOrder",+ title: "@Loc["Admin.Configuration.Shipping.Warehouses.Fields.DisplayOrder"]",+ width: 120+ }+ ]+ });+ });+</script>diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/_ViewImports.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/_ViewImports.cshtmlindex 0d49682e6..1420c6933 100644--- a/src/Web/Grand.Web.Store/Areas/Store/Views/_ViewImports.cshtml+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/_ViewImports.cshtml@@ -34,6 +34,7 @@@using Grand.Web.AdminShared.Models.Messages@using Grand.Web.AdminShared.Models.Pages@using Grand.Web.AdminShared.Models.Settings+@using Grand.Web.AdminShared.Models.Shipping@inject LocService Loc@inject IEnumTranslationService EnumTranslationService\ No newline at end of filediff --git a/src/Web/Grand.Web.Store/Controllers/HomeController.cs b/src/Web/Grand.Web.Store/Controllers/HomeController.csindex 800de6b64..dd733c6c8 100644--- a/src/Web/Grand.Web.Store/Controllers/HomeController.cs+++ b/src/Web/Grand.Web.Store/Controllers/HomeController.cs@@ -1,4 +1,6 @@-using Grand.Business.Core.Interfaces.Authentication;+using Grand.Business.Common.Services.Localization;+using Grand.Business.Core.Interfaces.Authentication;+using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Customers;using Grand.Domain.Customers;@@ -62,6 +64,46 @@ public class HomeController : BaseStoreControllerreturn Redirect(returnUrl);}+ [AcceptVerbs("Get")]+ public async Task<IActionResult> GetStatesByCountryId([FromServices] ICountryService countryService,+ [FromServices] ITranslationService translationService,+ string countryId, bool? addSelectStateItem, bool? addAsterisk)+ {+ // This action method gets called via an ajax request+ if (string.IsNullOrEmpty(countryId))+ return Json(new List<dynamic>+ { new { id = "", name = translationService.GetResource("Address.SelectState") } });++ var country = await countryService.GetCountryById(countryId);+ var states = country != null ? country.StateProvinces.ToList() : [];+ var result = (from s in states+ select new { id = s.Id, name = s.Name }).ToList();+ if (addAsterisk.HasValue && addAsterisk.Value)+ {+ //asterisk+ result.Insert(0, new { id = "", name = "*" });+ }+ else+ {+ if (country == null)+ {+ //country is not selected ("choose country" item)+ if (addSelectStateItem.HasValue && addSelectStateItem.Value)+ result.Insert(0,+ new { id = "", name = translationService.GetResource("Admin.Address.SelectState") });+ }+ else+ {+ //some country is selected+ if (result.Any() && addSelectStateItem.HasValue && addSelectStateItem.Value)+ //country has some states+ result.Insert(0,+ new { id = "", name = translationService.GetResource("Admin.Address.SelectState") });+ }+ }++ return Json(result);+ }public IActionResult AccessDenied(){_logger.LogInformation("Access denied");diff --git a/src/Web/Grand.Web.Store/Controllers/ProductController.cs b/src/Web/Grand.Web.Store/Controllers/ProductController.csindex a0a39345a..7e294e4e2 100644--- a/src/Web/Grand.Web.Store/Controllers/ProductController.cs+++ b/src/Web/Grand.Web.Store/Controllers/ProductController.cs@@ -131,8 +131,9 @@ public class ProductController : BaseStoreController[PermissionAuthorizeAction(PermissionActionName.Create)]public async Task<IActionResult> Create(){- var model = new ProductModel();- model.StoreId = _contextAccessor.WorkContext.CurrentCustomer.StaffStoreId;+ var model = new ProductModel {+ StoreId = _contextAccessor.WorkContext.CurrentCustomer.StaffStoreId+ };await _productViewModelService.PrepareProductModel(model, null, true, true);await AddLocales(_languageService, model.Locales);return View(model);diff --git a/src/Web/Grand.Web.Store/Controllers/ShippingController.cs b/src/Web/Grand.Web.Store/Controllers/ShippingController.csnew file mode 100644index 000000000..17995c354--- /dev/null+++ b/src/Web/Grand.Web.Store/Controllers/ShippingController.cs@@ -0,0 +1,726 @@+using Grand.Business.Core.Extensions;+using Grand.Business.Core.Interfaces.Checkout.Shipping;+using Grand.Business.Core.Interfaces.Common.Configuration;+using Grand.Business.Core.Interfaces.Common.Directory;+using Grand.Business.Core.Interfaces.Common.Localization;+using Grand.Domain;+using Grand.Domain.Customers;+using Grand.Domain.Directory;+using Grand.Domain.Permissions;+using Grand.Domain.Shipping;+using Grand.Infrastructure;+using Grand.Web.AdminShared.Extensions.Mapping;+using Grand.Web.AdminShared.Extensions.Mapping.Settings;+using Grand.Web.AdminShared.Models.Common;+using Grand.Web.AdminShared.Models.Directory;+using Grand.Web.AdminShared.Models.Shipping;+using Grand.Web.Common.DataSource;+using Grand.Web.Common.Models;+using Grand.Web.Common.Security.Authorization;+using Microsoft.AspNetCore.Mvc;+using Microsoft.AspNetCore.Mvc.Rendering;++namespace Grand.Web.Store.Controllers;++[PermissionAuthorize(PermissionSystemName.ShippingSettings)]+public class ShippingController(+ IShippingService shippingService,+ IShippingMethodService shippingMethodService,+ IDeliveryDateService deliveryDateService,+ IWarehouseService warehouseService,+ IPickupPointService pickupPointService,+ ICountryService countryService,+ IGroupService groupService,+ ILanguageService languageService,+ ITranslationService translationService,+ ISettingService settingService,+ IContextAccessor contextAccessor) : BaseStoreController+{+ private string CurrentStoreId => contextAccessor.WorkContext.CurrentCustomer.StaffStoreId;++ #region Utilities++ private async Task PrepareAddressModel(AddressModel model, string selectedCountryId)+ {+ model.AvailableCountries.Add(new SelectListItem { Text = translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });+ foreach (var c in await countryService.GetAllCountries(showHidden: true))+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == selectedCountryId });++ var states = !string.IsNullOrEmpty(selectedCountryId)+ ? (await countryService.GetCountryById(selectedCountryId))?.StateProvinces+ : new List<StateProvince>();+ if (states?.Count > 0)+ foreach (var s in states)+ model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.StateProvinceId });++ model.CountryEnabled = true;+ model.StateProvinceEnabled = true;+ model.CityEnabled = true;+ model.StreetAddressEnabled = true;+ model.ZipPostalCodeEnabled = true;+ model.ZipPostalCodeRequired = true;+ model.PhoneEnabled = true;+ model.FaxEnabled = true;+ model.CompanyEnabled = true;+ }++ private async Task PrepareWarehouseModel(WarehouseModel model)+ {+ await PrepareAddressModel(model.Address, model.Address.CountryId);+ }++ private async Task PreparePickupPointModel(PickupPointModel model)+ {+ await PrepareAddressModel(model.Address, model.Address.CountryId);++ model.AvailableWarehouses.Add(new SelectListItem { Text = translationService.GetResource("Admin.Configuration.Shipping.PickupPoint.SelectWarehouse"), Value = "" });+ foreach (var w in await warehouseService.GetAllWarehouses(CurrentStoreId))+ model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id, Selected = w.Id == model.WarehouseId });+ }++ #endregion++ #region Providers++ public IActionResult Providers()+ {+ return View();+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.List)]+ public async Task<IActionResult> Providers(DataSourceRequest command)+ {+ var shippingProviderSettings = await settingService.LoadSetting<ShippingProviderSettings>(CurrentStoreId);+ var shippingProvidersModel = shippingService.LoadAllShippingRateCalculationProviders()+ .Select(p => {+ var m = p.ToModel();+ m.IsActive = p.IsShippingRateMethodActive(shippingProviderSettings);+ return m;+ })+ .ToList();++ var gridModel = new DataSourceResult {+ Data = shippingProvidersModel,+ Total = shippingProvidersModel.Count+ };+ return Json(gridModel);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProviderUpdate(ShippingRateComputationMethodModel model)+ {+ var shippingProviderSettings = await settingService.LoadSetting<ShippingProviderSettings>(CurrentStoreId);+ var srcm = shippingService.LoadShippingRateCalculationProviderBySystemName(model.SystemName);+ if (srcm == null)+ return new JsonResult("");++ if (srcm.IsShippingRateMethodActive(shippingProviderSettings))+ {+ if (!model.IsActive)+ {+ shippingProviderSettings.ActiveSystemNames.Remove(srcm.SystemName);+ await settingService.SaveSetting(shippingProviderSettings, CurrentStoreId);+ }+ }+ else+ {+ if (model.IsActive)+ {+ shippingProviderSettings.ActiveSystemNames.Add(srcm.SystemName);+ await settingService.SaveSetting(shippingProviderSettings, CurrentStoreId);+ }+ }+ return new JsonResult("");+ }++ #endregion++ #region Shipping settings++ public async Task<IActionResult> Settings()+ {+ var shippingSettings = await settingService.LoadSetting<ShippingSettings>(CurrentStoreId);+ var model = shippingSettings.ToModel();+ model.ActiveStore = CurrentStoreId;++ var originAddress = shippingSettings.ShippingOriginAddress;+ model.ShippingOriginAddress = originAddress != null+ ? await originAddress.ToModel(countryService)+ : new AddressModel();++ model.ShippingOriginAddress.AvailableCountries.Add(new SelectListItem+ { Text = translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });+ foreach (var c in await countryService.GetAllCountries(showHidden: true))+ model.ShippingOriginAddress.AvailableCountries.Add(new SelectListItem+ { Text = c.Name, Value = c.Id, Selected = originAddress != null && c.Id == originAddress.CountryId });++ var states = originAddress != null && !string.IsNullOrEmpty(originAddress.CountryId)+ ? (await countryService.GetCountryById(originAddress.CountryId))?.StateProvinces ?? []+ : new List<StateProvince>();+ var selectedStateProvinceId = originAddress?.StateProvinceId;+ if (states?.Count > 0)+ foreach (var s in states)+ model.ShippingOriginAddress.AvailableStates.Add(new SelectListItem+ { Text = s.Name, Value = s.Id, Selected = s.Id == selectedStateProvinceId });++ model.ShippingOriginAddress.CountryEnabled = true;+ model.ShippingOriginAddress.StateProvinceEnabled = true;+ model.ShippingOriginAddress.CityEnabled = true;+ model.ShippingOriginAddress.StreetAddressEnabled = true;+ model.ShippingOriginAddress.ZipPostalCodeEnabled = true;+ model.ShippingOriginAddress.ZipPostalCodeRequired = true;+ model.ShippingOriginAddress.AddressTypeEnabled = false;++ return View(model);+ }++ [HttpPost]+ public async Task<IActionResult> Settings(ShippingSettingsModel model)+ {+ var storeScope = CurrentStoreId;+ var shippingSettings = await settingService.LoadSetting<ShippingSettings>(storeScope);+ shippingSettings = model.ToEntity(shippingSettings);+ await settingService.SaveSetting(shippingSettings, storeScope);+ Success(translationService.GetResource("Admin.Configuration.Updated"));+ return RedirectToAction("Settings");+ }++ #endregion++ #region Shipping methods++ public IActionResult Methods()+ {+ return View();+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.List)]+ public async Task<IActionResult> MethodsListData()+ {+ var methods = (await shippingMethodService.GetAllShippingMethods(storeId: CurrentStoreId))+ .ToList();+ var gridModel = new DataSourceResult {+ Data = methods.Select(m => m.ToModel()),+ Total = methods.Count+ };+ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Create)]+ public async Task<IActionResult> CreateMethod()+ {+ var model = new ShippingMethodModel();+ await AddLocales(languageService, model.Locales);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Create)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> CreateMethod(ShippingMethodModel model, bool continueEditing)+ {+ if (ModelState.IsValid)+ {+ var sm = model.ToEntity();+ sm.StoreId = CurrentStoreId;+ await shippingMethodService.InsertShippingMethod(sm);+ Success(translationService.GetResource("Admin.Configuration.Shipping.Methods.Added"));+ return continueEditing+ ? RedirectToAction("EditMethod", new { id = sm.Id })+ : RedirectToAction("Methods");+ }+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> EditMethod(string id)+ {+ var sm = await shippingMethodService.GetShippingMethodById(id);+ if (sm == null || sm.StoreId != CurrentStoreId)+ return RedirectToAction("Methods");++ var model = sm.ToModel();+ await AddLocales(languageService, model.Locales, (locale, languageId) => {+ locale.Name = sm.GetTranslation(x => x.Name, languageId, false);+ locale.Description = sm.GetTranslation(x => x.Description, languageId, false);+ });+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> EditMethod(ShippingMethodModel model, bool continueEditing)+ {+ var sm = await shippingMethodService.GetShippingMethodById(model.Id);+ if (sm == null || sm.StoreId != CurrentStoreId)+ return RedirectToAction("Methods");++ if (ModelState.IsValid)+ {+ sm = model.ToEntity(sm);+ sm.StoreId = CurrentStoreId;+ await shippingMethodService.UpdateShippingMethod(sm);+ Success(translationService.GetResource("Admin.Configuration.Shipping.Methods.Updated"));+ return continueEditing+ ? RedirectToAction("EditMethod", new { id = sm.Id })+ : RedirectToAction("Methods");+ }+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ public async Task<IActionResult> DeleteMethod(string id)+ {+ var sm = await shippingMethodService.GetShippingMethodById(id);+ if (sm == null || sm.StoreId != CurrentStoreId)+ return RedirectToAction("Methods");++ await shippingMethodService.DeleteShippingMethod(sm);+ Success(translationService.GetResource("Admin.Configuration.Shipping.Methods.Deleted"));+ return RedirectToAction("Methods");+ }++ #endregion++ #region Delivery dates++ public IActionResult DeliveryDates()+ {+ return View();+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.List)]+ public async Task<IActionResult> DeliveryDatesListData()+ {+ var deliveryDates = (await deliveryDateService.GetAllDeliveryDates(CurrentStoreId))+ .ToList();+ var gridModel = new DataSourceResult {+ Data = deliveryDates.Select(d => d.ToModel()),+ Total = deliveryDates.Count+ };+ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Create)]+ public async Task<IActionResult> CreateDeliveryDate()+ {+ var model = new DeliveryDateModel { ColorSquaresRgb = "#000000" };+ await AddLocales(languageService, model.Locales);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Create)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> CreateDeliveryDate(DeliveryDateModel model, bool continueEditing)+ {+ if (ModelState.IsValid)+ {+ var deliveryDate = model.ToEntity();+ deliveryDate.StoreId = CurrentStoreId;+ await deliveryDateService.InsertDeliveryDate(deliveryDate);+ Success(translationService.GetResource("Admin.Configuration.Shipping.DeliveryDates.Added"));+ return continueEditing+ ? RedirectToAction("EditDeliveryDate", new { id = deliveryDate.Id })+ : RedirectToAction("DeliveryDates");+ }+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> EditDeliveryDate(string id)+ {+ var deliveryDate = await deliveryDateService.GetDeliveryDateById(id);+ if (deliveryDate == null || deliveryDate.StoreId != CurrentStoreId)+ return RedirectToAction("DeliveryDates");++ var model = deliveryDate.ToModel();+ if (string.IsNullOrEmpty(model.ColorSquaresRgb)) model.ColorSquaresRgb = "#000000";+ await AddLocales(languageService, model.Locales, (locale, languageId) => {+ locale.Name = deliveryDate.GetTranslation(x => x.Name, languageId, false);+ });+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> EditDeliveryDate(DeliveryDateModel model, bool continueEditing)+ {+ var deliveryDate = await deliveryDateService.GetDeliveryDateById(model.Id);+ if (deliveryDate == null || deliveryDate.StoreId != CurrentStoreId)+ return RedirectToAction("DeliveryDates");++ if (ModelState.IsValid)+ {+ deliveryDate = model.ToEntity(deliveryDate);+ deliveryDate.StoreId = CurrentStoreId;+ await deliveryDateService.UpdateDeliveryDate(deliveryDate);+ Success(translationService.GetResource("Admin.Configuration.Shipping.DeliveryDates.Updated"));+ return continueEditing+ ? RedirectToAction("EditDeliveryDate", new { id = deliveryDate.Id })+ : RedirectToAction("DeliveryDates");+ }+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ public async Task<IActionResult> DeleteDeliveryDate(string id)+ {+ var deliveryDate = await deliveryDateService.GetDeliveryDateById(id);+ if (deliveryDate == null || deliveryDate.StoreId != CurrentStoreId)+ return RedirectToAction("DeliveryDates");++ await deliveryDateService.DeleteDeliveryDate(deliveryDate);+ Success(translationService.GetResource("Admin.Configuration.Shipping.DeliveryDates.Deleted"));+ return RedirectToAction("DeliveryDates");+ }++ #endregion++ #region Warehouses++ public IActionResult Warehouses()+ {+ return View();+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.List)]+ public async Task<IActionResult> WarehousesListData()+ {+ var warehouses = (await warehouseService.GetAllWarehouses(CurrentStoreId))+ .ToList();++ var gridModel = new DataSourceResult {+ Data = warehouses.Select(w => w.ToModel()),+ Total = warehouses.Count+ };+ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Create)]+ public async Task<IActionResult> CreateWarehouse()+ {+ var model = new WarehouseModel();+ await PrepareWarehouseModel(model);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Create)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> CreateWarehouse(WarehouseModel model, bool continueEditing)+ {+ if (ModelState.IsValid)+ {+ var warehouse = model.ToEntity();+ warehouse.Address = model.Address.ToEntity();+ warehouse.StoreId = CurrentStoreId;+ await warehouseService.InsertWarehouse(warehouse);+ Success(translationService.GetResource("Admin.Configuration.Shipping.Warehouses.Added"));+ return continueEditing+ ? RedirectToAction("EditWarehouse", new { id = warehouse.Id })+ : RedirectToAction("Warehouses");+ }+ await PrepareWarehouseModel(model);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> EditWarehouse(string id)+ {+ var warehouse = await warehouseService.GetWarehouseById(id);+ if (warehouse == null || warehouse.StoreId != CurrentStoreId)+ return RedirectToAction("Warehouses");++ var model = warehouse.ToModel();+ await PrepareWarehouseModel(model);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> EditWarehouse(WarehouseModel model, bool continueEditing)+ {+ var warehouse = await warehouseService.GetWarehouseById(model.Id);+ if (warehouse == null || warehouse.StoreId != CurrentStoreId)+ return RedirectToAction("Warehouses");++ if (ModelState.IsValid)+ {+ warehouse = model.ToEntity(warehouse);+ warehouse.Address = model.Address.ToEntity();+ warehouse.StoreId = CurrentStoreId;+ await warehouseService.UpdateWarehouse(warehouse);+ Success(translationService.GetResource("Admin.Configuration.Shipping.Warehouses.Updated"));+ return continueEditing+ ? RedirectToAction("EditWarehouse", new { id = warehouse.Id })+ : RedirectToAction("Warehouses");+ }+ await PrepareWarehouseModel(model);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ public async Task<IActionResult> DeleteWarehouse(string id)+ {+ var warehouse = await warehouseService.GetWarehouseById(id);+ if (warehouse == null || warehouse.StoreId != CurrentStoreId)+ return RedirectToAction("Warehouses");++ await warehouseService.DeleteWarehouse(warehouse);+ Success(translationService.GetResource("Admin.Configuration.Shipping.Warehouses.Deleted"));+ return RedirectToAction("Warehouses");+ }++ #endregion++ #region Pickup points++ public IActionResult PickupPoints()+ {+ return View();+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.List)]+ public async Task<IActionResult> PickupPointsListData()+ {+ var pickupPoints = (await pickupPointService.GetAllPickupPoints(CurrentStoreId))+ .ToList();++ var gridModel = new DataSourceResult {+ Data = pickupPoints.Select(p => p.ToModel()),+ Total = pickupPoints.Count+ };+ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Create)]+ public async Task<IActionResult> CreatePickupPoint()+ {+ var model = new PickupPointModel();+ await PreparePickupPointModel(model);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Create)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> CreatePickupPoint(PickupPointModel model, bool continueEditing)+ {+ if (ModelState.IsValid)+ {+ var pickupPoint = model.ToEntity();+ pickupPoint.StoreId = CurrentStoreId;+ await pickupPointService.InsertPickupPoint(pickupPoint);+ Success(translationService.GetResource("Admin.Configuration.Shipping.PickupPoints.Added"));+ return continueEditing+ ? RedirectToAction("EditPickupPoint", new { id = pickupPoint.Id })+ : RedirectToAction("PickupPoints");+ }+ await PreparePickupPointModel(model);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> EditPickupPoint(string id)+ {+ var pickupPoint = await pickupPointService.GetPickupPointById(id);+ if (pickupPoint == null || pickupPoint.StoreId != CurrentStoreId)+ return RedirectToAction("PickupPoints");++ var model = pickupPoint.ToModel();+ await PreparePickupPointModel(model);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [Grand.Web.Common.Filters.ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> EditPickupPoint(PickupPointModel model, bool continueEditing)+ {+ var pickupPoint = await pickupPointService.GetPickupPointById(model.Id);+ if (pickupPoint == null || pickupPoint.StoreId != CurrentStoreId)+ return RedirectToAction("PickupPoints");++ if (ModelState.IsValid)+ {+ pickupPoint = model.ToEntity(pickupPoint);+ pickupPoint.StoreId = CurrentStoreId;+ await pickupPointService.UpdatePickupPoint(pickupPoint);+ Success(translationService.GetResource("Admin.Configuration.Shipping.PickupPoints.Updated"));+ return continueEditing+ ? RedirectToAction("EditPickupPoint", new { id = pickupPoint.Id })+ : RedirectToAction("PickupPoints");+ }+ await PreparePickupPointModel(model);+ return View(model);+ }++ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ public async Task<IActionResult> DeletePickupPoint(string id)+ {+ var pickupPoint = await pickupPointService.GetPickupPointById(id);+ if (pickupPoint == null || pickupPoint.StoreId != CurrentStoreId)+ return RedirectToAction("PickupPoints");++ await pickupPointService.DeletePickupPoint(pickupPoint);+ Success(translationService.GetResource("Admin.Configuration.Shipping.PickupPoints.Deleted"));+ return RedirectToAction("PickupPoints");+ }++ #endregion++ #region Restrictions++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> Restrictions()+ {+ var model = new ShippingMethodRestrictionModel();++ var countries = await countryService.GetAllCountries(showHidden: true);+ var shippingMethods = (await shippingMethodService.GetAllShippingMethods(CurrentStoreId))+ .Where(sm => sm.StoreId == CurrentStoreId).ToList();+ var customerGroups = await groupService.GetAllCustomerGroups();++ foreach (var country in countries)+ model.AvailableCountries.Add(new CountryModel {+ Id = country.Id,+ Name = country.Name+ });+ foreach (var sm in shippingMethods)+ model.AvailableShippingMethods.Add(new ShippingMethodModel {+ Id = sm.Id,+ Name = sm.Name+ });+ foreach (var r in customerGroups)+ model.AvailableCustomerGroups.Add(new CustomerGroupModel { Id = r.Id, Name = r.Name });++ foreach (var country in countries)+ foreach (var shippingMethod in shippingMethods)+ {+ var restricted = shippingMethod.CountryRestrictionExists(country.Id);+ if (!model.Restricted.ContainsKey(country.Id))+ model.Restricted[country.Id] = new Dictionary<string, bool>();+ model.Restricted[country.Id][shippingMethod.Id] = restricted;+ }++ foreach (var role in customerGroups)+ foreach (var shippingMethod in shippingMethods)+ {+ var restricted = shippingMethod.CustomerGroupRestrictionExists(role.Id);+ if (!model.RestictedGroup.ContainsKey(role.Id))+ model.RestictedGroup[role.Id] = new Dictionary<string, bool>();+ model.RestictedGroup[role.Id][shippingMethod.Id] = restricted;+ }++ return View(model);+ }++ [HttpPost]+ [ActionName("Restrictions")]+ [RequestFormLimits(ValueCountLimit = 2048)]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> RestrictionSave(IDictionary<string, string[]> model)+ {+ var countries = await countryService.GetAllCountries(showHidden: true);+ var shippingMethods = (await shippingMethodService.GetAllShippingMethods(CurrentStoreId))+ .Where(sm => sm.StoreId == CurrentStoreId).ToList();+ var customerGroups = await groupService.GetAllCustomerGroups();+ foreach (var shippingMethod in shippingMethods)+ {+ await SaveRestrictedCountries(model, shippingMethod, countries);+ await SaveRestrictedGroup(model, shippingMethod, customerGroups);+ }++ Success(translationService.GetResource("Admin.Configuration.Shipping.Restrictions.Updated"));+ await SaveSelectedTabIndex();++ return RedirectToAction("Restrictions");+ }++ private async Task SaveRestrictedGroup(IDictionary<string, string[]> model, ShippingMethod shippingMethod,+ IPagedList<CustomerGroup> customerGroups)+ {+ if (model.TryGetValue($"restrictgroup_{shippingMethod.Id}", out var roleIds))+ {+ var roleIdsToRestrict = roleIds.ToList();+ var changed = false;+ foreach (var role in customerGroups)+ {+ var restrict = roleIdsToRestrict.Contains(role.Id);+ var alreadyRestricted = shippingMethod.RestrictedGroups.Contains(role.Id);+ if (restrict && !alreadyRestricted)+ {+ shippingMethod.RestrictedGroups.Add(role.Id);+ changed = true;+ }+ else if (!restrict && alreadyRestricted)+ {+ shippingMethod.RestrictedGroups.Remove(role.Id);+ changed = true;+ }+ }+ if (changed)+ await shippingMethodService.UpdateShippingMethod(shippingMethod);+ }+ else+ {+ if (shippingMethod.RestrictedGroups.Count > 0)+ {+ shippingMethod.RestrictedGroups.Clear();+ await shippingMethodService.UpdateShippingMethod(shippingMethod);+ }+ }+ }++ private async Task SaveRestrictedCountries(IDictionary<string, string[]> model, ShippingMethod shippingMethod,+ IList<Country> countries)+ {+ if (model.TryGetValue($"restrict_{shippingMethod.Id}", out var countryIds))+ {+ var countryIdsToRestrict = countryIds.ToList();+ var changed = false;+ foreach (var country in countries)+ {+ var restrict = countryIdsToRestrict.Contains(country.Id);+ var alreadyRestricted = shippingMethod.RestrictedCountries.Any(c => c.Id == country.Id);+ if (restrict && !alreadyRestricted)+ {+ shippingMethod.RestrictedCountries.Add(country);+ changed = true;+ }+ else if (!restrict && alreadyRestricted)+ {+ shippingMethod.RestrictedCountries.Remove(+ shippingMethod.RestrictedCountries.First(c => c.Id == country.Id));+ changed = true;+ }+ }+ if (changed)+ await shippingMethodService.UpdateShippingMethod(shippingMethod);+ }+ else+ {+ if (shippingMethod.RestrictedCountries.Count > 0)+ {+ shippingMethod.RestrictedCountries.Clear();+ await shippingMethodService.UpdateShippingMethod(shippingMethod);+ }+ }+ }++ #endregion+}diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xmlindex f6b3c4e7a..c3407ce74 100644Binary files a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml and b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml differ