Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ private void SetupSuccessfulDataLoad(Guid merchantId,
Town = "Test Town",
Region = "Test Region",
PostalCode = "12345",
Country = "GB",
Country = "United Kingdom",
ContactId = Guid.NewGuid(),
ContactName = "Test Contact",
ContactEmailAddress = "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,19 @@ public async Task UpdateMerchant_SendsUpdateCommand_AndReturnsSuccess()
var estateId = Guid.NewGuid();
var merchantId = Guid.NewGuid();

var addressId = Guid.NewGuid();
var contactId = Guid.NewGuid();
var editModel = new BlazorServer.Models.MerchantModels.MerchantEditModel
{
MerchantName = "Upd",
SettlementSchedule = "S",
AddressId = addressId,
AddressLine1 = "A1",
Town = "T",
Region = "R",
PostalCode = "P",
Country = "C",
Country = "United Kingdom",
ContactId = contactId,
ContactName = "CN",
ContactEmailAddress = "e@x",
ContactPhoneNumber = "ph"
Expand All @@ -303,7 +307,9 @@ public async Task UpdateMerchant_SendsUpdateCommand_AndReturnsSuccess()
c.MerchantId == merchantId &&
c.Name == editModel.MerchantName &&
c.SettlementSchedule == editModel.SettlementSchedule &&
c.MerchantAddress.AddressId == addressId &&
c.MerchantAddress.AddressLine1 == editModel.AddressLine1 &&
c.MerchantContact.ContactId == contactId &&
c.MerchantContact.ContactName == editModel.ContactName
), It.IsAny<CancellationToken>()), Times.Once);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<label class="block text-sm font-medium text-gray-700 mb-1">
Country <span class="text-red-500">*</span>
</label>
<CountrySelector Value="merchantEditModel.Country" ValueChanged="@((string value) => merchantEditModel.Country = value)" ValueExpression="@(() => merchantEditModel.Country)" class="input w-full" name="Country"/>
<CountrySelector Value="@merchantEditModel.Country" ValueChanged="@((string value) => merchantEditModel.Country = value)" ValueExpression="@(() => merchantEditModel.Country)" class="input w-full" name="Country"/>
<ValidationMessage For="@(() => merchantEditModel.Country)" class="text-red-600 text-sm mt-1"/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<label class="block text-sm font-medium text-gray-700 mb-1">
Country <span class="text-red-500">*</span>
</label>
<CountrySelector Value="model.Country" ValueChanged="@((string value) => model.Country = value)" ValueExpression="@(() => model.Country)" class="input w-full" name="Country" />
<CountrySelector Value="@model.Country" ValueChanged="@((string value) => model.Country = value)" ValueExpression="@(() => model.Country)" class="input w-full" name="Country" />
<ValidationMessage For="@(() => model.Country)" class="text-red-600 text-sm mt-1" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<span class="truncate flex items-center gap-2">
@if (!string.IsNullOrEmpty(Value))
{
var selected = Countries.FirstOrDefault(c => c.Name == Value);
var selected = Countries.FirstOrDefault(c => c.Name == Value || c.Code == Value);
if (selected != null)
{
<span class="text-xl">@selected.Flag</span>
Expand Down Expand Up @@ -40,7 +40,7 @@
{
@foreach (var country in Countries)
{
var isSelected = Value == country.Name;
var isSelected = Value == country.Name || Value == country.Code;

<button type="button"
@onclick="@(() => SelectCountry(country.Name))"
Expand Down
1 change: 1 addition & 0 deletions EstateManagementUI.BlazorServer/Components/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
@using EstateManagementUI.BlazorServer.Components
@using EstateManagementUI.BlazorServer.Components.Layout
@using EstateManagementUI.BlazorServer.Components.Permissions
@using EstateManagementUI.BlazorServer.Components.Shared
@using EstateManagementUI.BlazorServer.Models
@using EstateManagementUI.BlazorServer.Permissions
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ public async Task<Result> UpdateMerchant(CorrelationId correlationId,
Guid estateId,
Guid merchantId,
MerchantModels.MerchantEditModel editMerchantModel) {
MerchantCommands.MerchantAddress address = new(Guid.NewGuid(), editMerchantModel.AddressLine1, editMerchantModel.Town, editMerchantModel.Region, editMerchantModel.PostalCode, editMerchantModel.Country);
MerchantCommands.MerchantContact contact = new(Guid.NewGuid(), editMerchantModel.ContactName, editMerchantModel.ContactEmailAddress, editMerchantModel.ContactPhoneNumber);
MerchantCommands.MerchantAddress address = new(editMerchantModel.AddressId, editMerchantModel.AddressLine1, editMerchantModel.Town, editMerchantModel.Region, editMerchantModel.PostalCode, editMerchantModel.Country);
MerchantCommands.MerchantContact contact = new(editMerchantModel.ContactId, editMerchantModel.ContactName, editMerchantModel.ContactEmailAddress, editMerchantModel.ContactPhoneNumber);

MerchantCommands.UpdateMerchantCommand command = new(correlationId, estateId, merchantId, editMerchantModel.MerchantName, editMerchantModel.SettlementSchedule,
address,contact);
Expand Down
Loading