Skip to content

Commit

Permalink
Add vendor page info
Browse files Browse the repository at this point in the history
  • Loading branch information
support committed Nov 5, 2023
1 parent d3a1a36 commit 253dffe
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,18 @@ protected virtual async Task InstallPages()
Body = "<p>Knowledgebase homepage. You can edit this in the admin site.</p>",
PageLayoutId = defaultPageLayout.Id,
Published = true
}
},
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
}
};
await _pageRepository.InsertAsync(pages);

Expand Down
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;
}
}
50 changes: 25 additions & 25 deletions src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@
}

<vc:vendor-widget widget-zone="vendor_dashboard_top" additional-data="null"/>
<div class="row">
<div class="col-md-12">
<div class="x_panel">
<div class="x_title">
<h2>@Loc["Vendor.Dashboard.Summary"] - @WorkContext.CurrentVendor.Name</h2>
<div class="filter">
<div class="page-bar" style="height:43px;">
<div class="page-toolbar">
<div id="dashboard-report-range" class="pull-right btn btn-fit-height green" data-original-title="Change dashboard date range">
<i class="icon-calendar"></i>&nbsp;
<span class="thin uppercase d-none d-sm-inline"></span>&nbsp;
<i class="fa fa-angle-down"></i>
</div>
<div class="row">
<div class="col-md-12">
<div class="x_panel">
<div class="x_title">
<h2>@Loc["Vendor.Dashboard.Summary"] - @WorkContext.CurrentVendor.Name</h2>
<div class="filter">
<div class="page-bar" style="height:43px;">
<div class="page-toolbar">
<div id="dashboard-report-range" class="pull-right btn btn-fit-height green" data-original-title="Change dashboard date range">
<i class="icon-calendar"></i>&nbsp;
<span class="thin uppercase d-none d-sm-inline"></span>&nbsp;
<i class="fa fa-angle-down"></i>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="x_panel light bordered">
<div class="x_title">
<h2 class="caption-subject font-blue bold uppercase">@Loc["Vendor.Dashboard.ReportLatestOrder"]</h2>
<div class="clear"></div>
</div>
<div class="x_content">
@await Component.InvokeAsync("LatestVendorOrder")
</div>
</div>
<vc:vendor-page system-name="VendorPortalInfo"/>
<div class="row">
<div class="col-md-12">
<div class="x_panel light bordered">
<div class="x_title">
<h2 class="caption-subject font-blue bold uppercase">@Loc["Vendor.Dashboard.ReportLatestOrder"]</h2>
<div class="clear"></div>
</div>
<div class="x_content">
@await Component.InvokeAsync("LatestVendorOrder")
</div>
</div>
</div>
</div>

<vc:vendor-widget widget-zone="vendor_dashboard_bottom" additional-data="null"/>
<script>
Expand Down
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>
37 changes: 37 additions & 0 deletions src/Web/Grand.Web.Vendor/Components/VendorPage.cs
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

}
3 changes: 3 additions & 0 deletions src/Web/Grand.Web.Vendor/Models/Common/VendorPortalModel.cs
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);

0 comments on commit 253dffe

Please sign in to comment.