SHA256
Small fixes and improvements:
- StayExport - SpainParteViajerosProvider - Fixed validation for codigoPostal/codMunicipio. - AddressQueryDialog - Add loading indication and "debounce" input to reduce API queries.
This commit is contained in:
@@ -17,13 +17,22 @@
|
||||
<MudStack row>
|
||||
<MudTextField @bind-Value="SearchText" Label="@LanguageLocale.control_AddressQueryDialog_searchText"
|
||||
Required />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Search" OnClick="btnSearchAddress" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Search" OnClick="btnSearchAddress" Disabled="@_isDataLoading" />
|
||||
</MudStack>
|
||||
|
||||
<MudPaper Class="mt-4 pa-2">
|
||||
@if (addressResults.Count == 0)
|
||||
@if (addressResults.Count == 0 && !_isDataLoading)
|
||||
{
|
||||
<MudText Typo="Typo.body1">@LanguageLocale.general_noResults</MudText>
|
||||
<MudElement Style="width: 100%; height: 100px;" HtmlTag="div">
|
||||
<MudText Typo="Typo.body1" Align="Align.Center">
|
||||
@LanguageLocale.general_noResults
|
||||
</MudText>
|
||||
</MudElement>
|
||||
}
|
||||
|
||||
@if (_isDataLoading)
|
||||
{
|
||||
<MudSkeleton Width="100%" Height="100px" />
|
||||
}
|
||||
|
||||
<MudList T="AddressResultDTO" @bind-SelectedValue="SelectedAddressResult"
|
||||
@@ -81,6 +90,9 @@
|
||||
private List<AddressResultDTO> addressResults = [];
|
||||
private AddressResultDTO? SelectedAddressResult { get; set; }
|
||||
|
||||
private bool _isDataLoading = false;
|
||||
private string _lastSearchText = "";
|
||||
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
@@ -99,16 +111,20 @@
|
||||
|
||||
private async Task btnSearchAddress()
|
||||
{
|
||||
if (SearchText.Length == 0)
|
||||
if (SearchText.Length == 0 || SearchText == _lastSearchText)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var queryService = addressQueryFactory.GetService();
|
||||
_isDataLoading = true;
|
||||
|
||||
var queryService = addressQueryFactory.GetService();
|
||||
addressResults = await queryService.SearchAddressAsync(SearchText);
|
||||
_lastSearchText = SearchText;
|
||||
|
||||
_isDataLoading = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -306,7 +306,7 @@ public class StayExportProviderSpainParteViajeros(
|
||||
.NotEmpty()
|
||||
.When(p => p.pais != PersonDireccionPais_ESP)
|
||||
.MaximumLength(100);
|
||||
d.RuleFor(p => p.codigoMunicipio)
|
||||
d.RuleFor(p => p.codigoPostal)
|
||||
.NotEmpty()
|
||||
.MaximumLength(20);
|
||||
d.RuleFor(p => p.pais)
|
||||
|
||||
Reference in New Issue
Block a user