| @@ -15,7 +15,7 @@ | |||
| <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="col-12"> | |||
| <MatSelect Class="w-100" Label="@i18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem"> | |||
| <MatSelect Class="w-100" Label="@i18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem" Required="true"> | |||
| <MatOptionString Value="sir">@i18n["Man"]</MatOptionString> | |||
| <MatOptionString Value="madam">@i18n["Woman"]</MatOptionString> | |||
| </MatSelect> | |||
| @@ -23,28 +23,28 @@ | |||
| </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="@Account.Firstname"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Firstname"]" Outlined="true" type="text" @bind-Value="@Account.Firstname" Required="true"></MatStringField> | |||
| </div> | |||
| <div class="col-6" style="padding-left:0.5em"> | |||
| <MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname" Required="true"></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="@Account.Address"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Address"]" Outlined="true" type="text" @bind-Value="@Account.Address" Required="true"></MatStringField> | |||
| </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="@Account.Zip"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Zip"]" Outlined="true" type="text" @bind-Value="@Account.Zip" Required="true"></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"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["City"]" Outlined="true" type="text" @bind-Value="@Account.City" Required="true"></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="@Account.Phone"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Phone"]" Outlined="true" type="text" @bind-Value="@Account.Phone" Required="true"></MatStringField> | |||
| </div> | |||
| </div> | |||
| <div class="row no-gutters align-items-center w-100"> | |||
| @@ -76,29 +76,32 @@ | |||
| [Parameter] | |||
| public string FromRoute { get; set; } | |||
| private UserData Account = new(); | |||
| protected async override void OnInitialized() { | |||
| PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| Account = await GetUserData(); | |||
| UserDataProvider.mapUserData(Account, ReportDataProvider.Report); | |||
| base.OnInitialized(); | |||
| if (NavigationManager.Uri.EndsWith("/account")) { | |||
| await GetUserData(); | |||
| } | |||
| StateHasChanged(); | |||
| } | |||
| private async void SaveUserData() { | |||
| await UserDataProvider.Save(); | |||
| NavigationManager.NavigateTo("caritas_services"); | |||
| private void OnBeforeNavigateBack() { | |||
| UserDataProvider.mapReport(ReportDataProvider.Report, Account); | |||
| } | |||
| private async Task GetUserData() { | |||
| await UserDataProvider.Get(); | |||
| StateHasChanged(); | |||
| private async void SaveUserData() { | |||
| await UserDataProvider.Save(Account); | |||
| NavigationManager.NavigateTo("caritas_services"); | |||
| } | |||
| private UserData Account { | |||
| get => UserDataProvider.Data; | |||
| private async Task<UserData> GetUserData() { | |||
| return await UserDataProvider.Get(); | |||
| } | |||
| private void Next() { | |||
| UserDataProvider.mapReport(ReportDataProvider.Report, Account); | |||
| if ("Found".Equals(FromRoute)) { | |||
| NavigationManager.NavigateTo("fundvelo/conclusion_found"); | |||
| } else { | |||
| @@ -12,17 +12,17 @@ | |||
| <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>*@ | |||
| <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="row no-gutters w-100"> | |||
| <div class="col-12"> | |||
| <MatSelect Class="w-100" Label="@i18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem"> | |||
| <MatSelect Class="w-100" Label="@i18n["Salutation"]" Outlined="true" @bind-Value="pucSalutation" Required="true" Style="margin-bottom: 0.5rem"> | |||
| <MatOptionString Value="sir">@i18n["Man"]</MatOptionString> | |||
| <MatOptionString Value="madam">@i18n["Woman"]</MatOptionString> | |||
| </MatSelect> | |||
| @@ -30,38 +30,38 @@ | |||
| </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="@Account.Firstname"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Firstname"]" Outlined="true" type="text" @bind-Value="pucFirstname" Required="true"></MatStringField> | |||
| </div> | |||
| <div class="col-6" style="padding-left:0.5em"> | |||
| <MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="pucLastname" Required="true"></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="@Account.Address"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Address"]" Outlined="true" type="text" @bind-Value="pucAddress" Required="true"></MatStringField> | |||
| </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="@Account.Zip"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Zip"]" Outlined="true" type="text" @bind-Value="pucZip" Required="true"></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"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["City"]" Outlined="true" type="text" @bind-Value="pucCity" Required="true"></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.Phone"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Mobile"]" Outlined="true" type="text" @bind-Value="pucMobile"></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="@Account.Phone"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Phone"]" Outlined="true" type="text" @bind-Value="pucPhone"></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="@Account.Email"></MatStringField> | |||
| <MatStringField Class="w-100" Label="@i18n["Mail"]" Outlined="true" type="text" @bind-Value="pucEmail"></MatStringField> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -79,16 +79,25 @@ | |||
| @code { | |||
| private string pucSalutation; | |||
| private string pucFirstname; | |||
| private string pucLastname; | |||
| private string pucAddress; | |||
| private string pucZip; | |||
| private string pucCity; | |||
| private string pucMobile; | |||
| private string pucPhone; | |||
| private string pucEmail; | |||
| protected async override void OnInitialized() { | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| refreshGUIFromDto(); | |||
| base.OnInitialized(); | |||
| } | |||
| private UserData Account { | |||
| get => UserDataProvider.Data; | |||
| StateHasChanged(); | |||
| } | |||
| private void Next() { | |||
| updateDtoFromGUI(); | |||
| NavigationManager.NavigateTo("fundvelo/account/Found"); | |||
| } | |||
| @@ -96,6 +105,31 @@ | |||
| NavigationManager.NavigateTo("caritas_services"); | |||
| } | |||
| 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; | |||
| 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 = pucZip; | |||
| report.AbholOrt = pucCity; | |||
| report.AbholMobil = pucMobile; | |||
| report.AbholTelefon = pucPhone; | |||
| report.AbholMail = pucEmail; | |||
| } | |||
| } | |||
| @@ -5,6 +5,7 @@ | |||
| @inject NavigationManager NavigationManager | |||
| @inject IStringLocalizer<Resources> i18n | |||
| @inject PageHistoryManager PageHistoryManager | |||
| @inject ReportDataProvider ReportDataProvider | |||
| <div class="row px-3 h-100"> | |||
| <div class="row no-gutters align-items-start justify-content-center w-100"> | |||
| @@ -32,6 +33,9 @@ | |||
| protected override void OnInitialized() { | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| base.OnInitialized(); | |||
| } | |||
| @@ -59,7 +59,7 @@ | |||
| <div> | |||
| <MatCard Id="bikePic" Class="fv-mat-card"> | |||
| <MatCardContent> | |||
| <MatCardMedia Square="true" Class="" ImageUrl="@imgUrl"> | |||
| <MatCardMedia Square="true" ImageUrl="@imgUrl"> | |||
| @if (loading) { | |||
| <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Medium" /> | |||
| } | |||
| @@ -82,7 +82,7 @@ | |||
| </div> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-3"> | |||
| <div class="w-100 fv-osm-tile map-wrapper"> | |||
| <Map @ref="mapRef" MapOptions="@mapOptions"></Map> | |||
| <Map @ref="mapRef" MapOptions="@mapOptions" AfterRender="AfterRenderMap"></Map> | |||
| </div> | |||
| </div> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop"> | |||
| @@ -91,7 +91,7 @@ | |||
| <MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address"></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.City"></MatStringField> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["PlaceOfDiscovery"]" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.DisplayCity"></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"> | |||
| <MatTextField Class="w-100 form-check-label italic" Label="@i18n["Latitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Latitude"></MatTextField> | |||
| @@ -105,7 +105,7 @@ | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop"> | |||
| <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"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Color"]" Required="true" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||
| <ItemTemplate> | |||
| <div> | |||
| <span class="btn-sm" style="background-color:@context.Code; | |||
| @@ -119,7 +119,7 @@ | |||
| </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="outlined"> | |||
| <MatAutocompleteList TItem="Brand" FullWidth="true" Label="@i18n["Brand"]" 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)"> | |||
| <ItemTemplate> | |||
| <div> | |||
| <span>@context?.Bezeichnung</span> | |||
| @@ -129,7 +129,7 @@ | |||
| </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"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Type"]" Required="true" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||
| <ItemTemplate> | |||
| <div> | |||
| <span>@context?.Bezeichnung</span> | |||
| @@ -139,12 +139,12 @@ | |||
| </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-12-desktop"> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text"></MatStringField> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text" @bind-Value="frameNumber"></MatStringField> | |||
| </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-12-desktop"> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["Remark"]" Outlined="true" type="text"></MatStringField> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["Remark"]" Outlined="true" type="text" @bind-Value="remark"></MatStringField> | |||
| </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"> | |||
| @@ -186,17 +186,32 @@ | |||
| brandStringValue = value; | |||
| selectedBrand = null; | |||
| } | |||
| private string frameNumber; | |||
| private string remark; | |||
| private bool abholadresseIsNotContact; | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| await GetColors(); | |||
| await GetBicycleTypes(); | |||
| await GetBrands(); | |||
| refreshGUIFromDto(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| base.OnInitialized(); | |||
| StateHasChanged(); | |||
| } | |||
| private async void AfterRenderMap() { | |||
| FoundReport report = ReportDataProvider.GetFoundReport(); | |||
| if (report.GeographicInfo.Latitude != 0 && report.GeographicInfo.Longitude != 0) { | |||
| bicycleGeoPosition.DisplayCity = GetFormattedAddressZipAndTown(); | |||
| LatLng coordinates = new LatLng(report.GeographicInfo.Latitude, report.GeographicInfo.Longitude); | |||
| MouseEvent mouseEvent = new MouseEvent(); | |||
| mouseEvent.LatLng = coordinates; | |||
| await InitializeMapPosition(); | |||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | |||
| } | |||
| } | |||
| private Brand getBrand(Brand brand) { | |||
| return brand != null ? brand : new Brand(-999, "Test"); | |||
| } | |||
| @@ -226,6 +241,7 @@ | |||
| } | |||
| private void Next() { | |||
| updateDtoFromGUI(); | |||
| if (abholadresseIsNotContact) { | |||
| NavigationManager.NavigateTo("fundvelo/alternate_pickup"); | |||
| } else { | |||
| @@ -271,4 +287,41 @@ | |||
| } | |||
| } | |||
| private void refreshGUIFromDto() { | |||
| FoundReport report = ReportDataProvider.GetFoundReport(); | |||
| bicycleGeoPosition.Address = report.GeographicInfo.Address; | |||
| bicycleGeoPosition.Zip = report.GeographicInfo.Postcode; | |||
| bicycleGeoPosition.City = report.GeographicInfo.Town; | |||
| bicycleGeoPosition.Latitude = report.GeographicInfo.Latitude; | |||
| bicycleGeoPosition.Longitude = report.GeographicInfo.Longitude; | |||
| imgUrl = report.FotoString; | |||
| 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); | |||
| selectedBcType = Array.Find(BicycleTypes, bcType => bcType.Id == report.TypId); | |||
| frameNumber = report.RahmenNummer; | |||
| remark = report.Bemerkung; | |||
| abholadresseIsNotContact = !report.AbholadresseIstKontakt; | |||
| } | |||
| private void updateDtoFromGUI() { | |||
| FoundReport report = ReportDataProvider.GetFoundReport(); | |||
| report.GeographicInfo.Address = bicycleGeoPosition.Address; | |||
| report.GeographicInfo.Postcode = bicycleGeoPosition.Zip; | |||
| report.GeographicInfo.Town = bicycleGeoPosition.City; | |||
| report.GeographicInfo.Latitude = bicycleGeoPosition.Latitude; | |||
| report.GeographicInfo.Longitude = bicycleGeoPosition.Longitude; | |||
| report.FotoString = imgUrl; | |||
| report.FarbeId = selectedColor != null ? selectedColor.Id : 0; | |||
| report.TypId = selectedBcType != null ? selectedBcType.Id : 0; | |||
| if (SelectedBrand != null) { | |||
| if (SelectedBrand.Id == -999) { | |||
| report.NeueMarke = SelectedBrand.Bezeichnung; | |||
| } else { | |||
| report.MarkeId = SelectedBrand.Id; | |||
| } | |||
| } | |||
| report.RahmenNummer = frameNumber; | |||
| report.Bemerkung = remark; | |||
| report.AbholadresseIstKontakt = !abholadresseIsNotContact; | |||
| } | |||
| } | |||
| @@ -38,6 +38,9 @@ namespace cwebplusApp.Pages { | |||
| private NominatimService NominatimService { get; set; } | |||
| private static NominatimReverseAddress addressDto; | |||
| private static NominatimReverseAddress AddressDto { get => addressDto; set { addressDto = value; } } | |||
| public CaritasServiceFundVeloKeyDataPageBase() : base() { | |||
| this.center = new LatLng(46.80121, 8.22669); // Centered on Swiss | |||
| @@ -69,6 +72,17 @@ namespace cwebplusApp.Pages { | |||
| await ShowDeviceGeoLocation(); | |||
| } | |||
| protected static string GetFormattedAddressZipAndTown() { | |||
| return GetFormattedAddressZipAndTown(addressDto); | |||
| } | |||
| protected async Task AddBicycleMarkerOnClickPosition(MouseEvent mouseEvent) { | |||
| if (this.bicyclePositionMarker != null) { | |||
| await bicyclePositionMarker.Remove(); | |||
| } | |||
| this.bicyclePositionMarker = await this.MarkerFactory.CreateAndAddToMap(mouseEvent.LatLng, this.mapRef, this.bicycleMarkerOptions); | |||
| } | |||
| private async void CreateBicycleMarkerOptions() { | |||
| this.bicycleMarkerOptions = new MarkerOptions() { | |||
| IconRef = await this.IconFactory.Create(new IconOptions() { | |||
| @@ -98,17 +112,25 @@ namespace cwebplusApp.Pages { | |||
| await this.mapRef.SetView(geoPosition); | |||
| } | |||
| } | |||
| private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { | |||
| string country_code = addressDto.address.country_code; | |||
| string zip = addressDto.address.postcode.Split("-", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)[0]; | |||
| string town = addressDto.address.village ?? addressDto.address.town ?? addressDto.address.city; | |||
| return !String.IsNullOrEmpty(country_code) ? country_code.ToUpper() + "-" + zip + " " + town : zip + " " + town; | |||
| } | |||
| private async Task OnMouseMapClicked(MouseEvent mouseEvent) { | |||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | |||
| this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat; | |||
| this.bicycleGeoPosition.Longitude = mouseEvent.LatLng.Lng; | |||
| NominatimReverseAddress addressDto = await NominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng); | |||
| addressDto = await NominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng); | |||
| if (addressDto != null) { | |||
| this.bicycleGeoPosition.Address = GetFormattedAddressStreet(addressDto); | |||
| this.bicycleGeoPosition.City = GetFormattedAddressZipAndTown(addressDto); | |||
| this.bicycleGeoPosition.City = addressDto.address.village ?? addressDto.address.town ?? addressDto.address.city; | |||
| this.bicycleGeoPosition.Zip = addressDto.address.postcode; | |||
| this.bicycleGeoPosition.DisplayCity = GetFormattedAddressZipAndTown(addressDto); | |||
| } else { | |||
| Toaster.ShowWarning(I18n.GetString("Warning.Nominatim.Title"), I18n.GetString("Warning.Nominatim.Msg")); | |||
| } | |||
| @@ -116,13 +138,6 @@ namespace cwebplusApp.Pages { | |||
| StateHasChanged(); | |||
| } | |||
| private async Task AddBicycleMarkerOnClickPosition(MouseEvent mouseEvent) { | |||
| if (this.bicyclePositionMarker != null) { | |||
| await bicyclePositionMarker.Remove(); | |||
| } | |||
| this.bicyclePositionMarker = await this.MarkerFactory.CreateAndAddToMap(mouseEvent.LatLng, this.mapRef, this.bicycleMarkerOptions); | |||
| } | |||
| private static string GetFormattedAddressStreet(NominatimReverseAddress addressDto) { | |||
| string street = addressDto.address.road; | |||
| string houseNr = addressDto.address.house_number ?? ""; | |||
| @@ -130,12 +145,5 @@ namespace cwebplusApp.Pages { | |||
| return street + (!houseNr.Equals("") ? " " + houseNr : ""); | |||
| } | |||
| private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { | |||
| string country_code = addressDto.address.country_code; | |||
| string zip = addressDto.address.postcode.Split("-", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)[0]; | |||
| string town = addressDto.address.village ?? addressDto.address.town ?? addressDto.address.city; | |||
| return !String.IsNullOrEmpty(country_code) ? country_code.ToUpper() + "-" + zip + " " + town : zip + " " + town; | |||
| } | |||
| } | |||
| } | |||
| @@ -6,6 +6,7 @@ | |||
| @inject NavigationManager NavigationManager | |||
| @inject PageHistoryManager PageHistoryManager | |||
| @inject ReportDataProvider ReportDataProvider | |||
| @inject UserDataProvider UserDataProvider | |||
| <div class="row px-3 h-100"> | |||
| <div class="row no-gutters align-items-center w-100"> | |||
| @@ -47,13 +48,17 @@ | |||
| base.OnInitialized(); | |||
| } | |||
| private void Found() { | |||
| ReportDataProvider.Report = new FoundReport(); | |||
| private async void Found() { | |||
| Report report = new FoundReport(); | |||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||
| ReportDataProvider.Report = report; | |||
| NavigationManager.NavigateTo("fundvelo/keydata/Found"); | |||
| } | |||
| private void Missing() { | |||
| ReportDataProvider.Report = new MissingReport(); | |||
| private async void Missing() { | |||
| Report report = new MissingReport(); | |||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||
| ReportDataProvider.Report = report; | |||
| NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | |||
| } | |||
| } | |||
| @@ -70,7 +70,7 @@ | |||
| <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-inner"> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)" Required="true"> | |||
| <ItemTemplate> | |||
| <div> | |||
| <span class="btn-sm" style="background-color:@context.Code; | |||
| @@ -84,7 +84,7 @@ | |||
| </div> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop"> | |||
| <div class="outlined"> | |||
| <MatAutocompleteList TItem="Brand" FullWidth="true" Label="@i18n["Brand"]" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)"> | |||
| <MatAutocompleteList TItem="Brand" FullWidth="true" Label="@i18n["Brand"]" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)" Required="true"> | |||
| <ItemTemplate> | |||
| <div> | |||
| <span>@context?.Bezeichnung</span> | |||
| @@ -94,7 +94,7 @@ | |||
| </div> | |||
| </div> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@i18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)" Required="true"> | |||
| <ItemTemplate> | |||
| <div> | |||
| <span>@context?.Bezeichnung</span> | |||
| @@ -103,20 +103,20 @@ | |||
| </MatSelectValue> | |||
| </div> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop"> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text"></MatStringField> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text" @bind-Value="frameNumber"></MatStringField> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop"> | |||
| <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"> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["Age"]" Outlined="true" type="text"></MatStringField> | |||
| <MatNumericUpDownField Class="w-100" Label="@i18n["Age"]" Outlined="true" @bind-Value="@age"></MatNumericUpDownField> | |||
| </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["Price"]" Outlined="true" type="text"></MatStringField> | |||
| <MatTextField Class="w-100 form-check-label" Label="@i18n["Price"]" Format="0.00" Outlined="true" @bind-Value="@price"></MatTextField> | |||
| </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["Remark"]" Outlined="true" type="text"></MatStringField> | |||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["Remark"]" Outlined="true" type="text" @bind-Value="remark"></MatStringField> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -151,17 +151,24 @@ | |||
| get { return selectedBrand; } | |||
| set { selectedBrand = (value != null) ? value : new Brand(-999, brandStringValue); } | |||
| } | |||
| private string frameNumber; | |||
| private string remark; | |||
| private uint age; | |||
| private float price; | |||
| private void setBrandValue(string value) { | |||
| brandStringValue = value; | |||
| selectedBrand = null; | |||
| } | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| await GetColors(); | |||
| await GetBicycleTypes(); | |||
| await GetBrands(); | |||
| refreshGUIFromDto(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| base.OnInitialized(); | |||
| StateHasChanged(); | |||
| } | |||
| @@ -194,13 +201,14 @@ | |||
| } | |||
| private void Next() { | |||
| updateDtoFromGUI(); | |||
| NavigationManager.NavigateTo("fundvelo/account/Missing"); | |||
| } | |||
| private void Cancel() { | |||
| NavigationManager.NavigateTo("caritas_services"); | |||
| } | |||
| private async Task OnGatheringPicture(InputFileChangeEventArgs e) { | |||
| IBrowserFile imgFile = e.File; | |||
| var buffer = new byte[imgFile.Size]; | |||
| @@ -230,4 +238,34 @@ | |||
| } | |||
| } | |||
| private void refreshGUIFromDto() { | |||
| MissingReport report = ReportDataProvider.GetMissingReport(); | |||
| imgUrl = report.FotoString; | |||
| 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); | |||
| selectedBcType = Array.Find(BicycleTypes, bcType => bcType.Id == report.TypId); | |||
| frameNumber = report.RahmenNummer; | |||
| remark = report.Bemerkung; | |||
| age = report.Alter; | |||
| price = report.Preis; | |||
| } | |||
| private void updateDtoFromGUI() { | |||
| MissingReport report = ReportDataProvider.GetMissingReport(); | |||
| report.FotoString = imgUrl; | |||
| report.FarbeId = selectedColor != null ? selectedColor.Id : 0; | |||
| report.TypId = selectedBcType != null ? selectedBcType.Id : 0; | |||
| if (SelectedBrand != null) { | |||
| if (SelectedBrand.Id == -999) { | |||
| report.NeueMarke = SelectedBrand.Bezeichnung; | |||
| } else { | |||
| report.MarkeId = SelectedBrand.Id; | |||
| } | |||
| } | |||
| report.RahmenNummer = frameNumber; | |||
| report.Bemerkung = remark; | |||
| report.Alter = age; | |||
| report.Preis = price; | |||
| } | |||
| } | |||
| @@ -15,7 +15,7 @@ | |||
| public string AbholTelefon { get; set; } | |||
| public FoundReport() : this("", "", "", true, -1, -1, -1, null) { | |||
| public FoundReport() : this("", "", "", true, -1, -1, -1, new GeographicInfo()) { | |||
| } | |||
| public FoundReport(string anrede, string vorname, string nachname, bool abholadresseIstKontakt, int typId, int markeId, int farbeId, GeographicInfo geographicInfo) { | |||
| @@ -32,9 +32,9 @@ | |||
| public class GeographicInfo { | |||
| public string Postcode { get; set; } | |||
| public string Town { get; set; } | |||
| public string Address { get; set; } | |||
| public string Postcode { get; set; } // required | |||
| public string Town { get; set; } // required | |||
| public string Address { get; set; } // required | |||
| public double Latitude { get; set; } | |||
| public double Longitude { get; set; } | |||
| @@ -4,8 +4,8 @@ | |||
| public string PersonPLZ { get; set; } // required | |||
| public string PersonOrt { get; set; } // required | |||
| public string PersonStrasse { get; set; } // required | |||
| public int Alter { get; set; } | |||
| public double Preis { get; set; } | |||
| public uint Alter { get; set; } | |||
| public float Preis { get; set; } | |||
| public string NeueMarke { get; set; } | |||
| public string Zusatz { get; set; } | |||
| public string Postfach { get; set; } | |||
| @@ -6,12 +6,16 @@ | |||
| public double Longitude { get; set; } | |||
| public string Address { get; set; } | |||
| public string City { get; set; } | |||
| public string Zip { get; set; } | |||
| public string DisplayCity { get; set; } | |||
| public BicycleGeoPosition() { | |||
| Latitude = 0.0; | |||
| Longitude = 0.0; | |||
| Address = ""; | |||
| Zip = ""; | |||
| City = ""; | |||
| DisplayCity = ""; | |||
| } | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ | |||
| public string RahmenNummer { get; set; } | |||
| public string Bemerkung { get; set; } | |||
| public string Foto { get; set; } | |||
| public string FotoString { get; set; } | |||
| } | |||
| } | |||
| @@ -111,7 +111,7 @@ | |||
| } | |||
| private void ButtonBackClicked() { | |||
| NavigationManager.NavigateTo(PageHistoryManager.GetPreviousPage()); | |||
| PageHistoryManager.NavigateBack(); | |||
| } | |||
| @@ -1,13 +1,20 @@ | |||
| using System.Collections.Generic; | |||
| using Microsoft.AspNetCore.Components; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Threading.Tasks; | |||
| namespace cwebplusApp.Shared.Services { | |||
| public class PageHistoryManager { | |||
| public EventCallback OnBeforeNavigateBack; | |||
| private readonly List<string> previousPages; | |||
| public PageHistoryManager() { | |||
| private NavigationManager NavigationManager; | |||
| public PageHistoryManager(NavigationManager NavigationManager) { | |||
| previousPages = new List<string>(); | |||
| this.NavigationManager = NavigationManager; | |||
| } | |||
| public void Reset() { | |||
| @@ -34,5 +41,14 @@ namespace cwebplusApp.Shared.Services { | |||
| public bool CanGoBack() { | |||
| return previousPages.Count > 1; | |||
| } | |||
| public async void NavigateBack() { | |||
| await FireOnBeforeNavigateBackEvent(); | |||
| NavigationManager.NavigateTo(GetPreviousPage()); | |||
| } | |||
| protected async Task FireOnBeforeNavigateBackEvent() { | |||
| await OnBeforeNavigateBack.InvokeAsync(); | |||
| } | |||
| } | |||
| } | |||
| @@ -13,7 +13,7 @@ namespace cwebplusApp.Shared.Services { | |||
| return null; | |||
| } | |||
| public MissingReport GetLostReport() { | |||
| public MissingReport GetMissingReport() { | |||
| if (Report is MissingReport) { | |||
| return (MissingReport)Report; | |||
| } | |||
| @@ -9,12 +9,6 @@ namespace cwebplusApp.Shared.Services { | |||
| private readonly IJSRuntime _jsRuntime; | |||
| private bool _initialized; | |||
| private UserData _data = new(); | |||
| public UserData Data { | |||
| get => _data; | |||
| set => _data = value; | |||
| } | |||
| public event EventHandler Changed; | |||
| @@ -43,12 +37,10 @@ namespace cwebplusApp.Shared.Services { | |||
| } else { | |||
| result = new UserData(); | |||
| } | |||
| _data = result; | |||
| return result; | |||
| } | |||
| public async Task Save() { | |||
| public async Task Save(UserData _data) { | |||
| var json = System.Text.Json.JsonSerializer.Serialize(_data); | |||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyName, json); | |||
| } | |||
| @@ -58,18 +50,22 @@ namespace cwebplusApp.Shared.Services { | |||
| public void OnStorageUpdated(string key) { | |||
| if (key == KeyName) { | |||
| // Reset the settings. The next call to Get will reload the data | |||
| _data = null; | |||
| Changed?.Invoke(this, EventArgs.Empty); | |||
| } | |||
| } | |||
| public static UserData map(Report report) { | |||
| UserData userData = new(); | |||
| public static void mapUserData(UserData userData, Report report) { | |||
| userData.Salutation = report.Anrede; | |||
| userData.Firstname = report.Vorname; | |||
| userData.Lastname = report.Nachname; ; | |||
| userData.Phone = report.Telefon; | |||
| } | |||
| return userData; | |||
| public static void mapReport(Report report, UserData userData) { | |||
| report.Anrede = userData.Salutation; | |||
| report.Vorname = userData.Firstname; | |||
| report.Nachname = userData.Lastname; | |||
| report.Telefon = userData.Phone; | |||
| } | |||
| } | |||
| } | |||
| @@ -16,12 +16,12 @@ | |||
| <ItemGroup> | |||
| <PackageReference Include="BlazorAnimate" Version="3.0.0" /> | |||
| <PackageReference Include="BlazorGeolocation" Version="0.1.1" /> | |||
| <PackageReference Include="FisSst.BlazorMaps" Version="1.0.1" /> | |||
| <PackageReference Include="FisSst.BlazorMaps" Version="1.0.2" /> | |||
| <PackageReference Include="Json.Net" Version="1.0.33" /> | |||
| <PackageReference Include="MatBlazor" Version="2.9.0-develop-042" /> | |||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" /> | |||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" /> | |||
| <PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.7" /> | |||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.8" /> | |||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.8" PrivateAssets="all" /> | |||
| <PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.8" /> | |||
| <PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" /> | |||
| <PackageReference Include="System.Net.Http.Json" Version="5.0.0" /> | |||
| </ItemGroup> | |||
| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <configuration> | |||
| <packageSources> | |||
| <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | |||
| <add key="CustomNugets.BlazorMaps" value=".\nugets\FisSst.BlazorMaps" /> | |||
| </packageSources> | |||
| </configuration> | |||
| @@ -0,0 +1,21 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> | |||
| <metadata> | |||
| <id>FisSst.BlazorMaps</id> | |||
| <version>1.0.2</version> | |||
| <authors>FIS-SST</authors> | |||
| <requireLicenseAcceptance>true</requireLicenseAcceptance> | |||
| <license type="file">LICENSE.txt</license> | |||
| <licenseUrl>https://aka.ms/deprecateLicenseUrl</licenseUrl> | |||
| <icon>fis-sst_logo.png</icon> | |||
| <description>BlazorMaps is a Blazor library created by software house FIS-SST (https://fis-sst.pl/en/) that provides a C# interface for maps provided by Leaflet.js library. It includes several Leaflet.js features which are easily accessible from C# level within a project and it does not require any use of JavaScript.</description> | |||
| <tags>maps blazor leaflet.js map wrapper</tags> | |||
| <repository url="https://github.com/fis-sst/BlazorMaps" /> | |||
| <dependencies> | |||
| <group targetFramework="net5.0"> | |||
| <dependency id="Microsoft.AspNetCore.Components" version="5.0.0" exclude="Build,Analyzers" /> | |||
| <dependency id="Microsoft.AspNetCore.Components.Web" version="5.0.0" exclude="Build,Analyzers" /> | |||
| </group> | |||
| </dependencies> | |||
| </metadata> | |||
| </package> | |||
| @@ -0,0 +1,21 @@ | |||
| MIT License | |||
| Copyright (c) [year] [fullname] | |||
| Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| of this software and associated documentation files (the "Software"), to deal | |||
| in the Software without restriction, including without limitation the rights | |||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| copies of the Software, and to permit persons to whom the Software is | |||
| furnished to do so, subject to the following conditions: | |||
| The above copyright notice and this permission notice shall be included in all | |||
| copies or substantial portions of the Software. | |||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
| SOFTWARE. | |||