Sfoglia il codice sorgente

List of zip/cities as autocompelete combobox in alternate pickup page

master
Flo Smilari 4 anni fa
parent
commit
97a2b512b5

+ 0
- 1
Pages/AccountPage.razor Vedi File

@@ -44,7 +44,6 @@
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<div class="outlined">

+ 67
- 17
Pages/Fundvelo/CaritasServiceFundVeloAlternatePickupContactPage.razor Vedi File

@@ -9,7 +9,8 @@
@inject PageHistoryManager PageHistoryManager
@inject ReportDataProvider ReportDataProvider
@inject Toaster Toaster
@inject InputCursorHandler InputCursorHandler;
@inject InputCursorHandler InputCursorHandler
@inject MasterDataService MasterDataService
<div class="row px-3 h-100">
@@ -25,7 +26,7 @@
<div class="row no-gutters w-100">
<div class="col-12">
<MatSelect Class="w-100 required" Label="@I18n["Salutation"]" Outlined="true" @bind-Value="pucSalutation" Required="true" Style="margin-bottom: 0.5rem"
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
<MatOptionString Value="M">@I18n["Male"]</MatOptionString>
<MatOptionString Value="F">@I18n["Female"]</MatOptionString>
</MatSelect>
@@ -34,45 +35,65 @@
<div class="row no-gutters w-100">
<div class="col-6" style="padding-right:0.5em">
<MatStringField Class="w-100" Label="@I18n["Firstname"]" Outlined="true" type="text" @bind-Value="pucFirstname" Required="true"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
<div class="col-6" style="padding-left:0.5em">
<MatStringField Class="w-100" Label="@I18n["Lastname"]" Outlined="true" type="text" @bind-Value="pucLastname" Required="true"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@I18n["Address"]" Outlined="true" type="text" @bind-Value="pucAddress" Required="true"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<div class="outlined">
<MatAutocompleteList TItem="ZipCity" FullWidth="true" Label="@getZipCityLbl()" Required="true" Items="@ZipCities" OnTextChanged="setZipCityValue" @bind-Value="SelectedZipCity" CustomStringSelector="@(i => i?.Zip_City)"
ShowClearButton="true" NumberOfElementsInPopup="6" @onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
<ItemTemplate>
<div>
<span>@context?.Zip_City</span>
</div>
</ItemTemplate>
</MatAutocompleteList>
</div>
</div>
</div>
@*<div class="row no-gutters align-items-center w-100">
<div class="col-4" style="padding-right:0.5em">
<MatStringField Class="w-100" Label="@I18n["Zip"]" Outlined="true" type="text" @bind-Value="pucZip" Required="true"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
<div class="col-8" style="padding-left:0.5em">
<MatStringField Class="w-100" Label="@I18n["City"]" Outlined="true" type="text" @bind-Value="pucCity" Required="true"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
</div>*@
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@I18n["Mobile"]" Outlined="true" type="text" @bind-Value="pucMobile"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@I18n["Phone"]" Outlined="true" type="text" @bind-Value="pucPhone"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@I18n["Mail"]" Outlined="true" type="text" @bind-Value="pucEmail"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
</div>
</div>
@@ -94,12 +115,27 @@
private string pucFirstname;
private string pucLastname;
private string pucAddress;
private string pucZip;
private string pucCity;
//private string pucZip;
//private string pucCity;
private string pucMobile;
private string pucPhone;
private string pucEmail;
private string pucZipCityStringValue;
private ZipCity selectedZipCity;
private ZipCity SelectedZipCity {
get { return selectedZipCity; }
set { selectedZipCity = (value != null) ? value : new ZipCity(pucZipCityStringValue); }
}
private void setZipCityValue(string value) {
pucZipCityStringValue = value;
selectedZipCity = null;
}
private ZipCity[] ZipCities {
get => MasterDataService.ZipCities;
}
protected override void OnInitialized() {
base.OnInitialized();
PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack);
@@ -126,14 +162,22 @@
NavigationManager.NavigateTo("caritas_services");
}
private string getZipCityLbl() {
return String.Format("{0} {1} ({2})", I18n.GetString("Zip"), I18n.GetString("City"), I18n.GetString("PlaceOfDiscovery"));
}
private void refreshGUIFromDto() {
FoundReport report = ReportDataProvider.GetFoundReport();
pucSalutation = report.AbholAnrede;
pucFirstname = report.AbholVorname;
pucLastname = report.AbholNachname;
pucAddress = report.AbholStrasse;
pucZip = report.AbholPLZ;
pucCity = report.AbholOrt;
//pucZip = report.AbholPLZ;
//pucCity = report.AbholOrt;
setZipCityValue(getZipCityFromReport(report));
SelectedZipCity = Array.Find(ZipCities, zipCity => (zipCity.Zip.Equals(report.AbholPLZ) && zipCity.City.Equals(report.AbholOrt)));
pucMobile = report.AbholMobil;
pucPhone = report.AbholTelefon;
pucEmail = report.AbholMail;
@@ -145,12 +189,18 @@
report.AbholVorname = pucFirstname;
report.AbholNachname = pucLastname;
report.AbholStrasse = pucAddress;
report.AbholPLZ = pucZip;
report.AbholOrt = pucCity;
//report.AbholPLZ = pucZip;
//report.AbholOrt = pucCity;
report.AbholPLZ = SelectedZipCity.Zip;
report.AbholOrt = SelectedZipCity.City;
report.AbholMobil = pucMobile;
report.AbholTelefon = pucPhone;
report.AbholMail = pucEmail;
}
private String getZipCityFromReport(FoundReport report) {
return report.AbholPLZ + (!String.IsNullOrEmpty(report.AbholOrt)? " " + report.AbholOrt: "");
}
}

Loading…
Annulla
Salva