| <div class="row px-3 h-100"> | <div class="row px-3 h-100"> | ||||
| <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> | |||||
| <h2>@I18n["MyData"]</h2> | |||||
| </div> | |||||
| <div class="row no-gutters align-items-start w-100"> | <div class="row no-gutters align-items-start w-100"> | ||||
| <div class="row no-gutters align-items-center w-100" style="padding-top:2em"> | |||||
| <div class="row no-gutters align-items-center w-100"> | |||||
| <div class="col-12"> | <div class="col-12"> | ||||
| <MatSelect Class="w-100 required" Label="@I18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem" Required="true" | |||||
| @onkeydown="InputCursorHandler.OnKeyDownHandlerAsync"> | |||||
| <MatSelect Class="w-100 required" Label="@I18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem" Required="true" | |||||
| @onkeydown="InputCursorHandler.OnKeyDownHandlerAsync"> | |||||
| <MatOptionString Value="M">@I18n["Male"]</MatOptionString> | <MatOptionString Value="M">@I18n["Male"]</MatOptionString> | ||||
| <MatOptionString Value="F">@I18n["Female"]</MatOptionString> | <MatOptionString Value="F">@I18n["Female"]</MatOptionString> | ||||
| </MatSelect> | </MatSelect> | ||||
| <div class="row no-gutters w-100"> | <div class="row no-gutters w-100"> | ||||
| <div class="col-6" style="padding-right:0.5em"> | <div class="col-6" style="padding-right:0.5em"> | ||||
| <MatStringField Class="w-100" Label="@I18n["Firstname"]" Outlined="true" type="text" @bind-Value="@Account.Firstname" Required="true" | <MatStringField Class="w-100" Label="@I18n["Firstname"]" Outlined="true" type="text" @bind-Value="@Account.Firstname" Required="true" | ||||
| OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField> | |||||
| OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField> | |||||
| </div> | </div> | ||||
| <div class="col-6" style="padding-left:0.5em"> | <div class="col-6" style="padding-left:0.5em"> | ||||
| <MatStringField Class="w-100" Label="@I18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname" Required="true" | <MatStringField Class="w-100" Label="@I18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname" Required="true" | ||||
| 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-12"> | <div class="col-12"> | ||||
| <MatStringField Class="w-100" Label="@I18n["Address"]" Outlined="true" type="text" @bind-Value="@Account.Address" | <MatStringField Class="w-100" Label="@I18n["Address"]" Outlined="true" type="text" @bind-Value="@Account.Address" | ||||
| 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"> | <div class="col-4" style="padding-right:0.5em"> | ||||
| <MatStringField Class="w-100" Label="@I18n["Zip"]" Outlined="true" type="text" @bind-Value="@Account.Zip" | <MatStringField Class="w-100" Label="@I18n["Zip"]" Outlined="true" type="text" @bind-Value="@Account.Zip" | ||||
| OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField> | |||||
| OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField> | |||||
| </div> | </div> | ||||
| <div class="col-8" style="padding-left:0.5em"> | <div class="col-8" style="padding-left:0.5em"> | ||||
| <MatStringField Class="w-100" Label="@I18n["City"]" Outlined="true" type="text" @bind-Value="@Account.City" | <MatStringField Class="w-100" Label="@I18n["City"]" Outlined="true" type="text" @bind-Value="@Account.City" | ||||
| 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-12"> | <div class="col-12"> | ||||
| <MatStringField Class="w-100" Label="@I18n["Phone"]" Outlined="true" type="text" @bind-Value="@Account.Phone" Required="true" | <MatStringField Class="w-100" Label="@I18n["Phone"]" Outlined="true" type="text" @bind-Value="@Account.Phone" 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["Mobile"]" Outlined="true" type="text" @bind-Value="@Account.Mobile" | |||||
| 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-12"> | <div class="col-12"> | ||||
| <MatStringField Class="w-100" Label="@I18n["Mail"]" Outlined="true" type="text" @bind-Value="@Account.Email" | <MatStringField Class="w-100" Label="@I18n["Mail"]" Outlined="true" type="text" @bind-Value="@Account.Email" | ||||
| OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField> | |||||
| OnKeyDown="@InputCursorHandler.OnKeyDownHandlerAsync"></MatStringField> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> |
| 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 Mobil { get; set; } | |||||
| public string Mobile { get; set; } | |||||
| public string Telefon { get; set; } | public string Telefon { get; set; } | ||||
| public string Email { 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 |
| namespace cwebplusApp.Shared.Models { | |||||
| public class ZipCity { | |||||
| public string Zip { get; set; } | |||||
| public string City { get; set; } | |||||
| public string Zip_City { get; set; } | |||||
| public ZipCity() { | |||||
| } | |||||
| public ZipCity(string zipCity) { | |||||
| Zip_City = zipCity; | |||||
| Zip = zipCity.Split(' ')[0]; | |||||
| City = zipCity.Replace(Zip + " ", ""); | |||||
| } | |||||
| } | |||||
| } |
| private string zip; | private string zip; | ||||
| private string city; | private string city; | ||||
| private string phone; | private string phone; | ||||
| private string mobile; | |||||
| private string email; | private string email; | ||||
| public string Salutation { get => salutation; set { salutation = value; } } | public string Salutation { get => salutation; set { salutation = value; } } | ||||
| public string Zip { get => zip; set { zip = value; } } | public string Zip { get => zip; set { zip = value; } } | ||||
| public string City { get => city; set { city = value; } } | public string City { get => city; set { city = value; } } | ||||
| public string Phone { get => phone; set { phone = value; } } | public string Phone { get => phone; set { phone = value; } } | ||||
| public string Mobile { get => mobile; set { mobile = value; } } | |||||
| public string Email { get => email; set { email = value; } } | public string Email { get => email; set { email = value; } } | ||||
| } | } | ||||
| } | } |
| <data name="Mobile" xml:space="preserve"> | <data name="Mobile" xml:space="preserve"> | ||||
| <value>Mobile</value> | <value>Mobile</value> | ||||
| </data> | </data> | ||||
| <data name="MyData" xml:space="preserve"> | |||||
| <value>Meine Angaben</value> | |||||
| </data> | |||||
| <data name="No" xml:space="preserve"> | <data name="No" xml:space="preserve"> | ||||
| <value>Nein</value> | <value>Nein</value> | ||||
| </data> | </data> |
| <data name="Mobile" xml:space="preserve"> | <data name="Mobile" xml:space="preserve"> | ||||
| <value>Mobile</value> | <value>Mobile</value> | ||||
| </data> | </data> | ||||
| <data name="MyData" xml:space="preserve"> | |||||
| <value>Mes données</value> | |||||
| </data> | |||||
| <data name="No" xml:space="preserve"> | <data name="No" xml:space="preserve"> | ||||
| <value>Non</value> | <value>Non</value> | ||||
| </data> | </data> |
| <data name="Mobile" xml:space="preserve"> | <data name="Mobile" xml:space="preserve"> | ||||
| <value>Cellulare</value> | <value>Cellulare</value> | ||||
| </data> | </data> | ||||
| <data name="MyData" xml:space="preserve"> | |||||
| <value>I miei dati</value> | |||||
| </data> | |||||
| <data name="No" xml:space="preserve"> | <data name="No" xml:space="preserve"> | ||||
| <value>No</value> | <value>No</value> | ||||
| </data> | </data> |
| <data name="Mobile" xml:space="preserve"> | <data name="Mobile" xml:space="preserve"> | ||||
| <value>Mobile</value> | <value>Mobile</value> | ||||
| </data> | </data> | ||||
| <data name="MyData" xml:space="preserve"> | |||||
| <value>My Data</value> | |||||
| </data> | |||||
| <data name="No" xml:space="preserve"> | <data name="No" xml:space="preserve"> | ||||
| <value>No</value> | <value>No</value> | ||||
| </data> | </data> |
| throw new HttpRequestException("HTTP client not initialized!"); | throw new HttpRequestException("HTTP client not initialized!"); | ||||
| } | } | ||||
| public async Task<List<ZipCity>> GetZipCities() { | |||||
| if (httpClient != null) { | |||||
| string subResourceUrl = configuration.GetValue<string>("subresource_url_zipcities"); | |||||
| if (!String.IsNullOrEmpty(subResourceUrl)) { | |||||
| HttpResponseMessage httpResult = await httpClient.GetAsync(string.Format(subResourceUrl, VERSION, CultureInfo.CurrentCulture.TwoLetterISOLanguageName)); | |||||
| if (httpResult.StatusCode == System.Net.HttpStatusCode.OK) { | |||||
| string[] zipCitiesStr = JsonConvert.DeserializeObject<string[]>(await httpResult.Content.ReadAsStringAsync()); | |||||
| List<ZipCity> zipCities = new (); | |||||
| for (int i = 0; i < zipCitiesStr.Length; i++) { | |||||
| zipCities.Add(new ZipCity(zipCitiesStr[i])); | |||||
| } | |||||
| return zipCities; | |||||
| } | |||||
| throw new HttpRequestException("HTTP error " + httpResult.StatusCode); | |||||
| } | |||||
| } | |||||
| throw new HttpRequestException("HTTP client not initialized!"); | |||||
| } | |||||
| public async Task<ReportResponse> SendFoundReport(Report report) { | public async Task<ReportResponse> SendFoundReport(Report report) { | ||||
| string subResourceUrl = configuration.GetValue<string>("subresource_url_foundreport"); | string subResourceUrl = configuration.GetValue<string>("subresource_url_foundreport"); | ||||
| return await SendReport(report, subResourceUrl, new FoundReportRepositoryItem((FoundReport)report, 0)); | return await SendReport(report, subResourceUrl, new FoundReportRepositoryItem((FoundReport)report, 0)); |
| Task<List<SearchService>> GetSearchServices(); | Task<List<SearchService>> GetSearchServices(); | ||||
| Task<List<ZipCity>> GetZipCities(); | |||||
| Task<ReportResponse> SendFoundReport(Report report); | Task<ReportResponse> SendFoundReport(Report report); | ||||
| Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem); | Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem); |
| private const string KeyNameBcTypes = "bicycleTypes"; | private const string KeyNameBcTypes = "bicycleTypes"; | ||||
| private const string KeyNameBrands = "brands"; | private const string KeyNameBrands = "brands"; | ||||
| private const string KeyNameSearchservices = "searchServices"; | private const string KeyNameSearchservices = "searchServices"; | ||||
| private const string KeyNameZipCities = "zipCities"; | |||||
| private bool initializedColors; | private bool initializedColors; | ||||
| private bool initializedBcTypes; | private bool initializedBcTypes; | ||||
| private BicycleType[] bicycleTypes; | private BicycleType[] bicycleTypes; | ||||
| private Brand[] brands; | private Brand[] brands; | ||||
| private SearchService[] searchServices; | private SearchService[] searchServices; | ||||
| private ZipCity[] zipCities; | |||||
| public ColorItem[] Colors { | public ColorItem[] Colors { | ||||
| get => this.colors; | get => this.colors; | ||||
| await SynchronizeBcTypes(); | await SynchronizeBcTypes(); | ||||
| await SynchronizeBrands(); | await SynchronizeBrands(); | ||||
| await SynchronizeSearchServices(); | await SynchronizeSearchServices(); | ||||
| await SynchronizeZipCities(); | |||||
| } else { | } else { | ||||
| throw new Exception("No internet connection available!"); | throw new Exception("No internet connection available!"); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| public async Task SynchronizeZipCities() { | |||||
| ZipCity[] _zipCities = (await bicycleRestService.GetZipCities()).ToArray(); | |||||
| if (_zipCities != null && _zipCities.Length > 0) { | |||||
| this.zipCities = _zipCities; | |||||
| await SaveZipCitiesToStorage(this.zipCities); | |||||
| } | |||||
| } | |||||
| public async Task<ColorItem[]> GetColors() { | public async Task<ColorItem[]> GetColors() { | ||||
| ColorItem[] _colors = await GetColorsFromStorage(); | ColorItem[] _colors = await GetColorsFromStorage(); | ||||
| if (_colors != null && _colors.Length > 0) { | if (_colors != null && _colors.Length > 0) { | ||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameSearchservices, json); | await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameSearchservices, json); | ||||
| } | } | ||||
| private async Task SaveZipCitiesToStorage(ZipCity[] zipCities) { | |||||
| var json = JsonConvert.SerializeObject(zipCities); | |||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameZipCities, json); | |||||
| } | |||||
| private static List<ColorItem> SortColors(List<ColorItem> colors) { | private static List<ColorItem> SortColors(List<ColorItem> colors) { | ||||
| colors.Sort(delegate (ColorItem c1, ColorItem c2) { return c1.Id == 0 ? -1 : c2.Id == 0 ? 1 : c1.Bezeichnung.CompareTo(c2.Bezeichnung); }); | colors.Sort(delegate (ColorItem c1, ColorItem c2) { return c1.Id == 0 ? -1 : c2.Id == 0 ? 1 : c1.Bezeichnung.CompareTo(c2.Bezeichnung); }); | ||||
| return colors; | return colors; |
| 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; | |||||
| } | } | ||||
| 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; | |||||
| } | } | ||||
| 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.Mobil = userData.Phone; | |||||
| report.Mobile = userData.Phone; | |||||
| report.Mail = userData.Email; | report.Mail = userData.Email; | ||||
| } | } | ||||
| "subresource_url_colors": "api/{0}/{1}/fundvelo/colors", | "subresource_url_colors": "api/{0}/{1}/fundvelo/colors", | ||||
| "subresource_url_brands": "api/{0}/{1}/fundvelo/brands", | "subresource_url_brands": "api/{0}/{1}/fundvelo/brands", | ||||
| "subresource_url_types": "api/{0}/{1}/fundvelo/types", | "subresource_url_types": "api/{0}/{1}/fundvelo/types", | ||||
| "subresource_url_zipcities": "api/{0}/{1}/fundvelo/zipcities", | |||||
| "subresource_url_searchservices": "api/{0}/{1}/fundvelo/searchservices", | "subresource_url_searchservices": "api/{0}/{1}/fundvelo/searchservices", | ||||
| "subresource_url_foundreport": "api/{0}/{1}/fundvelo/fundmeldung", | "subresource_url_foundreport": "api/{0}/{1}/fundvelo/fundmeldung", | ||||
| "subresource_url_missingreport": "api/{0}/{1}/fundvelo/suchauftrag" | "subresource_url_missingreport": "api/{0}/{1}/fundvelo/suchauftrag" |
| width: 100%; | width: 100%; | ||||
| justify-content: center; | justify-content: center; | ||||
| padding: 0 40px; | padding: 0 40px; | ||||
| position: absolute; | |||||
| z-index: -1; | |||||
| } | } | ||||
| #snackbarDiv.show { | #snackbarDiv.show { | ||||
| position: absolute; | |||||
| z-index: 1; | |||||
| } | } | ||||
| #snackbar { | #snackbar { | ||||
| text-align: center; | text-align: center; | ||||
| border-radius: 10px; | border-radius: 10px; | ||||
| padding: 16px; | padding: 16px; | ||||
| z-index: 1; | |||||
| z-index: -1; | |||||
| } | } | ||||
| #snackbar.show { | #snackbar.show { | ||||
| visibility: visible; | visibility: visible; | ||||
| -webkit-animation: fadein 1s; | -webkit-animation: fadein 1s; | ||||
| animation: fadein 1s; | animation: fadein 1s; | ||||
| z-index: 1; | |||||
| } | } | ||||
| @-webkit-keyframes fadein { | @-webkit-keyframes fadein { |