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
Extend Store entity - Add House bank fields
KrzysztofPajakf850cc7ba3c0
diff --git a/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidStore.cs b/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidStore.csindex 53382337e..0121c31b1 100644--- a/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidStore.cs+++ b/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidStore.cs@@ -72,6 +72,19 @@ namespace Grand.Business.Messages.DotLiquidDropsget { return _store.CompanyVat; }}+ public string BankCode {+ get { return _store.BankAccount?.BankCode; }+ }+ public string BankName {+ get { return _store.BankAccount?.BankName; }+ }+ public string SwiftCode {+ get { return _store.BankAccount?.SwiftCode; }+ }+ public string AccountNumber {+ get { return _store.BankAccount?.AccountNumber; }+ }+public string TwitterLink { get; set; }public string FacebookLink { get; set; }diff --git a/src/Core/Grand.Domain/Stores/BankAccount.cs b/src/Core/Grand.Domain/Stores/BankAccount.csnew file mode 100644index 000000000..4a3d9085c--- /dev/null+++ b/src/Core/Grand.Domain/Stores/BankAccount.cs@@ -0,0 +1,11 @@+namespace Grand.Domain.Stores+{+ public class BankAccount : SubBaseEntity+ {+ public string BankCode { get; set; }+ public string BankName { get; set; }+ public string SwiftCode { get; set; }+ public string AccountNumber { get; set; }++ }+}diff --git a/src/Core/Grand.Domain/Stores/Store.cs b/src/Core/Grand.Domain/Stores/Store.csindex e9c8b8e4f..875d4745b 100644--- a/src/Core/Grand.Domain/Stores/Store.cs+++ b/src/Core/Grand.Domain/Stores/Store.cs@@ -12,6 +12,7 @@ namespace Grand.Domain.Stores{Locales = new List<TranslationEntity>();Domains = new List<DomainHost>();+ BankAccount = new BankAccount();}/// <summary>@@ -104,6 +105,8 @@ namespace Grand.Domain.Stores/// </summary>public string DefaultAdminTheme { get; set; }+ public BankAccount BankAccount { get; set; }+/// <summary>/// Gets or sets the collection of locales/// </summary>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Create.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Create.cshtmlindex 6a361137a..e25ae6067 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Create.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Create.cshtml@@ -3,7 +3,7 @@//page titleViewBag.Title = Loc["Admin.Configuration.Stores.AddNew"];}-<form asp-area="@Constants.AreaAdmin" asp-controller="Store" asp-action="Create" method="post">+<form asp-area="@Constants.AreaAdmin" asp-controller="Store" asp-action="Create" method="post" id="store-form"><div class="row"><div class="col-md-12">diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Edit.cshtmlindex 44613d24b..bed23fd4e 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Edit.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Edit.cshtml@@ -3,7 +3,7 @@//page titleViewBag.Title = Loc["Admin.Configuration.Stores.EditStoreDetails"];}-<form asp-area="@Constants.AreaAdmin" asp-controller="Store" asp-action="Edit" method="post">+<form asp-area="@Constants.AreaAdmin" asp-controller="Store" asp-action="Edit" method="post" id="store-form"><div class="row"><div class="col-md-12">diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.TabBankAccount.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.TabBankAccount.cshtmlnew file mode 100644index 000000000..28eace0af--- /dev/null+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.TabBankAccount.cshtml@@ -0,0 +1,34 @@+@model StoreModel++<div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="BankAccount.BankCode" />+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="BankAccount.BankCode" />+ <span asp-validation-for="BankAccount.BankCode"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="BankAccount.BankName" />+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="BankAccount.BankName" />+ <span asp-validation-for="BankAccount.BankName"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="BankAccount.SwiftCode" />+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="BankAccount.SwiftCode" />+ <span asp-validation-for="BankAccount.SwiftCode"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="BankAccount.AccountNumber" />+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="BankAccount.AccountNumber" />+ <span asp-validation-for="BankAccount.AccountNumber"></span>+ </div>+ </div>+ </div>+</div>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.cshtmlindex 6afc5abf8..94c8ff9c2 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/_CreateOrUpdate.cshtml@@ -37,6 +37,13 @@</div></content></tabstrip-item>+ <tabstrip-item text="@Loc["Admin.Stores.BankInfo"]" tab-index="2">+ <content>+ <div>+ <partial name="_CreateOrUpdate.TabBankAccount" model="Model" />+ </div>+ </content>+ </tabstrip-item><vc:admin-widget widget-zone="store_details_tabs" additional-data="Model" /></items></admin-tabstrip>diff --git a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs b/src/Web/Grand.Web.Admin/Controllers/StoreController.csindex f765cd160..377b89ba4 100644--- a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs@@ -78,6 +78,9 @@ namespace Grand.Web.Admin.Controllers{var store = await _storeViewModelService.InsertStoreModel(model);Success(_translationService.GetResource("Admin.Configuration.Stores.Added"));+ //selected tab+ await SaveSelectedTabIndex();+return continueEditing ? RedirectToAction("Edit", new { id = store.Id }) : RedirectToAction("List");}//languages@@ -132,6 +135,9 @@ namespace Grand.Web.Admin.Controllers{store = await _storeViewModelService.UpdateStoreModel(store, model);Success(_translationService.GetResource("Admin.Configuration.Stores.Updated"));+ //selected tab+ await SaveSelectedTabIndex();+return continueEditing ? RedirectToAction("Edit", new { id = store.Id }) : RedirectToAction("List");}diff --git a/src/Web/Grand.Web.Admin/Mapper/StoreProfile.cs b/src/Web/Grand.Web.Admin/Mapper/StoreProfile.csindex a983f7224..0a0538cdb 100644--- a/src/Web/Grand.Web.Admin/Mapper/StoreProfile.cs+++ b/src/Web/Grand.Web.Admin/Mapper/StoreProfile.cs@@ -25,6 +25,9 @@ namespace Grand.Web.Admin.MapperCreateMap<DomainHost, DomainHostModel>();CreateMap<DomainHostModel, DomainHost>();+ CreateMap<BankAccount, StoreModel.BankAccountModel>();+ CreateMap<StoreModel.BankAccountModel, BankAccount>();+}public int Order => 0;diff --git a/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs b/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.csindex fe4347515..b2fed2f54 100644--- a/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs+++ b/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs@@ -11,7 +11,7 @@ namespace Grand.Web.Admin.Models.Storespublic StoreModel(){Locales = new List<StoreLocalizedModel>();- Domains = new List<DomainHostModel>();+ Domains = new List<DomainHostModel>();AvailableLanguages = new List<SelectListItem>();AvailableWarehouses = new List<SelectListItem>();AvailableCountries = new List<SelectListItem>();@@ -79,6 +79,19 @@ namespace Grand.Web.Admin.Models.Storespublic IList<DomainHostModel> Domains { get; set; }+ public BankAccountModel BankAccount { get; set; }++ public class BankAccountModel : BaseEntityModel+ {+ [GrandResourceDisplayName("Admin.Configuration.Stores.BankAccount.Fields.BankCode")]+ public string BankCode { get; set; }+ [GrandResourceDisplayName("Admin.Configuration.Stores.BankAccount.Fields.BankName")]+ public string BankName { get; set; }+ [GrandResourceDisplayName("Admin.Configuration.Stores.BankAccount.Fields.SwiftCode")]+ public string SwiftCode { get; set; }+ [GrandResourceDisplayName("Admin.Configuration.Stores.BankAccount.Fields.AccountNumber")]+ public string AccountNumber { get; set; }+ }}public partial class StoreLocalizedModel : ILocalizedModelLocal@@ -101,4 +114,6 @@ namespace Grand.Web.Admin.Models.Stores[GrandResourceDisplayName("Admin.Configuration.Stores.Domains.Fields.Primary")]public bool Primary { get; set; }}++}\ No newline at end of filediff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xmlindex 49398dbf1..f7ffac3c9 100644--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml@@ -5079,6 +5079,18 @@<Resource Name="Admin.Configuration.Stores.BackToList"><Value>back to store list</Value></Resource>+ <Resource Name="Admin.Configuration.Stores.BankAccount.Fields.AccountNumber">+ <Value>Account number</Value>+ </Resource>+ <Resource Name="Admin.Configuration.Stores.BankAccount.Fields.BankCode">+ <Value>Bank Code</Value>+ </Resource>+ <Resource Name="Admin.Configuration.Stores.BankAccount.Fields.BankName">+ <Value>Bank Name</Value>+ </Resource>+ <Resource Name="Admin.Configuration.Stores.BankAccount.Fields.SwiftCode">+ <Value>BIC/SWIFT Code</Value>+ </Resource><Resource Name="Admin.Configuration.Stores.Deleted"><Value>The store has been deleted successfully.</Value></Resource>@@ -12018,6 +12030,9 @@<Resource Name="Admin.Settings.Vendor.VendorSettings"><Value>Vendor settings</Value></Resource>+ <Resource Name="Admin.Stores.BankInfo">+ <Value>House bank</Value>+ </Resource><Resource Name="Admin.Stores.Domains"><Value>Domains</Value></Resource>