|
|
|
|
|
|
|
|
@inject ReportDataProvider ReportDataProvider
|
|
|
@inject ReportDataProvider ReportDataProvider
|
|
|
@inject Toaster Toaster
|
|
|
@inject Toaster Toaster
|
|
|
@inject InputCursorHandler InputCursorHandler
|
|
|
@inject InputCursorHandler InputCursorHandler
|
|
|
|
|
|
@inject MasterDataService MasterDataService
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row px-3 h-100">
|
|
|
<div class="row px-3 h-100">
|
|
|
|
|
|
|
|
|
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
|
|
|
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="row no-gutters align-items-center w-100">
|
|
|
<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="@Account.Zip"
|
|
|
|
|
|
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="@Account.City"
|
|
|
|
|
|
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
|
|
|
|
|
|
|
|
|
<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>
|
|
|
</div>
|
|
|
<div class="row no-gutters align-items-center w-100">
|
|
|
<div class="row no-gutters align-items-center w-100">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UserData Account = new();
|
|
|
private UserData Account = new();
|
|
|
|
|
|
|
|
|
|
|
|
private string zipCityStringValue;
|
|
|
|
|
|
private ZipCity selectedZipCity;
|
|
|
|
|
|
private ZipCity SelectedZipCity {
|
|
|
|
|
|
get { return selectedZipCity; }
|
|
|
|
|
|
set { selectedZipCity = (value != null) ? value : new ZipCity(zipCityStringValue); }
|
|
|
|
|
|
}
|
|
|
|
|
|
private void setZipCityValue(string value) {
|
|
|
|
|
|
zipCityStringValue = value;
|
|
|
|
|
|
selectedZipCity = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ZipCity[] ZipCities {
|
|
|
|
|
|
get => MasterDataService.ZipCities;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
protected async override void OnInitialized() {
|
|
|
protected async override void OnInitialized() {
|
|
|
base.OnInitialized();
|
|
|
base.OnInitialized();
|
|
|
PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack);
|
|
|
PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack);
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(FromRoute) && ReportDataProvider.Report != null) {
|
|
|
if (!string.IsNullOrEmpty(FromRoute) && ReportDataProvider.Report != null) {
|
|
|
UserDataProvider.MapUserData(Account, ReportDataProvider.Report);
|
|
|
UserDataProvider.MapUserData(Account, ReportDataProvider.Report);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
setZipCityValue(Account.Zip + " " + Account.City);
|
|
|
|
|
|
SelectedZipCity = Array.Find(ZipCities, zipCity => (zipCity.Zip.Equals(Account.Zip) && zipCity.City.Equals(Account.City)));
|
|
|
StateHasChanged();
|
|
|
StateHasChanged();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task SaveUserData() {
|
|
|
private async Task SaveUserData() {
|
|
|
try {
|
|
|
try {
|
|
|
|
|
|
Account.Zip = SelectedZipCity.Zip;
|
|
|
|
|
|
Account.City = SelectedZipCity.City;
|
|
|
Validator.ValidateAccount(Account);
|
|
|
Validator.ValidateAccount(Account);
|
|
|
await UserDataProvider.Save(Account);
|
|
|
await UserDataProvider.Save(Account);
|
|
|
Toaster.ShowSuccess(I18n.GetString("Success.SaveUserdata.Title"), I18n.GetString("Success.SaveUserdata.Msg"));
|
|
|
Toaster.ShowSuccess(I18n.GetString("Success.SaveUserdata.Title"), I18n.GetString("Success.SaveUserdata.Msg"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async void SaveUserDataAndClose() {
|
|
|
private async void SaveUserDataAndClose() {
|
|
|
try {
|
|
|
try {
|
|
|
|
|
|
Account.Zip = SelectedZipCity.Zip;
|
|
|
|
|
|
Account.City = SelectedZipCity.City;
|
|
|
Validator.ValidateAccount(Account);
|
|
|
Validator.ValidateAccount(Account);
|
|
|
await UserDataProvider.Save(Account);
|
|
|
await UserDataProvider.Save(Account);
|
|
|
Toaster.ShowSuccess(I18n.GetString("Success.SaveUserdata.Title"), I18n.GetString("Success.SaveUserdata.Msg"));
|
|
|
Toaster.ShowSuccess(I18n.GetString("Success.SaveUserdata.Title"), I18n.GetString("Success.SaveUserdata.Msg"));
|
|
|
|
|
|
|
|
|
return await UserDataProvider.Get();
|
|
|
return await UserDataProvider.Get();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string getZipCityLbl() {
|
|
|
|
|
|
return String.Format("{0} {1} ({2})", I18n.GetString("Zip"), I18n.GetString("City"), I18n.GetString("PlaceOfDiscovery"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
private void Next() {
|
|
|
private void Next() {
|
|
|
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
|
|
|
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
|
|
|
try {
|
|
|
try {
|