-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
support
committed
Nov 5, 2023
1 parent
d3a1a36
commit 253dffe
Showing
6 changed files
with
124 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationAddLandingPage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Grand.Domain.Data; | ||
using Grand.Domain.Pages; | ||
using Grand.Infrastructure.Migrations; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Grand.Business.System.Services.Migrations._2._2; | ||
|
||
public class MigrationAddLandingPage: IMigration | ||
{ | ||
public int Priority => 0; | ||
public DbVersion Version => new(2, 2); | ||
public Guid Identity => new("0833f104-54d5-41d0-83da-375d2520f709"); | ||
public string Name => "Add new landing page - VendorPortalInfo"; | ||
public bool UpgradeProcess(IDatabaseContext database, IServiceProvider serviceProvider) | ||
{ | ||
var pageLayoutRepository = serviceProvider.GetRequiredService<IRepository<PageLayout>>(); | ||
var defaultPageLayout = | ||
pageLayoutRepository.Table.FirstOrDefault(tt => tt.Name == "Default layout"); | ||
|
||
var repository = serviceProvider.GetRequiredService<IRepository<Page>>(); | ||
var page = new Page { | ||
SystemName = "VendorPortalInfo", | ||
IncludeInSitemap = false, | ||
IsPasswordProtected = false, | ||
DisplayOrder = 1, | ||
Title = "Welcome to our Vendor Management Hub!", | ||
Body = | ||
"<p>Manage your product catalog, oversee customer orders, and streamline your shipping processes. Your vendor dashboard is the command center for your success. Stay organized, serve your customers efficiently, and watch your business thrive.</p>", | ||
PageLayoutId = defaultPageLayout?.Id, | ||
Published = true | ||
}; | ||
repository.Insert(page); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorPage/Default.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@model Grand.Web.Vendor.Models.Common.VendorPortalModel | ||
|
||
<div class="card"> | ||
<div class="card-title"> | ||
<div class="h3 text-center"> | ||
@Model.Title | ||
</div> | ||
</div> | ||
<div class="card-body"> | ||
@Html.Raw(Model.Body) | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Grand.Business.Core.Interfaces.Cms; | ||
using Grand.Web.Common.Components; | ||
using Grand.Web.Vendor.Models.Common; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Grand.Web.Vendor.Components; | ||
|
||
public class VendorPageViewComponent: BaseVendorViewComponent | ||
{ | ||
#region Fields | ||
|
||
private readonly IPageService _pageService; | ||
|
||
#endregion | ||
|
||
#region Constructors | ||
|
||
public VendorPageViewComponent( | ||
IPageService pageService) | ||
{ | ||
_pageService = pageService; | ||
} | ||
|
||
#endregion | ||
|
||
#region Invoker | ||
|
||
public async Task<IViewComponentResult> InvokeAsync(string systemName) | ||
{ | ||
var page = await _pageService.GetPageBySystemName(systemName); | ||
var model = new VendorPortalModel(page?.Title, page?.Body); | ||
return View(model); | ||
} | ||
|
||
#endregion | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Grand.Web.Vendor.Models.Common; | ||
|
||
public record VendorPortalModel(string Title, string Body); |