From ee14f70a377cd66f7913e960d6075c7785741573 Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Wed, 15 Sep 2021 10:16:40 +0200 Subject: [PATCH] Improve Admin panel - allow to hide the store column on the grid --- .../Installation/InstallDataSettings.cs | 1 + .../Grand.Domain/Common/AdminAreaSettings.cs | 5 +++ .../Areas/Admin/Views/ContactForm/List.cshtml | 17 +++++--- .../_CreateOrUpdate.TabActivityLog.cshtml | 17 +++++--- ...eateOrUpdate.TabCurrentShoppingCart.cshtml | 18 ++++++--- .../_CreateOrUpdate.TabCurrentWishlist.cshtml | 19 ++++++--- .../_CreateOrUpdate.TabLoyaltyPoints.cshtml | 16 ++++++-- .../Customer/_CreateOrUpdate.TabOrders.cshtml | 17 +++++--- ...OrUpdate.TabOutOfStockSubscriptions.cshtml | 21 ++++++---- .../Views/NewsLetterSubscription/List.cshtml | 21 ++++++---- .../Areas/Admin/Views/Order/List.cshtml | 20 ++++++---- .../Product/_CreateOrUpdate.Prices.cshtml | 39 +++++++++++-------- .../Admin/Views/Setting/SystemSetting.cshtml | 12 ++++++ .../Components/LatestOrder/Default.cshtml | 18 ++++++--- .../_CurrentCarts.TabCurrentCarts.cshtml | 17 +++++--- .../_CurrentCarts.TabCurrentWishlists.cshtml | 17 +++++--- .../Controllers/SettingController.cs | 2 + .../Models/Settings/SystemSettingsModel.cs | 2 + .../App_Data/Resources/DefaultLanguage.xml | 3 ++ 19 files changed, 200 insertions(+), 82 deletions(-) diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs index 9f4c50908..0e7bad0ce 100644 --- a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs +++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs @@ -163,6 +163,7 @@ protected virtual async Task InstallSettings(bool installSampleData) DefaultGridPageSize = 15, GridPageSizes = "10, 15, 20, 50, 100", UseIsoDateTimeConverterInJson = true, + HideStoreColumn = true, }); await _settingService.SaveSetting(new CatalogSettings { diff --git a/src/Core/Grand.Domain/Common/AdminAreaSettings.cs b/src/Core/Grand.Domain/Common/AdminAreaSettings.cs index fe681d4b7..6d2943844 100644 --- a/src/Core/Grand.Domain/Common/AdminAreaSettings.cs +++ b/src/Core/Grand.Domain/Common/AdminAreaSettings.cs @@ -17,5 +17,10 @@ public class AdminAreaSettings : ISettings /// public bool UseIsoDateTimeConverterInJson { get; set; } + /// + /// Gets or sets a value indicating whether to hide column Store in a grid list + /// + public bool HideStoreColumn { get; set; } + } } \ No newline at end of file diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactForm/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactForm/List.cshtml index b17cc7bbc..462d5c04a 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactForm/List.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactForm/List.cshtml @@ -114,11 +114,18 @@ $(document).ready(function () { width: 100, type: "date", format: "{0:G}" - }, { - field: "Store", - title: "@Loc["Admin.System.ContactForm.Fields.Store"]", - width: 100 - }, { + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "Store", + title: "@Loc["Admin.System.ContactForm.Fields.Store"]", + width: 100 + }, + + } + { field: "Email", title: "@Loc["Admin.System.ContactForm.Fields.FullName"]", width: 150 diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabActivityLog.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabActivityLog.cshtml index ca9ece618..718103497 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabActivityLog.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabActivityLog.cshtml @@ -121,11 +121,18 @@ width: 100, type: "date", format: "{0:G}" - }, { - field: "Store", - title: "@Loc["Admin.System.ContactForm.Fields.Store"]", - width: 100 - }, { + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "Store", + title: "@Loc["Admin.System.ContactForm.Fields.Store"]", + width: 100 + }, + + } + { field: "Email", title: "@Loc["Admin.System.ContactForm.Fields.FullName"]", width: 150 diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentShoppingCart.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentShoppingCart.cshtml index a64c1f5c5..a377422e9 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentShoppingCart.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentShoppingCart.cshtml @@ -1,4 +1,5 @@ @model CustomerModel +@inject AdminAreaSettings adminAreaSettings
@@ -105,11 +106,18 @@ $(document).ready(function () { field: "Total", title: "@Loc["Admin.CurrentCarts.Total"]", width:200 - },{ - field: "Store", - title: "@Loc["Admin.CurrentCarts.Store"]", - width:200 - },{ + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "Store", + title: "@Loc["Admin.CurrentCarts.Store"]", + width:200 + }, + + } + { field: "UpdatedOn", title: "@Loc["Admin.CurrentCarts.UpdatedOn"]", width: 200, diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentWishlist.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentWishlist.cshtml index 5b8e3f0aa..ded49e99a 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentWishlist.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabCurrentWishlist.cshtml @@ -1,4 +1,6 @@ @model CustomerModel +@inject AdminAreaSettings adminAreaSettings +
@Loc["Admin.Customers.Customers.CurrentWishlist"] @@ -81,11 +83,18 @@ $(document).ready(function () { field: "Total", title: "@Loc["Admin.CurrentCarts.Total"]", width:200 - },{ - field: "Store", - title: "@Loc["Admin.CurrentCarts.Store"]", - width:200 - },{ + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "Store", + title: "@Loc["Admin.CurrentCarts.Store"]", + width:200 + }, + + } + { field: "UpdatedOn", title: "@Loc["Admin.CurrentCarts.UpdatedOn"]", width: 200, diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabLoyaltyPoints.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabLoyaltyPoints.cshtml index 9e02a5e0f..a6ef01313 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabLoyaltyPoints.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabLoyaltyPoints.cshtml @@ -1,4 +1,5 @@ @model CustomerModel +@inject AdminAreaSettings adminAreaSettings
@@ -45,10 +46,17 @@ mode: "inline" }, scrollable: false, - columns: [{ - field: "StoreName", - title: "@Loc["Admin.Customers.Customers.LoyaltyPoints.Fields.Store"]" - },{ + columns: [ + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "StoreName", + title: "@Loc["Admin.Customers.Customers.LoyaltyPoints.Fields.Store"]" + }, + + } + { field: "Points", title: "@Loc["Admin.Customers.Customers.LoyaltyPoints.Fields.Points"]" }, { diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOrders.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOrders.cshtml index 8f6f2b5d3..77fe59d5a 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOrders.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOrders.cshtml @@ -75,11 +75,18 @@ field: "ShippingStatus", title: "@Loc["Admin.Customers.Customers.Orders.ShippingStatus"]", width: 180 - }, { - field: "StoreName", - title: "@Loc["Admin.Customers.Customers.Orders.Store"]", - width: 200 - }, { + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "StoreName", + title: "@Loc["Admin.Customers.Customers.Orders.Store"]", + width: 200 + }, + + } + { field: "CreatedOn", title: "@Loc["Admin.System.Log.Fields.CreatedOn"]", width: 220, diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOutOfStockSubscriptions.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOutOfStockSubscriptions.cshtml index a65dd1ae8..17d3e11a2 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOutOfStockSubscriptions.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/_CreateOrUpdate.TabOutOfStockSubscriptions.cshtml @@ -8,7 +8,7 @@
- + } \ No newline at end of file diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsLetterSubscription/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsLetterSubscription/List.cshtml index 89a66c760..e8999c62e 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsLetterSubscription/List.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/NewsLetterSubscription/List.cshtml @@ -152,14 +152,21 @@ headerAttributes: { style: "text-align:center" }, attributes: { style: "text-align:center" }, template: '# if(Active) {# #} else {# #} #' - }, { - field: "StoreName", - title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Store"]", - width: 150 - }, { + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "StoreName", + title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Store"]", + width: 150 + }, + + } + { field: "Categories", - title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Categories"]", - width: 300 + title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Categories"]", + width: 300 }, { field: "CreatedOn", title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.CreatedOn"]", diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml index 33455a7c5..6660c05c4 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml @@ -317,7 +317,7 @@ width: 120, template: '#=ShippingStatus#' }, - } + } { field: "CustomerEmail", title: "@Loc["Admin.Orders.Fields.Customer"]", @@ -331,12 +331,18 @@ } }, + @if (!adminAreaSettings.HideStoreColumn) { - field: "StoreName", - title: "@Loc["Admin.Orders.Fields.Store"]", - width: 150, - minScreenWidth: 770, - }, { + + { + field: "StoreName", + title: "@Loc["Admin.Orders.Fields.Store"]", + width: 150, + minScreenWidth: 770, + }, + + } + { field: "CreatedOn", title: "@Loc["Admin.Orders.Fields.CreatedOn"]", width: 180, @@ -353,7 +359,7 @@ width: 150, template: '#=OrderTotal#', headerAttributes: { style: "text-align:right" }, - attributes: { style: "text-align:right" }, + attributes: { style: "text-align:right" }, }, } ] diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Prices.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Prices.cshtml index f5b34fbb2..750ca6490 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Prices.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Prices.cshtml @@ -1,4 +1,5 @@ @model ProductModel +@inject AdminAreaSettings adminAreaSettings
@@ -45,7 +46,7 @@
@@ -55,7 +56,7 @@
@@ -65,7 +66,7 @@
@@ -82,7 +83,7 @@
@@ -92,7 +93,7 @@
@@ -116,7 +117,7 @@
@@ -154,7 +155,7 @@
@@ -253,11 +254,17 @@ mode: "inline" }, scrollable: false, - columns: [{ - field: "StoreId", - title: "@Loc["Admin.Catalog.Products.TierPrices.Fields.Store"]", - template: "#:Store#" - }, + columns: [ + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "StoreId", + title: "@Loc["Admin.Catalog.Products.TierPrices.Fields.Store"]", + template: "#:Store#" + }, + + } { field: "CustomerGroupId", title: "@Loc["Admin.Catalog.Products.TierPrices.Fields.CustomerGroup"]", @@ -318,10 +325,10 @@ else { - } + }
@@ -332,4 +339,4 @@ else @Html.Raw(@Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
} - \ No newline at end of file + \ No newline at end of file diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml index 248a4e6a9..3c953dd07 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml @@ -93,6 +93,18 @@
+
+
+ +
+
+ + +
+
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml index 7ef95f8cd..acb706116 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml @@ -1,4 +1,5 @@ @model bool +@inject AdminAreaSettings adminAreaSettings
@@ -65,13 +66,18 @@ } }, + @if (!adminAreaSettings.HideStoreColumn) { - field: "StoreName", - title: "@Loc["Admin.Orders.Fields.Store"]", - width: 200, - headerAttributes: { style: "text-align:center" }, - attributes: { style: "text-align:center" }, - }, + + { + field: "StoreName", + title: "@Loc["Admin.Orders.Fields.Store"]", + width: 200, + headerAttributes: { style: "text-align:center" }, + attributes: { style: "text-align:center" }, + }, + + } { field: "PaymentStatus", title: "@Loc["Admin.Orders.Fields.PaymentStatus"]", diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentCarts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentCarts.cshtml index 91dd91cdd..014f3bb50 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentCarts.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentCarts.cshtml @@ -106,11 +106,18 @@ function detailInitCart(e) { field: "Total", title: "@Loc["Admin.CurrentCarts.Total"]", width: 150 - },{ - field: "Store", - title: "@Loc["Admin.CurrentCarts.Store"]", - width: 150 - },{ + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "Store", + title: "@Loc["Admin.CurrentCarts.Store"]", + width: 150 + }, + + } + { field: "UpdatedOn", title: "@Loc["Admin.CurrentCarts.UpdatedOn"]", width: 150, diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentWishlists.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentWishlists.cshtml index 63ba96b79..a04cda419 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentWishlists.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/_CurrentCarts.TabCurrentWishlists.cshtml @@ -106,11 +106,18 @@ field: "Total", title: "@Loc["Admin.CurrentCarts.Total"]", width: 150 - },{ - field: "Store", - title: "@Loc["Admin.CurrentCarts.Store"]", - width: 150 - },{ + }, + @if (!adminAreaSettings.HideStoreColumn) + { + + { + field: "Store", + title: "@Loc["Admin.CurrentCarts.Store"]", + width: 150 + }, + + } + { field: "UpdatedOn", title: "@Loc["Admin.CurrentCarts.UpdatedOn"]", width: 150, diff --git a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs index 3be4532b3..113228b37 100644 --- a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs @@ -1195,6 +1195,7 @@ public async Task SystemSetting() model.DefaultGridPageSize = adminsettings.DefaultGridPageSize; model.GridPageSizes = adminsettings.GridPageSizes; model.UseIsoDateTimeConverterInJson = adminsettings.UseIsoDateTimeConverterInJson; + model.HideStoreColumn = adminsettings.HideStoreColumn; //language settings var langsettings = _settingService.LoadSetting(); @@ -1231,6 +1232,7 @@ public async Task SystemSetting(SystemSettingsModel model) adminAreaSettings.DefaultGridPageSize = model.DefaultGridPageSize; adminAreaSettings.GridPageSizes = model.GridPageSizes; adminAreaSettings.UseIsoDateTimeConverterInJson = model.UseIsoDateTimeConverterInJson; + adminAreaSettings.HideStoreColumn = model.HideStoreColumn; await _settingService.SaveSetting(adminAreaSettings); diff --git a/src/Web/Grand.Web.Admin/Models/Settings/SystemSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/SystemSettingsModel.cs index 140e5d4e3..54830b9c1 100644 --- a/src/Web/Grand.Web.Admin/Models/Settings/SystemSettingsModel.cs +++ b/src/Web/Grand.Web.Admin/Models/Settings/SystemSettingsModel.cs @@ -29,6 +29,8 @@ public class SystemSettingsModel : BaseModel [GrandResourceDisplayName("Admin.Settings.System.UseIsoDateTimeConverterInJson")] public bool UseIsoDateTimeConverterInJson { get; set; } + [GrandResourceDisplayName("Admin.Settings.System.HideStoreColumn")] + public bool HideStoreColumn { get; set; } #endregion diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml index f6018e013..7122dc6d7 100644 --- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml +++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml @@ -11862,6 +11862,9 @@ Grid Page Sizes + + Hide column The Store on the grid + Ignore RTL language property for admin area