Skip to content

Commit

Permalink
Improve Admin panel - allow to hide the store column on the grid
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Sep 15, 2021
1 parent 6b6179b commit ee14f70
Show file tree
Hide file tree
Showing 19 changed files with 200 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Grand.Domain/Common/AdminAreaSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ public class AdminAreaSettings : ISettings
/// </summary>
public bool UseIsoDateTimeConverterInJson { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to hide column Store in a grid list
/// </summary>
public bool HideStoreColumn { get; set; }

}
}
17 changes: 12 additions & 5 deletions src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactForm/List.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
<text>
{
field: "Store",
title: "@Loc["Admin.System.ContactForm.Fields.Store"]",
width: 100
},
</text>
}
{
field: "Email",
title: "@Loc["Admin.System.ContactForm.Fields.FullName"]",
width: 150
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
<text>
{
field: "Store",
title: "@Loc["Admin.System.ContactForm.Fields.Store"]",
width: 100
},
</text>
}
{
field: "Email",
title: "@Loc["Admin.System.ContactForm.Fields.FullName"]",
width: 150
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@model CustomerModel
@inject AdminAreaSettings adminAreaSettings

<div class="panel panel-default">
<div class="panel-heading">
Expand Down Expand Up @@ -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)
{
<text>
{
field: "Store",
title: "@Loc["Admin.CurrentCarts.Store"]",
width:200
},
</text>
}
{
field: "UpdatedOn",
title: "@Loc["Admin.CurrentCarts.UpdatedOn"]",
width: 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@model CustomerModel
@inject AdminAreaSettings adminAreaSettings

<div class="panel panel-default">
<div class="panel-heading">
@Loc["Admin.Customers.Customers.CurrentWishlist"]
Expand Down Expand Up @@ -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)
{
<text>
{
field: "Store",
title: "@Loc["Admin.CurrentCarts.Store"]",
width:200
},
</text>
}
{
field: "UpdatedOn",
title: "@Loc["Admin.CurrentCarts.UpdatedOn"]",
width: 200,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@model CustomerModel
@inject AdminAreaSettings adminAreaSettings

<div class="panel panel-default">
<vc:admin-widget widget-zone="customer_details_loyalty_points_top" additional-data="Model" />
Expand Down Expand Up @@ -45,10 +46,17 @@
mode: "inline"
},
scrollable: false,
columns: [{
field: "StoreName",
title: "@Loc["Admin.Customers.Customers.LoyaltyPoints.Fields.Store"]"
},{
columns: [
@if (!adminAreaSettings.HideStoreColumn)
{
<text>
{
field: "StoreName",
title: "@Loc["Admin.Customers.Customers.LoyaltyPoints.Fields.Store"]"
},
</text>
}
{
field: "Points",
title: "@Loc["Admin.Customers.Customers.LoyaltyPoints.Fields.Points"]"
}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
<text>
{
field: "StoreName",
title: "@Loc["Admin.Customers.Customers.Orders.Store"]",
width: 200
},
</text>
}
{
field: "CreatedOn",
title: "@Loc["Admin.System.Log.Fields.CreatedOn"]",
width: 220,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<vc:admin-widget widget-zone="customer_details_back_in_stock_bottom" additional-data="Model" />
</div>
<script>
<script>
$(document).ready(function () {
$("#outofstock-subscriptions-grid").kendoGrid({
dataSource: {
Expand Down Expand Up @@ -44,11 +44,18 @@
mode: "inline"
},
scrollable: false,
columns: [{
field: "StoreName",
title: "@Loc["Admin.Customers.Customers.OutOfStockSubscriptions.Store"]",
width: 200,
}, {
columns: [
@if (!adminAreaSettings.HideStoreColumn)
{
<text>
{
field: "StoreName",
title: "@Loc["Admin.Customers.Customers.OutOfStockSubscriptions.Store"]",
width: 200,
},
</text>
}
{
field: "ProductId",
title: "@Loc["Admin.Customers.Customers.OutOfStockSubscriptions.Product"]",
width: 300,
Expand All @@ -62,5 +69,5 @@
}]
});
});
</script>
</script>
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,21 @@
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(Active) {# <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> #} #'
}, {
field: "StoreName",
title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Store"]",
width: 150
}, {
},
@if (!adminAreaSettings.HideStoreColumn)
{
<text>
{
field: "StoreName",
title: "@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Store"]",
width: 150
},
</text>
}
{
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"]",
Expand Down
20 changes: 13 additions & 7 deletions src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
width: 120,
template: '<a class="k-link" href="Edit/#=Id#">#=ShippingStatus#</a>'
},</text>
}
}
{
field: "CustomerEmail",
title: "@Loc["Admin.Orders.Fields.Customer"]",
Expand All @@ -331,12 +331,18 @@
</text>
}
},
@if (!adminAreaSettings.HideStoreColumn)
{
field: "StoreName",
title: "@Loc["Admin.Orders.Fields.Store"]",
width: 150,
minScreenWidth: 770,
}, {
<text>
{
field: "StoreName",
title: "@Loc["Admin.Orders.Fields.Store"]",
width: 150,
minScreenWidth: 770,
},
</text>
}
{
field: "CreatedOn",
title: "@Loc["Admin.Orders.Fields.CreatedOn"]",
width: 180,
Expand All @@ -353,7 +359,7 @@
width: 150,
template: '#=OrderTotal#',
headerAttributes: { style: "text-align:right" },
attributes: { style: "text-align:right" },
attributes: { style: "text-align:right" },
},</text>
}
]
Expand Down

0 comments on commit ee14f70

Please sign in to comment.