Skip to content

Commit

Permalink
Extend Store entity - Add House bank fields
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Oct 18, 2021
1 parent d172ad9 commit f850cc7
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ public string CompanyVat
get { 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; }
Expand Down
11 changes: 11 additions & 0 deletions src/Core/Grand.Domain/Stores/BankAccount.cs
Original file line number Diff line number Diff line change
@@ -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; }

}
}
3 changes: 3 additions & 0 deletions src/Core/Grand.Domain/Stores/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public Store()
{
Locales = new List<TranslationEntity>();
Domains = new List<DomainHost>();
BankAccount = new BankAccount();
}

/// <summary>
Expand Down Expand Up @@ -104,6 +105,8 @@ public Store()
/// </summary>
public string DefaultAdminTheme { get; set; }

public BankAccount BankAccount { get; set; }

/// <summary>
/// Gets or sets the collection of locales
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//page title
ViewBag.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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//page title
ViewBag.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">
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions src/Web/Grand.Web.Admin/Controllers/StoreController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public async Task<IActionResult> Create(StoreModel model, bool continueEditing)
{
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
Expand Down Expand Up @@ -132,6 +135,9 @@ public async Task<IActionResult> Edit(StoreModel model, bool continueEditing)
{
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");
}

Expand Down
3 changes: 3 additions & 0 deletions src/Web/Grand.Web.Admin/Mapper/StoreProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public StoreProfile()
CreateMap<DomainHost, DomainHostModel>();
CreateMap<DomainHostModel, DomainHost>();

CreateMap<BankAccount, StoreModel.BankAccountModel>();
CreateMap<StoreModel.BankAccountModel, BankAccount>();

}

public int Order => 0;
Expand Down
17 changes: 16 additions & 1 deletion src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class StoreModel : BaseEntityModel, ILocalizedModel<StoreLocalize
public 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>();
Expand Down Expand Up @@ -79,6 +79,19 @@ public StoreModel()

public 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
Expand All @@ -101,4 +114,6 @@ public class DomainHostModel : BaseEntityModel
[GrandResourceDisplayName("Admin.Configuration.Stores.Domains.Fields.Primary")]
public bool Primary { get; set; }
}


}
15 changes: 15 additions & 0 deletions src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit f850cc7

Please sign in to comment.