Просмотр исходного кода

Zips & Cities from server

master
Flo Smilari 4 лет назад
Родитель
Сommit
d04ab42742

+ 70
- 17
Pages/Fundvelo/CaritasServiceFundVeloFoundKeyDataPage.razor Просмотреть файл

<div class="mat-layout-grid-inner"> <div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" Type="text" @bind-Value="@bicycleGeoPosition.Address" <MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" Type="text" @bind-Value="@bicycleGeoPosition.Address"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@I18n["PlaceOfDiscovery"]" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.DisplayCity"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div> </div>
@if (OnlineStatusProvider.Online) {
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@getZipCityLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.DisplayCity"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div>
} else {
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<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 class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatTextField Class="w-100 form-check-label italic" Label="@I18n["Latitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Latitude" <MatTextField Class="w-100 form-check-label italic" Label="@I18n["Latitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Latitude"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatTextField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatTextField>
</div> </div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatTextField Class="w-100 form-check-label italic" Label="@I18n["Longitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Longitude" <MatTextField Class="w-100 form-check-label italic" Label="@I18n["Longitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Longitude"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatTextField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatTextField>
</div> </div>
</div> </div>
</div> </div>
<div class="mat-layout-grid-inner"> <div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)" <MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
<ItemTemplate> <ItemTemplate>
<div> <div>
<span class="btn-sm" style="background-color:@context.Code; <span class="btn-sm" style="background-color:@context.Code;
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="outlined"> <div class="outlined">
<MatAutocompleteList TItem="Brand" FullWidth="true" Label="@I18n["Brand"]" Required="true" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)" <MatAutocompleteList TItem="Brand" FullWidth="true" Label="@I18n["Brand"]" Required="true" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)"
ShowClearButton="true" NumberOfElementsInPopup="6" @onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
ShowClearButton="true" NumberOfElementsInPopup="6" @onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
<ItemTemplate> <ItemTemplate>
<div> <div>
<span>@context?.Bezeichnung</span> <span>@context?.Bezeichnung</span>
</div> </div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)" <MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync">
<ItemTemplate> <ItemTemplate>
<div> <div>
<span>@context?.Bezeichnung</span> <span>@context?.Bezeichnung</span>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@I18n["FrameNumber"]" Outlined="true" type="text" @bind-Value="frameNumber" <MatStringField Class="w-100 form-check-label" Label="@I18n["FrameNumber"]" Outlined="true" type="text" @bind-Value="frameNumber"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div> </div>
</div> </div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@I18n["Remark"]" Outlined="true" type="text" @bind-Value="remark" <MatStringField Class="w-100 form-check-label" Label="@I18n["Remark"]" Outlined="true" type="text" @bind-Value="remark"
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField>
</div> </div>
</div> </div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop"> <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div> <div>
<MatCheckbox @bind-Value="@abholadresseIsNotContact" Label="@I18n["AlternatePickupContact"]" <MatCheckbox @bind-Value="@abholadresseIsNotContact" Label="@I18n["AlternatePickupContact"]"
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync"></MatCheckbox>
@onkeydown="InputCursorHandler.OnKeyDownHandlerAsync"></MatCheckbox>
</div> </div>
</div> </div>
</div> </div>
brandStringValue = value; brandStringValue = value;
selectedBrand = null; selectedBrand = null;
} }
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 string frameNumber; private string frameNumber;
private string remark; private string remark;
private bool abholadresseIsNotContact; private bool abholadresseIsNotContact;
await GetColors(); await GetColors();
await GetBicycleTypes(); await GetBicycleTypes();
await GetBrands(); await GetBrands();
await GetZipCities();
refreshGUIFromDto(); refreshGUIFromDto();
OnlineStatusProvider.AddOnlineStatusChangeCallBack(OnOnlineStatusChanged); OnlineStatusProvider.AddOnlineStatusChangeCallBack(OnOnlineStatusChanged);
StateHasChanged(); StateHasChanged();
await MasterDataService.GetBrands(); await MasterDataService.GetBrands();
} }
private async Task GetZipCities() {
await MasterDataService.GetZipCities();
}
private ColorItem[] Colors { private ColorItem[] Colors {
get => MasterDataService.Colors; get => MasterDataService.Colors;
} }
get => MasterDataService.Brands; get => MasterDataService.Brands;
} }
private ZipCity[] ZipCities {
get => MasterDataService.ZipCities;
}
private void Next() { private void Next() {
updateDtoFromGUI(); updateDtoFromGUI();
PageHistoryManager.AddPageToHistory(NavigationManager.Uri); PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
private string getAddressLbl() { private string getAddressLbl() {
return I18n.GetString("Address") + " (" + I18n.GetString("PlaceOfDiscovery") + ")";
return I18n.GetString("Street") + " (" + I18n.GetString("PlaceOfDiscovery") + ")";
}
private string getZipCityLbl() {
return String.Format("{0} {1} ({2})", I18n.GetString("Zip"), I18n.GetString("City"), I18n.GetString("PlaceOfDiscovery"));
} }
private async Task OnGatheringPicture(InputFileChangeEventArgs e) { private async Task OnGatheringPicture(InputFileChangeEventArgs e) {
bicycleGeoPosition.City = report.GeographicInfo.Town; bicycleGeoPosition.City = report.GeographicInfo.Town;
bicycleGeoPosition.Latitude = report.GeographicInfo.Latitude; bicycleGeoPosition.Latitude = report.GeographicInfo.Latitude;
bicycleGeoPosition.Longitude = report.GeographicInfo.Longitude; bicycleGeoPosition.Longitude = report.GeographicInfo.Longitude;
bicycleGeoPosition.DisplayCity = await GetFormattedAddressZipAndTown(ReportDataProvider);
if (OnlineStatusProvider.Online) {
bicycleGeoPosition.DisplayCity = await GetFormattedAddressZipAndTown(ReportDataProvider);
} else {
setZipCityValue(report.GeographicInfo.Postcode + " " + report.GeographicInfo.Town);
SelectedZipCity = new ZipCity(zipCityStringValue);
}
imgUrl = report.FotoString; imgUrl = report.FotoString;
selectedColor = Array.Find(Colors, color => color.Id == report.FarbeId); selectedColor = Array.Find(Colors, color => color.Id == report.FarbeId);
selectedBrand = String.IsNullOrEmpty(report.NeueMarke) ? Array.Find(Brands, brand => brand.Id == report.MarkeId) : new Brand(-999, report.NeueMarke); selectedBrand = String.IsNullOrEmpty(report.NeueMarke) ? Array.Find(Brands, brand => brand.Id == report.MarkeId) : new Brand(-999, report.NeueMarke);
private void updateDtoFromGUI() { private void updateDtoFromGUI() {
FoundReport report = ReportDataProvider.GetFoundReport(); FoundReport report = ReportDataProvider.GetFoundReport();
report.GeographicInfo.Address = bicycleGeoPosition.Address; report.GeographicInfo.Address = bicycleGeoPosition.Address;
report.GeographicInfo.Postcode = bicycleGeoPosition.Zip;
report.GeographicInfo.Town = bicycleGeoPosition.City;
if (OnlineStatusProvider.Online) {
report.GeographicInfo.Postcode = bicycleGeoPosition.Zip;
report.GeographicInfo.Town = bicycleGeoPosition.City;
} else {
report.GeographicInfo.Postcode = SelectedZipCity.Zip;
report.GeographicInfo.Town = SelectedZipCity.City;
}
report.GeographicInfo.Latitude = bicycleGeoPosition.Latitude; report.GeographicInfo.Latitude = bicycleGeoPosition.Latitude;
report.GeographicInfo.Longitude = bicycleGeoPosition.Longitude; report.GeographicInfo.Longitude = bicycleGeoPosition.Longitude;
report.FotoString = imgUrl; report.FotoString = imgUrl;

+ 10
- 10
Pages/Fundvelo/CaritasServiceFundVeloFoundKeyDataPage.razor.cs Просмотреть файл

!String.IsNullOrEmpty(this.bicycleGeoPosition.Zip) && !String.IsNullOrEmpty(this.bicycleGeoPosition.Zip) &&
!String.IsNullOrEmpty(this.bicycleGeoPosition.City)) { !String.IsNullOrEmpty(this.bicycleGeoPosition.City)) {
LatLng geoPosition = await NominatimService.GetCoordinatesForAddress(bicycleGeoPosition.Address + ", " + bicycleGeoPosition.Zip + " " + bicycleGeoPosition.City); LatLng geoPosition = await NominatimService.GetCoordinatesForAddress(bicycleGeoPosition.Address + ", " + bicycleGeoPosition.Zip + " " + bicycleGeoPosition.City);
this.bicycleGeoPosition.Latitude = geoPosition.Lat;
this.bicycleGeoPosition.Longitude = geoPosition.Lng;
await this.mapRef.SetZoom(16);
await this.mapRef.SetView(geoPosition);
MouseEvent mouseEvent = new MouseEvent();
mouseEvent.LatLng = geoPosition;
await AddBicycleMarkerOnClickPosition(mouseEvent);
if (geoPosition != null) {
this.bicycleGeoPosition.Latitude = geoPosition.Lat;
this.bicycleGeoPosition.Longitude = geoPosition.Lng;
await this.mapRef.SetZoom(16);
await this.mapRef.SetView(geoPosition);
MouseEvent mouseEvent = new MouseEvent();
mouseEvent.LatLng = geoPosition;
await AddBicycleMarkerOnClickPosition(mouseEvent);
}
} }
} }
private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) {
string country_code = addressDto.address.country_code;
string zip = SplitAndGetFirstPostcode(addressDto.address.postcode); string zip = SplitAndGetFirstPostcode(addressDto.address.postcode);
string town = addressDto.address.city ?? addressDto.address.town ?? addressDto.address.village; string town = addressDto.address.city ?? addressDto.address.town ?? addressDto.address.village;
return (!String.IsNullOrEmpty(country_code) ? country_code.ToUpper() + "-" + zip + " " + town : zip + " " + town).TrimEnd();
return (zip + " " + town).TrimEnd();
} }
private static string SplitAndGetFirstPostcode(string postcode) { private static string SplitAndGetFirstPostcode(string postcode) {

+ 1
- 1
Properties/launchSettings.json Просмотреть файл

"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"nativeDebugging": false,
"nativeDebugging": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000", "applicationUrl": "https://localhost:5001;http://localhost:5000",
"jsWebView2Debugging": false, "jsWebView2Debugging": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"

+ 2
- 2
Shared/Models/Fundvelo/Report.cs Просмотреть файл

public string Anrede { get; set; } // required public string Anrede { get; set; } // required
public string Vorname { get; set; } // required public string Vorname { get; set; } // required
public string Nachname { get; set; } // required public string Nachname { get; set; } // required
public string Mobile { get; set; }
public string Mobil { get; set; }
public string Telefon { get; set; } public string Telefon { get; set; }
public string Email { get; set; }
public string Mail { get; set; }
public int? TypId { get; set; } // required public int? TypId { get; set; } // required
public int? MarkeId { get; set; } // required public int? MarkeId { get; set; } // required
public int? FarbeId { get; set; } // required public int? FarbeId { get; set; } // required

+ 3
- 0
Shared/ResourceFiles/Resources.de.resx Просмотреть файл

<data name="Specifications" xml:space="preserve"> <data name="Specifications" xml:space="preserve">
<value>Angaben</value> <value>Angaben</value>
</data> </data>
<data name="Street" xml:space="preserve">
<value>Strasse</value>
</data>
<data name="Success.DeleteReport.Msg" xml:space="preserve"> <data name="Success.DeleteReport.Msg" xml:space="preserve">
<value>Die Meldung mit der ID {0:d} wurde erfolgreich gelöscht!</value> <value>Die Meldung mit der ID {0:d} wurde erfolgreich gelöscht!</value>
</data> </data>

+ 3
- 0
Shared/ResourceFiles/Resources.fr.resx Просмотреть файл

<data name="Specifications" xml:space="preserve"> <data name="Specifications" xml:space="preserve">
<value>Description détaillée</value> <value>Description détaillée</value>
</data> </data>
<data name="Street" xml:space="preserve">
<value>Rue</value>
</data>
<data name="Success.DeleteReport.Msg" xml:space="preserve"> <data name="Success.DeleteReport.Msg" xml:space="preserve">
<value>Le rapport avec l'ID {0:d} a été supprimé avec succès!</value> <value>Le rapport avec l'ID {0:d} a été supprimé avec succès!</value>
</data> </data>

+ 3
- 0
Shared/ResourceFiles/Resources.it.resx Просмотреть файл

<data name="Specifications" xml:space="preserve"> <data name="Specifications" xml:space="preserve">
<value>Descrizione dettagliata</value> <value>Descrizione dettagliata</value>
</data> </data>
<data name="Street" xml:space="preserve">
<value>Via</value>
</data>
<data name="Success.DeleteReport.Msg" xml:space="preserve"> <data name="Success.DeleteReport.Msg" xml:space="preserve">
<value>Il rapporto con l'ID {0:d} è stato cancellato con successo!</value> <value>Il rapporto con l'ID {0:d} è stato cancellato con successo!</value>
</data> </data>

+ 3
- 0
Shared/ResourceFiles/Resources.resx Просмотреть файл

<data name="Specifications" xml:space="preserve"> <data name="Specifications" xml:space="preserve">
<value>Specifications</value> <value>Specifications</value>
</data> </data>
<data name="Street" xml:space="preserve">
<value>Street</value>
</data>
<data name="Success.DeleteReport.Msg" xml:space="preserve"> <data name="Success.DeleteReport.Msg" xml:space="preserve">
<value>The Report with ID {0:d} was successfully deleted!</value> <value>The Report with ID {0:d} was successfully deleted!</value>
</data> </data>

+ 1
- 1
Shared/Services/Fundvelo/BicycleRestService.cs Просмотреть файл

if (httpResult.StatusCode == System.Net.HttpStatusCode.OK) { if (httpResult.StatusCode == System.Net.HttpStatusCode.OK) {
string[] zipCitiesStr = JsonConvert.DeserializeObject<string[]>(await httpResult.Content.ReadAsStringAsync()); string[] zipCitiesStr = JsonConvert.DeserializeObject<string[]>(await httpResult.Content.ReadAsStringAsync());
List<ZipCity> zipCities = new ();
List<ZipCity> zipCities = new();
for (int i = 0; i < zipCitiesStr.Length; i++) { for (int i = 0; i < zipCitiesStr.Length; i++) {
zipCities.Add(new ZipCity(zipCitiesStr[i])); zipCities.Add(new ZipCity(zipCitiesStr[i]));
} }

+ 41
- 0
Shared/Services/Fundvelo/MasterDataService.cs Просмотреть файл

private bool initializedBcTypes; private bool initializedBcTypes;
private bool initializedBrands; private bool initializedBrands;
private bool initializedSearchServices; private bool initializedSearchServices;
private bool initializedZipCities;
private ColorItem[] colors; private ColorItem[] colors;
private BicycleType[] bicycleTypes; private BicycleType[] bicycleTypes;
private Brand[] brands; private Brand[] brands;
get => this.brands; get => this.brands;
} }
public ZipCity[] ZipCities {
get => this.zipCities;
}
public SearchService[] SearchServices { public SearchService[] SearchServices {
get => this.searchServices; get => this.searchServices;
} }
return SearchServices; return SearchServices;
} }
public async Task<ZipCity[]> GetZipCities() {
ZipCity[] _zipCities = await GetZipCitiesFromStorage();
if (_zipCities != null && _zipCities.Length > 0) {
this.zipCities = _zipCities;
}
this.zipCities = SortZipCities(new List<ZipCity>(this.zipCities)).ToArray();
return ZipCities;
}
// This method is called from BlazorRegisterStorageEvent when the storage changed // This method is called from BlazorRegisterStorageEvent when the storage changed
[JSInvokable] [JSInvokable]
public void OnStorageUpdated(string key) { public void OnStorageUpdated(string key) {
return result; return result;
} }
private async ValueTask<ZipCity[]> GetZipCitiesFromStorage() {
// Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed.
// This way, you can reload the settings when another instance of the application (tab / window) save the settings
if (!this.initializedZipCities) {
// Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated"
var reference = DotNetObjectReference.Create(this);
await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
this.initializedZipCities = true;
}
// Read the JSON string that contains the data from the local storage
ZipCity[] result;
var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameZipCities);
if (String.IsNullOrEmpty(str)) {
result = Array.Empty<ZipCity>();
} else {
result = JsonConvert.DeserializeObject<ZipCity[]>(str) ?? Array.Empty<ZipCity>();
}
return result;
}
private async Task SaveColorsToStorage(ColorItem[] colors) { private async Task SaveColorsToStorage(ColorItem[] colors) {
var json = JsonConvert.SerializeObject(colors); var json = JsonConvert.SerializeObject(colors);
searchServices.Sort(delegate (SearchService ss1, SearchService ss2) { return ss1.Id == 0 ? -1 : ss2.Id == 0 ? 1 : ss1.Bezeichnung.CompareTo(ss2.Bezeichnung); }); searchServices.Sort(delegate (SearchService ss1, SearchService ss2) { return ss1.Id == 0 ? -1 : ss2.Id == 0 ? 1 : ss1.Bezeichnung.CompareTo(ss2.Bezeichnung); });
return searchServices; return searchServices;
} }
private static List<ZipCity> SortZipCities(List<ZipCity> zipCities) {
int v = int.Parse("22");
zipCities.Sort(delegate (ZipCity zc1, ZipCity zc2) { return int.Parse(zc1.Zip).CompareTo(int.Parse(zc2.Zip)); });
return zipCities;
}
} }
} }

