| <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" style="padding-top:2em"> | ||||
| <div class="col-12"> | <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="sir">@i18n["Man"]</MatOptionString> | ||||
| <MatOptionString Value="madam">@i18n["Woman"]</MatOptionString> | <MatOptionString Value="madam">@i18n["Woman"]</MatOptionString> | ||||
| </MatSelect> | </MatSelect> | ||||
| </div> | </div> | ||||
| <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"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@i18n["Firstname"]" Outlined="true" type="text" @bind-Value="@Account.Firstname" Required="true"></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"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname" Required="true"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["Address"]" Outlined="true" type="text" @bind-Value="@Account.Address" Required="true"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["Zip"]" Outlined="true" type="text" @bind-Value="@Account.Zip" Required="true"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["City"]" Outlined="true" type="text" @bind-Value="@Account.City" Required="true"></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"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@i18n["Phone"]" Outlined="true" type="text" @bind-Value="@Account.Phone" Required="true"></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"> | ||||
| [Parameter] | [Parameter] | ||||
| public string FromRoute { get; set; } | public string FromRoute { get; set; } | ||||
| private UserData Account = new(); | |||||
| protected async override void OnInitialized() { | protected async override void OnInitialized() { | ||||
| PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack); | |||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| Account = await GetUserData(); | |||||
| UserDataProvider.mapUserData(Account, ReportDataProvider.Report); | |||||
| base.OnInitialized(); | 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() { | private void Next() { | ||||
| UserDataProvider.mapReport(ReportDataProvider.Report, Account); | |||||
| if ("Found".Equals(FromRoute)) { | if ("Found".Equals(FromRoute)) { | ||||
| NavigationManager.NavigateTo("fundvelo/conclusion_found"); | NavigationManager.NavigateTo("fundvelo/conclusion_found"); | ||||
| } else { | } else { |
| <div class="row px-3 h-100"> | <div class="row px-3 h-100"> | ||||
| @*<div class="row no-gutters align-items-start justify-content-center w-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"> | <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> | ||||
| <h2>@i18n["PickupContact"]</h2> | <h2>@i18n["PickupContact"]</h2> | ||||
| </div> | </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 w-100" > | |||||
| <div class="row no-gutters w-100"> | |||||
| <div class="col-12"> | <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="sir">@i18n["Man"]</MatOptionString> | ||||
| <MatOptionString Value="madam">@i18n["Woman"]</MatOptionString> | <MatOptionString Value="madam">@i18n["Woman"]</MatOptionString> | ||||
| </MatSelect> | </MatSelect> | ||||
| </div> | </div> | ||||
| <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"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@i18n["Firstname"]" Outlined="true" type="text" @bind-Value="pucFirstname" Required="true"></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"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="pucLastname" Required="true"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["Address"]" Outlined="true" type="text" @bind-Value="pucAddress" Required="true"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["Zip"]" Outlined="true" type="text" @bind-Value="pucZip" Required="true"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["City"]" Outlined="true" type="text" @bind-Value="pucCity" Required="true"></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["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> | </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"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@i18n["Phone"]" Outlined="true" type="text" @bind-Value="pucPhone"></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> | |||||
| <MatStringField Class="w-100" Label="@i18n["Mail"]" Outlined="true" type="text" @bind-Value="pucEmail"></MatStringField> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @code { | @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() { | protected async override void OnInitialized() { | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| refreshGUIFromDto(); | |||||
| base.OnInitialized(); | base.OnInitialized(); | ||||
| } | |||||
| private UserData Account { | |||||
| get => UserDataProvider.Data; | |||||
| StateHasChanged(); | |||||
| } | } | ||||
| private void Next() { | private void Next() { | ||||
| updateDtoFromGUI(); | |||||
| NavigationManager.NavigateTo("fundvelo/account/Found"); | NavigationManager.NavigateTo("fundvelo/account/Found"); | ||||
| } | } | ||||
| NavigationManager.NavigateTo("caritas_services"); | 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; | |||||
| } | |||||
| } | } | ||||
| @inject NavigationManager NavigationManager | @inject NavigationManager NavigationManager | ||||
| @inject IStringLocalizer<Resources> i18n | @inject IStringLocalizer<Resources> i18n | ||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | |||||
| <div class="row px-3 h-100"> | <div class="row px-3 h-100"> | ||||
| <div class="row no-gutters align-items-start justify-content-center w-100"> | <div class="row no-gutters align-items-start justify-content-center w-100"> | ||||
| protected override void OnInitialized() { | protected override void OnInitialized() { | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| base.OnInitialized(); | base.OnInitialized(); | ||||
| } | } | ||||
| <div> | <div> | ||||
| <MatCard Id="bikePic" Class="fv-mat-card"> | <MatCard Id="bikePic" Class="fv-mat-card"> | ||||
| <MatCardContent> | <MatCardContent> | ||||
| <MatCardMedia Square="true" Class="" ImageUrl="@imgUrl"> | |||||
| <MatCardMedia Square="true" ImageUrl="@imgUrl"> | |||||
| @if (loading) { | @if (loading) { | ||||
| <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Medium" /> | <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Medium" /> | ||||
| } | } | ||||
| </div> | </div> | ||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-3"> | <div class="mat-layout-grid-cell mat-layout-grid-cell-span-3"> | ||||
| <div class="w-100 fv-osm-tile map-wrapper"> | <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> | </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-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop"> | ||||
| <MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address"></MatStringField> | <MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address"></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-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["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> | ||||
| <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> | <MatTextField Class="w-100 form-check-label italic" Label="@i18n["Latitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Latitude"></MatTextField> | ||||
| <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-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-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 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> | <ItemTemplate> | ||||
| <div> | <div> | ||||
| <span class="btn-sm" style="background-color:@context.Code; | <span class="btn-sm" style="background-color:@context.Code; | ||||
| </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="outlined"> | <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> | <ItemTemplate> | ||||
| <div> | <div> | ||||
| <span>@context?.Bezeichnung</span> | <span>@context?.Bezeichnung</span> | ||||
| </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"> | ||||
| <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> | <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"> | ||||
| <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"></MatStringField> | |||||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text" @bind-Value="frameNumber"></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"></MatStringField> | |||||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["Remark"]" Outlined="true" type="text" @bind-Value="remark"></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"> | ||||
| brandStringValue = value; | brandStringValue = value; | ||||
| selectedBrand = null; | selectedBrand = null; | ||||
| } | } | ||||
| private string frameNumber; | |||||
| private string remark; | |||||
| private bool abholadresseIsNotContact; | private bool abholadresseIsNotContact; | ||||
| protected async override void OnInitialized() { | protected async override void OnInitialized() { | ||||
| base.OnInitialized(); | |||||
| await GetColors(); | await GetColors(); | ||||
| await GetBicycleTypes(); | await GetBicycleTypes(); | ||||
| await GetBrands(); | await GetBrands(); | ||||
| refreshGUIFromDto(); | |||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| base.OnInitialized(); | |||||
| StateHasChanged(); | 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) { | private Brand getBrand(Brand brand) { | ||||
| return brand != null ? brand : new Brand(-999, "Test"); | return brand != null ? brand : new Brand(-999, "Test"); | ||||
| } | } | ||||
| } | } | ||||
| private void Next() { | private void Next() { | ||||
| updateDtoFromGUI(); | |||||
| if (abholadresseIsNotContact) { | if (abholadresseIsNotContact) { | ||||
| NavigationManager.NavigateTo("fundvelo/alternate_pickup"); | NavigationManager.NavigateTo("fundvelo/alternate_pickup"); | ||||
| } else { | } else { | ||||
| } | } | ||||
| } | } | ||||
| 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; | |||||
| } | |||||
| } | } |
| private NominatimService NominatimService { get; set; } | private NominatimService NominatimService { get; set; } | ||||
| private static NominatimReverseAddress addressDto; | |||||
| private static NominatimReverseAddress AddressDto { get => addressDto; set { addressDto = value; } } | |||||
| public CaritasServiceFundVeloKeyDataPageBase() : base() { | public CaritasServiceFundVeloKeyDataPageBase() : base() { | ||||
| this.center = new LatLng(46.80121, 8.22669); // Centered on Swiss | this.center = new LatLng(46.80121, 8.22669); // Centered on Swiss | ||||
| await ShowDeviceGeoLocation(); | 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() { | private async void CreateBicycleMarkerOptions() { | ||||
| this.bicycleMarkerOptions = new MarkerOptions() { | this.bicycleMarkerOptions = new MarkerOptions() { | ||||
| IconRef = await this.IconFactory.Create(new IconOptions() { | IconRef = await this.IconFactory.Create(new IconOptions() { | ||||
| await this.mapRef.SetView(geoPosition); | 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) { | private async Task OnMouseMapClicked(MouseEvent mouseEvent) { | ||||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | await AddBicycleMarkerOnClickPosition(mouseEvent); | ||||
| this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat; | this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat; | ||||
| this.bicycleGeoPosition.Longitude = mouseEvent.LatLng.Lng; | 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) { | if (addressDto != null) { | ||||
| this.bicycleGeoPosition.Address = GetFormattedAddressStreet(addressDto); | 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 { | } else { | ||||
| Toaster.ShowWarning(I18n.GetString("Warning.Nominatim.Title"), I18n.GetString("Warning.Nominatim.Msg")); | Toaster.ShowWarning(I18n.GetString("Warning.Nominatim.Title"), I18n.GetString("Warning.Nominatim.Msg")); | ||||
| } | } | ||||
| StateHasChanged(); | 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) { | private static string GetFormattedAddressStreet(NominatimReverseAddress addressDto) { | ||||
| string street = addressDto.address.road; | string street = addressDto.address.road; | ||||
| string houseNr = addressDto.address.house_number ?? ""; | string houseNr = addressDto.address.house_number ?? ""; | ||||
| return street + (!houseNr.Equals("") ? " " + houseNr : ""); | 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; | |||||
| } | |||||
| } | } | ||||
| } | } |
| @inject NavigationManager NavigationManager | @inject NavigationManager NavigationManager | ||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | @inject ReportDataProvider ReportDataProvider | ||||
| @inject UserDataProvider UserDataProvider | |||||
| <div class="row px-3 h-100"> | <div class="row px-3 h-100"> | ||||
| <div class="row no-gutters align-items-center w-100"> | <div class="row no-gutters align-items-center w-100"> | ||||
| base.OnInitialized(); | 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"); | 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"); | NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | ||||
| } | } | ||||
| } | } |
| <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-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-8-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-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> | <ItemTemplate> | ||||
| <div> | <div> | ||||
| <span class="btn-sm" style="background-color:@context.Code; | <span class="btn-sm" style="background-color:@context.Code; | ||||
| </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"> | <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"> | <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> | <ItemTemplate> | ||||
| <div> | <div> | ||||
| <span>@context?.Bezeichnung</span> | <span>@context?.Bezeichnung</span> | ||||
| </div> | </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-12-desktop"> | <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> | <ItemTemplate> | ||||
| <div> | <div> | ||||
| <span>@context?.Bezeichnung</span> | <span>@context?.Bezeichnung</span> | ||||
| </MatSelectValue> | </MatSelectValue> | ||||
| </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"> | <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> | ||||
| </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-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-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="@i18n["Age"]" Outlined="true" type="text"></MatStringField> | |||||
| <MatNumericUpDownField Class="w-100" Label="@i18n["Age"]" Outlined="true" @bind-Value="@age"></MatNumericUpDownField> | |||||
| </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"> | ||||
| <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> | ||||
| <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"></MatStringField> | |||||
| <MatStringField Class="w-100 form-check-label" Label="@i18n["Remark"]" Outlined="true" type="text" @bind-Value="remark"></MatStringField> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| get { return selectedBrand; } | get { return selectedBrand; } | ||||
| set { selectedBrand = (value != null) ? value : new Brand(-999, brandStringValue); } | 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) { | private void setBrandValue(string value) { | ||||
| brandStringValue = value; | brandStringValue = value; | ||||
| selectedBrand = null; | selectedBrand = null; | ||||
| } | } | ||||
| protected async override void OnInitialized() { | protected async override void OnInitialized() { | ||||
| base.OnInitialized(); | |||||
| await GetColors(); | await GetColors(); | ||||
| await GetBicycleTypes(); | await GetBicycleTypes(); | ||||
| await GetBrands(); | await GetBrands(); | ||||
| refreshGUIFromDto(); | |||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| base.OnInitialized(); | |||||
| StateHasChanged(); | StateHasChanged(); | ||||
| } | } | ||||
| } | } | ||||
| private void Next() { | private void Next() { | ||||
| updateDtoFromGUI(); | |||||
| NavigationManager.NavigateTo("fundvelo/account/Missing"); | NavigationManager.NavigateTo("fundvelo/account/Missing"); | ||||
| } | } | ||||
| private void Cancel() { | private void Cancel() { | ||||
| NavigationManager.NavigateTo("caritas_services"); | NavigationManager.NavigateTo("caritas_services"); | ||||
| } | } | ||||
| private async Task OnGatheringPicture(InputFileChangeEventArgs e) { | private async Task OnGatheringPicture(InputFileChangeEventArgs e) { | ||||
| IBrowserFile imgFile = e.File; | IBrowserFile imgFile = e.File; | ||||
| var buffer = new byte[imgFile.Size]; | var buffer = new byte[imgFile.Size]; | ||||
| } | } | ||||
| } | } | ||||
| 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; | |||||
| } | |||||
| } | } |
| public string AbholTelefon { get; set; } | 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) { | public FoundReport(string anrede, string vorname, string nachname, bool abholadresseIstKontakt, int typId, int markeId, int farbeId, GeographicInfo geographicInfo) { | ||||
| public class GeographicInfo { | 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 Latitude { get; set; } | ||||
| public double Longitude { get; set; } | public double Longitude { get; set; } | ||||
| public string PersonPLZ { get; set; } // required | public string PersonPLZ { get; set; } // required | ||||
| public string PersonOrt { get; set; } // required | public string PersonOrt { get; set; } // required | ||||
| public string PersonStrasse { 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 NeueMarke { get; set; } | ||||
| public string Zusatz { get; set; } | public string Zusatz { get; set; } | ||||
| public string Postfach { get; set; } | public string Postfach { get; set; } |
| public double Longitude { get; set; } | public double Longitude { get; set; } | ||||
| public string Address { get; set; } | public string Address { get; set; } | ||||
| public string City { get; set; } | public string City { get; set; } | ||||
| public string Zip { get; set; } | |||||
| public string DisplayCity { get; set; } | |||||
| public BicycleGeoPosition() { | public BicycleGeoPosition() { | ||||
| Latitude = 0.0; | Latitude = 0.0; | ||||
| Longitude = 0.0; | Longitude = 0.0; | ||||
| Address = ""; | Address = ""; | ||||
| Zip = ""; | |||||
| City = ""; | City = ""; | ||||
| DisplayCity = ""; | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| public string RahmenNummer { get; set; } | public string RahmenNummer { get; set; } | ||||
| public string Bemerkung { get; set; } | public string Bemerkung { get; set; } | ||||
| public string Foto { get; set; } | public string Foto { get; set; } | ||||
| public string FotoString { get; set; } | |||||
| } | } | ||||
| } | } |
| } | } | ||||
| private void ButtonBackClicked() { | private void ButtonBackClicked() { | ||||
| NavigationManager.NavigateTo(PageHistoryManager.GetPreviousPage()); | |||||
| PageHistoryManager.NavigateBack(); | |||||
| } | } | ||||
| using System.Collections.Generic; | |||||
| using Microsoft.AspNetCore.Components; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | using System.Linq; | ||||
| using System.Threading.Tasks; | |||||
| namespace cwebplusApp.Shared.Services { | namespace cwebplusApp.Shared.Services { | ||||
| public class PageHistoryManager { | public class PageHistoryManager { | ||||
| public EventCallback OnBeforeNavigateBack; | |||||
| private readonly List<string> previousPages; | private readonly List<string> previousPages; | ||||
| public PageHistoryManager() { | |||||
| private NavigationManager NavigationManager; | |||||
| public PageHistoryManager(NavigationManager NavigationManager) { | |||||
| previousPages = new List<string>(); | previousPages = new List<string>(); | ||||
| this.NavigationManager = NavigationManager; | |||||
| } | } | ||||
| public void Reset() { | public void Reset() { | ||||
| public bool CanGoBack() { | public bool CanGoBack() { | ||||
| return previousPages.Count > 1; | return previousPages.Count > 1; | ||||
| } | } | ||||
| public async void NavigateBack() { | |||||
| await FireOnBeforeNavigateBackEvent(); | |||||
| NavigationManager.NavigateTo(GetPreviousPage()); | |||||
| } | |||||
| protected async Task FireOnBeforeNavigateBackEvent() { | |||||
| await OnBeforeNavigateBack.InvokeAsync(); | |||||
| } | |||||
| } | } | ||||
| } | } |
| return null; | return null; | ||||
| } | } | ||||
| public MissingReport GetLostReport() { | |||||
| public MissingReport GetMissingReport() { | |||||
| if (Report is MissingReport) { | if (Report is MissingReport) { | ||||
| return (MissingReport)Report; | return (MissingReport)Report; | ||||
| } | } |
| private readonly IJSRuntime _jsRuntime; | private readonly IJSRuntime _jsRuntime; | ||||
| private bool _initialized; | private bool _initialized; | ||||
| private UserData _data = new(); | |||||
| public UserData Data { | |||||
| get => _data; | |||||
| set => _data = value; | |||||
| } | |||||
| public event EventHandler Changed; | public event EventHandler Changed; | ||||
| } else { | } else { | ||||
| result = new UserData(); | result = new UserData(); | ||||
| } | } | ||||
| _data = result; | |||||
| return result; | return result; | ||||
| } | } | ||||
| public async Task Save() { | |||||
| public async Task Save(UserData _data) { | |||||
| var json = System.Text.Json.JsonSerializer.Serialize(_data); | var json = System.Text.Json.JsonSerializer.Serialize(_data); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyName, json); | await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyName, json); | ||||
| } | } | ||||
| public void OnStorageUpdated(string key) { | public void OnStorageUpdated(string key) { | ||||
| if (key == KeyName) { | if (key == KeyName) { | ||||
| // Reset the settings. The next call to Get will reload the data | // Reset the settings. The next call to Get will reload the data | ||||
| _data = null; | |||||
| Changed?.Invoke(this, EventArgs.Empty); | 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.Salutation = report.Anrede; | ||||
| userData.Firstname = report.Vorname; | 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; | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| <ItemGroup> | <ItemGroup> | ||||
| <PackageReference Include="BlazorAnimate" Version="3.0.0" /> | <PackageReference Include="BlazorAnimate" Version="3.0.0" /> | ||||
| <PackageReference Include="BlazorGeolocation" Version="0.1.1" /> | <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="Json.Net" Version="1.0.33" /> | ||||
| <PackageReference Include="MatBlazor" Version="2.9.0-develop-042" /> | <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.Configuration.ConfigurationManager" Version="5.0.0" /> | ||||
| <PackageReference Include="System.Net.Http.Json" Version="5.0.0" /> | <PackageReference Include="System.Net.Http.Json" Version="5.0.0" /> | ||||
| </ItemGroup> | </ItemGroup> |
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <configuration> | <configuration> | ||||
| <packageSources> | <packageSources> | ||||
| <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | |||||
| <add key="CustomNugets.BlazorMaps" value=".\nugets\FisSst.BlazorMaps" /> | |||||
| </packageSources> | </packageSources> | ||||
| </configuration> | </configuration> |
| <?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> |
| 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. |