| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- @page "/fundvelo/alternate_pickup"
-
- @using cwebplusApp.Shared.Models;
- @using cwebplusApp.Shared.Services;
-
- @inject NavigationManager NavigationManager
- @inject UserDataProvider UserDataProvider
- @inject IStringLocalizer<Resources> I18n
- @inject PageHistoryManager PageHistoryManager
- @inject ReportDataProvider ReportDataProvider
- @inject Toaster Toaster
- @inject InputCursorHandler InputCursorHandler
- @inject MasterDataService MasterDataService
-
-
- <div class="row px-3 h-100">
- @*<div class="row no-gutters align-items-start justify-content-center w-100">
- <MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@I18n["PickupContact"]</MatHeadline4>
- </div>*@
-
- <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em">
- <h2>@I18n["PickupContact"]</h2>
- </div>
-
- <div class="row no-gutters align-items-start w-100">
- <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">
- <MatOptionString Value="M">@I18n["Male"]</MatOptionString>
- <MatOptionString Value="F">@I18n["Female"]</MatOptionString>
- </MatSelect>
- </div>
- </div>
- <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" maxlength="50"></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" maxlength="50"></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" maxlength="50"></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-12">
- <MatStringField Class="w-100" Label="@I18n["Mobile"]" Outlined="true" type="text" @bind-Value="pucMobile"
- OnKeyDown="@InputCursorHandler.OnConstrainedFieldKeyDownHandlerAsync" maxlength="20" pattern="^([0-9]*)$"></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.OnConstrainedFieldKeyDownHandlerAsync" maxlength="20" pattern="^([0-9]*)$"></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="email" @bind-Value="pucEmail" Required="true"
- OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync" maxlength="50"></MatStringField>
- </div>
- </div>
- </div>
-
- <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em">
- <div class="col" style="padding-right:0.5em">
- <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
- </div>
- <div class="col" style="padding-left:0.5em">
- <MatButton Class="w-100" Raised="true" @onclick="Next">@I18n["Continue"]</MatButton>
- </div>
- </div>
- </div>
-
-
- @code {
-
- private string pucSalutation;
- private string pucFirstname;
- private string pucLastname;
- private string pucAddress;
- 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);
- refreshGUIFromDto();
- StateHasChanged();
- }
-
- private void OnBeforeNavigateBack() {
- updateDtoFromGUI();
- }
-
- private void Next() {
- updateDtoFromGUI();
- PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
- try {
- Validator.ValidateAlternatePickContact(ReportDataProvider.GetFoundReport());
- NavigationManager.NavigateTo("fundvelo/account/Found");
- } catch (ArgumentException) {
- Toaster.ShowWarning(I18n.GetString("Warning.MandatoryFields.Title"), I18n.GetString("Warning.MandatoryFields.Msg"));
- }
- }
-
- private void Cancel() {
- NavigationManager.NavigateTo("caritas_services");
- }
-
- private string getZipCityLbl() {
- return String.Format("{0} {1}", I18n.GetString("Zip"), I18n.GetString("City"));
- }
-
- private void refreshGUIFromDto() {
- FoundReport report = ReportDataProvider.GetFoundReport();
- pucSalutation = report.AbholAnrede;
- pucFirstname = report.AbholVorname;
- pucLastname = report.AbholNachname;
- pucAddress = report.AbholStrasse;
- 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;
- }
-
- private void updateDtoFromGUI() {
- FoundReport report = ReportDataProvider.GetFoundReport();
- report.AbholAnrede = pucSalutation;
- report.AbholVorname = pucFirstname;
- report.AbholNachname = pucLastname;
- report.AbholStrasse = pucAddress;
- 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: "");
- }
- }
-
-
|