+ 1
- 3
Shared/Services/PermissionsProvider.cs Просмотреть файл

using Microsoft.JSInterop; using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace cwebplusApp.Shared.Services { namespace cwebplusApp.Shared.Services {
} }
private async Task<bool> GeoLocationAllowed() { private async Task<bool> GeoLocationAllowed() {
string result = "";
string result = "";
var dotNetObjRef = DotNetObjectReference.Create(this); var dotNetObjRef = DotNetObjectReference.Create(this);
result = await JSRuntime.InvokeAsync<string>("IsGeoLocationAllowed", dotNetObjRef); result = await JSRuntime.InvokeAsync<string>("IsGeoLocationAllowed", dotNetObjRef);
this.IsGeoLocationAllowed = result.Equals("granted") || result.Equals("prompt"); this.IsGeoLocationAllowed = result.Equals("granted") || result.Equals("prompt");

+ 5
- 5
Shared/Services/UserDataProvider.cs Просмотреть файл

userData.Firstname = report.Vorname; userData.Firstname = report.Vorname;
userData.Lastname = report.Nachname; userData.Lastname = report.Nachname;
userData.Phone = report.Telefon; userData.Phone = report.Telefon;
userData.Mobile = report.Mobile;
userData.Email = report.Email;
userData.Mobile = report.Mobil;
userData.Email = report.Mail;
} }
public static void MapReport(Report report, UserData userData) { public static void MapReport(Report report, UserData userData) {
report.Vorname = userData.Firstname; report.Vorname = userData.Firstname;
report.Nachname = userData.Lastname; report.Nachname = userData.Lastname;
report.Telefon = userData.Phone; report.Telefon = userData.Phone;
report.Mobile = userData.Mobile;
report.Email = userData.Email;
report.Mobil = userData.Mobile;
report.Mail = userData.Email;
} }
public static void MapReport(Report report, char Salutation, string Firstname, string Lastname, string Phone) { public static void MapReport(Report report, char Salutation, string Firstname, string Lastname, string Phone) {
report.PersonOrt = userData.City; report.PersonOrt = userData.City;
report.PersonPLZ = userData.Zip; report.PersonPLZ = userData.Zip;
report.PersonStrasse = userData.Address; report.PersonStrasse = userData.Address;
report.Mobile = userData.Phone;
report.Mobil = userData.Phone;
report.Mail = userData.Email; report.Mail = userData.Email;
} }

+ 2
- 1
wwwroot/css/app.css Просмотреть файл

} }
div.outlined .mdc-text-field.mdc-text-field--fullwidth .mdc-floating-label.mdc-floating-label--float-above { div.outlined .mdc-text-field.mdc-text-field--fullwidth .mdc-floating-label.mdc-floating-label--float-above {
transform: translateY(-172%) translateX(-8%) scale(0.75);
transform: translateY(-172%) translateX(-2%) scale(0.75);
background-color: white; background-color: white;
z-index: 2; z-index: 2;
min-width: 60px; min-width: 60px;
text-align: center; text-align: center;
padding: 0px 8px;
} }
.mat-autocomplete-list-popup { .mat-autocomplete-list-popup {

Загрузка…
Отмена
Сохранить