| @inject NavigationManager NavigationManager | @inject NavigationManager NavigationManager | ||||
| @inject UserDataProvider UserDataProvider | @inject UserDataProvider UserDataProvider | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | @inject ReportDataProvider ReportDataProvider | ||||
| <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 required" Label="@i18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem" Required="true"> | |||||
| <MatOptionString Value="M">@i18n["Male"]</MatOptionString> | |||||
| <MatOptionString Value="F">@i18n["Female"]</MatOptionString> | |||||
| <MatSelect Class="w-100 required" Label="@I18n["Salutation"]" Outlined="true" @bind-Value="@Account.Salutation" Style="margin-bottom: 0.5rem" Required="true"> | |||||
| <MatOptionString Value="M">@I18n["Male"]</MatOptionString> | |||||
| <MatOptionString Value="F">@I18n["Female"]</MatOptionString> | |||||
| </MatSelect> | </MatSelect> | ||||
| </div> | </div> | ||||
| </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" Required="true"></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" Required="true"></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" Required="true"></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" Required="true"></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" Required="true"></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" Required="true"></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"> | ||||
| <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="@Account.Email"></MatStringField> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em"> | ||||
| <div class="col" style="padding-right:0.5em"> | <div class="col" style="padding-right:0.5em"> | ||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton> | |||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton> | |||||
| </div> | </div> | ||||
| <div class="col" style="padding-left:0.5em"> | <div class="col" style="padding-left:0.5em"> | ||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@i18n["Send"]</MatButton> | |||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@I18n["Send"]</MatButton> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| } else { | } else { | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em"> | ||||
| <MatButton Class="w-100" Raised="true" @onclick="SaveUserDataAndClose">@i18n["Save"]</MatButton> | |||||
| <MatButton Class="w-100" Raised="true" @onclick="SaveUserDataAndClose">@I18n["Save"]</MatButton> | |||||
| </div> | </div> | ||||
| } | } | ||||
| </div> | </div> | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| Account = await GetUserData(); | Account = await GetUserData(); | ||||
| if (!string.IsNullOrEmpty(FromRoute) && ReportDataProvider.Report != null) { | if (!string.IsNullOrEmpty(FromRoute) && ReportDataProvider.Report != null) { | ||||
| UserDataProvider.mapUserData(Account, ReportDataProvider.Report); | |||||
| UserDataProvider.MapUserData(Account, ReportDataProvider.Report); | |||||
| } | } | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| } | } | ||||
| private void OnBeforeNavigateBack() { | private void OnBeforeNavigateBack() { | ||||
| if (ReportDataProvider.Report != null) { | if (ReportDataProvider.Report != null) { | ||||
| UserDataProvider.mapReport(ReportDataProvider.Report, Account); | |||||
| UserDataProvider.MapReport(ReportDataProvider.Report, Account); | |||||
| } | } | ||||
| } | } | ||||
| NavigationManager.NavigateTo("caritas_services"); | NavigationManager.NavigateTo("caritas_services"); | ||||
| } | } | ||||
| private async Task<UserData> GetUserData() { | private async Task<UserData> GetUserData() { | ||||
| return await UserDataProvider.Get(); | return await UserDataProvider.Get(); | ||||
| } | } | ||||
| private void Next() { | private void Next() { | ||||
| if ("Found".Equals(FromRoute)) { | if ("Found".Equals(FromRoute)) { | ||||
| UserDataProvider.mapReport(ReportDataProvider.Report, Account); | |||||
| UserDataProvider.MapReport(ReportDataProvider.Report, Account); | |||||
| NavigationManager.NavigateTo("fundvelo/conclusion_found"); | NavigationManager.NavigateTo("fundvelo/conclusion_found"); | ||||
| } else { | } else { | ||||
| UserDataProvider.mapMissingReport(ReportDataProvider.GetMissingReport(), Account); | |||||
| UserDataProvider.MapMissingReport(ReportDataProvider.GetMissingReport(), Account); | |||||
| NavigationManager.NavigateTo("fundvelo/conclusion_missing"); | NavigationManager.NavigateTo("fundvelo/conclusion_missing"); | ||||
| } | } | ||||
| } | } |
| @code { | @code { | ||||
| protected override void OnInitialized() { | protected override void OnInitialized() { | ||||
| base.OnInitialized(); | |||||
| PageHistoryManager.Reset(); | PageHistoryManager.Reset(); | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| base.OnInitialized(); | |||||
| } | } | ||||
| private void FundVelo_LostFound() { | private void FundVelo_LostFound() { |
| @inject NavigationManager NavigationManager | @inject NavigationManager NavigationManager | ||||
| @inject UserDataProvider UserDataProvider | @inject UserDataProvider UserDataProvider | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | @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"> | ||||
| <MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@i18n["PickupContact"]</MatHeadline4> | |||||
| <MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@I18n["PickupContact"]</MatHeadline4> | |||||
| </div>*@ | </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 required" Label="@i18n["Salutation"]" Outlined="true" @bind-Value="pucSalutation" Required="true" Style="margin-bottom: 0.5rem"> | |||||
| <MatOptionString Value="M">@i18n["Male"]</MatOptionString> | |||||
| <MatOptionString Value="F">@i18n["Female"]</MatOptionString> | |||||
| <MatSelect Class="w-100 required" Label="@I18n["Salutation"]" Outlined="true" @bind-Value="pucSalutation" Required="true" Style="margin-bottom: 0.5rem"> | |||||
| <MatOptionString Value="M">@I18n["Male"]</MatOptionString> | |||||
| <MatOptionString Value="F">@I18n["Female"]</MatOptionString> | |||||
| </MatSelect> | </MatSelect> | ||||
| </div> | </div> | ||||
| </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="pucFirstname" Required="true"></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="pucLastname" Required="true"></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="pucAddress" Required="true"></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="pucZip" Required="true"></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="pucCity" Required="true"></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="pucMobile"></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="pucPhone"></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="pucEmail"></MatStringField> | |||||
| <MatStringField Class="w-100" Label="@I18n["Mail"]" Outlined="true" type="text" @bind-Value="pucEmail"></MatStringField> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em"> | ||||
| <div class="col" style="padding-right:0.5em"> | <div class="col" style="padding-right:0.5em"> | ||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton> | |||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton> | |||||
| </div> | </div> | ||||
| <div class="col" style="padding-left:0.5em"> | <div class="col" style="padding-left:0.5em"> | ||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@i18n["Continue"]</MatButton> | |||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@I18n["Continue"]</MatButton> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| private string pucPhone; | private string pucPhone; | ||||
| private string pucEmail; | private string pucEmail; | ||||
| protected async override void OnInitialized() { | |||||
| protected override void OnInitialized() { | |||||
| base.OnInitialized(); | base.OnInitialized(); | ||||
| PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack); | PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack); | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); |
| @using cwebplusApp.Components; | @using cwebplusApp.Components; | ||||
| @inject NavigationManager NavigationManager; | @inject NavigationManager NavigationManager; | ||||
| @inject IStringLocalizer<Resources> i18n; | |||||
| @inject IStringLocalizer<Resources> I18n; | |||||
| @inject PageHistoryManager PageHistoryManager; | @inject PageHistoryManager PageHistoryManager; | ||||
| @inject ReportDataProvider ReportDataProvider; | @inject ReportDataProvider ReportDataProvider; | ||||
| @inject IBicycleRestService IBicycleRestService; | @inject IBicycleRestService IBicycleRestService; | ||||
| <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["Confirmation"]</MatHeadline4> | |||||
| <MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@I18n["Confirmation"]</MatHeadline4> | |||||
| </div> | </div> | ||||
| @if (ResponseStatus.OK == responseStatus) { | @if (ResponseStatus.OK == responseStatus) { | ||||
| <div class="row no-gutters align-items-start justify-content-center w-100" style="height:fit-content"> | <div class="row no-gutters align-items-start justify-content-center w-100" style="height:fit-content"> | ||||
| <div class="w-100" style="text-align: center"> | <div class="w-100" style="text-align: center"> | ||||
| <MatHeadline6 Style="font-family:Ubuntu">@i18n["FinishedTextFound"]</MatHeadline6> | |||||
| <MatHeadline6 Style="font-family:Ubuntu">@I18n["FinishedTextFound"]</MatHeadline6> | |||||
| </div> | </div> | ||||
| <div class="w-100" style="text-align: center"> | <div class="w-100" style="text-align: center"> | ||||
| <MatHeadline6 Style="font-family:Ubuntu">@referenceNumber</MatHeadline6> | <MatHeadline6 Style="font-family:Ubuntu">@referenceNumber</MatHeadline6> | ||||
| <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" /> | <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" /> | ||||
| </div> | </div> | ||||
| <div class="w-100" style="text-align:center;"> | <div class="w-100" style="text-align:center;"> | ||||
| <h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Report.Transmitting"]</h6> | |||||
| <h6 style="font-style:italic;padding-bottom:1em">@I18n["Info.Report.Transmitting"]</h6> | |||||
| </div> | </div> | ||||
| } else { | } else { | ||||
| if (ResponseStatus.OK == responseStatus) { | if (ResponseStatus.OK == responseStatus) { | ||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em"> | ||||
| <div class="col w-100 text-center"> | <div class="col w-100 text-center"> | ||||
| <MatButton Class="w-50" Raised="true" @onclick="Finished">@i18n["Finished"]</MatButton> | |||||
| <MatButton Class="w-50" Raised="true" @onclick="Finished">@I18n["Finished"]</MatButton> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| private ResponseStatus responseStatus = ResponseStatus.NoConnection; | private ResponseStatus responseStatus = ResponseStatus.NoConnection; | ||||
| private bool running = true; | private bool running = true; | ||||
| private string referenceNumber; | private string referenceNumber; | ||||
| ReportResponse response; | |||||
| private ReportResponse response; | |||||
| protected async override void OnInitialized() { | protected async override void OnInitialized() { | ||||
| base.OnInitialized(); | base.OnInitialized(); | ||||
| } | } | ||||
| responseStatus = response==null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error; | responseStatus = response==null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error; | ||||
| } catch (HttpRequestException ex) { | } catch (HttpRequestException ex) { | ||||
| response = new(i18n.GetString("FoundBike"), new string[] { ex.Message }); | |||||
| response = new(I18n.GetString("FoundBike"), new string[] { ex.Message }); | |||||
| responseStatus = ResponseStatus.Error; | responseStatus = ResponseStatus.Error; | ||||
| } | } | ||||
| running = false; | running = false; | ||||
| if (ResponseStatus.OK == responseStatus) { | if (ResponseStatus.OK == responseStatus) { | ||||
| Toaster.ShowSuccess(i18n.GetString("FoundBike"), response.Message); | |||||
| Toaster.ShowSuccess(I18n.GetString("FoundBike"), response.Message); | |||||
| referenceNumber = (response.Data != null && response.Data.Length > 0) ? response.Data[0] : "-"; | referenceNumber = (response.Data != null && response.Data.Length > 0) ? response.Data[0] : "-"; | ||||
| PageHistoryManager.Reset(); | PageHistoryManager.Reset(); | ||||
| } else if (ResponseStatus.Error == responseStatus) { | } else if (ResponseStatus.Error == responseStatus) { | ||||
| Toaster.ShowError(response.Message, response.GetDataAsFormattedList()); | Toaster.ShowError(response.Message, response.GetDataAsFormattedList()); | ||||
| } else { | } else { | ||||
| Toaster.ShowWarning(i18n.GetString("Warning.NoConnection.Title"), i18n.GetString("Warning.NoConnection.Msg")); | |||||
| Toaster.ShowWarning(I18n.GetString("Warning.NoConnection.Title"), I18n.GetString("Warning.NoConnection.Msg")); | |||||
| PageHistoryManager.Reset(); | PageHistoryManager.Reset(); | ||||
| } | } | ||||
| StateHasChanged(); | StateHasChanged(); |
| @using System.IO; | @using System.IO; | ||||
| @inject NavigationManager NavigationManager | @inject NavigationManager NavigationManager | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject MasterDataService MasterDataService | @inject MasterDataService MasterDataService | ||||
| @inject Toaster Toaster | @inject Toaster Toaster | ||||
| <div class="row px-3 h-100"> | <div class="row px-3 h-100"> | ||||
| <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> | <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> | ||||
| <h2>@i18n["FoundBike"]</h2> | |||||
| <h2>@I18n["FoundBike"]</h2> | |||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-center justify-content-center w-100"> | <div class="row no-gutters align-items-center justify-content-center w-100"> | ||||
| <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.DisplayCity"></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> | </div> | ||||
| <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> | <div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop"> | ||||
| <MatTextField Class="w-100 form-check-label italic" Label="@i18n["Longitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Longitude"></MatTextField> | |||||
| <MatTextField Class="w-100 form-check-label italic" Label="@I18n["Longitude"]" Outlined="true" ReadOnly="true" @bind-Value="@bicycleGeoPosition.Longitude"></MatTextField> | |||||
| </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-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 Class="required" FullWidth="true" Outlined="true" Label="@i18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||||
| <MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||||
| <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"]" Required="true" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)"> | |||||
| <MatAutocompleteList TItem="Brand" FullWidth="true" Label="@I18n["Brand"]" Required="true" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)"> | |||||
| <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 Class="required" FullWidth="true" Outlined="true" Label="@i18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||||
| <MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||||
| <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" @bind-Value="frameNumber"></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" @bind-Value="remark"></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"> | ||||
| <div> | <div> | ||||
| <MatCheckbox @bind-Value="@abholadresseIsNotContact" Label="@i18n["AlternatePickupContact"]"></MatCheckbox> | |||||
| <MatCheckbox @bind-Value="@abholadresseIsNotContact" Label="@I18n["AlternatePickupContact"]"></MatCheckbox> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em"> | ||||
| <div class="col" style="padding-right:0.5em"> | <div class="col" style="padding-right:0.5em"> | ||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton> | |||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton> | |||||
| </div> | </div> | ||||
| <div class="col" style="padding-left:0.5em"> | <div class="col" style="padding-left:0.5em"> | ||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@i18n["Continue"]</MatButton> | |||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@I18n["Continue"]</MatButton> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| private string getAddressLbl() { | private string getAddressLbl() { | ||||
| return i18n.GetString("Address") + " (" + i18n.GetString("PlaceOfDiscovery") + ")"; | |||||
| return I18n.GetString("Address") + " (" + I18n.GetString("PlaceOfDiscovery") + ")"; | |||||
| } | } | ||||
| private async Task OnGatheringPicture(InputFileChangeEventArgs e) { | private async Task OnGatheringPicture(InputFileChangeEventArgs e) { | ||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| Console.WriteLine("Ex.Message is: {0}.", ex.Message); | Console.WriteLine("Ex.Message is: {0}.", ex.Message); | ||||
| if (ex.Message.Contains("exceeds the maximum of")) { | if (ex.Message.Contains("exceeds the maximum of")) { | ||||
| Toaster.ShowError(i18n.GetString("Error.PhotoOrPictureToBig.Title"), i18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE / (1024 * 1024))); | |||||
| Toaster.ShowError(I18n.GetString("Error.PhotoOrPictureToBig.Title"), I18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE / (1024 * 1024))); | |||||
| } else { | } else { | ||||
| Toaster.ShowError(i18n.GetString("Error.IOException.Title"), i18n.GetString("Error.IOException.Msg")); | |||||
| Toaster.ShowError(I18n.GetString("Error.IOException.Title"), I18n.GetString("Error.IOException.Msg")); | |||||
| } | } | ||||
| } catch (JSException ex) { | } catch (JSException ex) { | ||||
| Console.WriteLine("Ex.Message is: {0}.", ex.Message); | Console.WriteLine("Ex.Message is: {0}.", ex.Message); |
| protected readonly LatLng center; | protected readonly LatLng center; | ||||
| protected Map mapRef; | protected Map mapRef; | ||||
| protected MapOptions mapOptions; | protected MapOptions mapOptions; | ||||
| protected BicycleGeoPosition bicycleGeoPosition; | protected BicycleGeoPosition bicycleGeoPosition; | ||||
| private Marker bicyclePositionMarker; | private Marker bicyclePositionMarker; | ||||
| private MarkerOptions bicycleMarkerOptions; | private MarkerOptions bicycleMarkerOptions; | ||||
| private NominatimReverseAddress addressDto; | |||||
| private Marker devicePositionMarker; | private Marker devicePositionMarker; | ||||
| [Inject] | [Inject] | ||||
| private NominatimService NominatimService { get; set; } | private NominatimService NominatimService { get; set; } | ||||
| private NominatimReverseAddress addressDto; | |||||
| public CaritasServiceFundVeloKeyDataPageBase() : base() { | public CaritasServiceFundVeloKeyDataPageBase() : base() { |
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | @inject ReportDataProvider ReportDataProvider | ||||
| @inject ReportRepositoryService ReportRepositoryService | @inject ReportRepositoryService ReportRepositoryService | ||||
| @inject IStringLocalizer<Resources> i18n; | |||||
| @inject IStringLocalizer<Resources> I18n; | |||||
| @inject Toaster Toaster; | @inject Toaster Toaster; | ||||
| @inject IMatDialogService MatDialogService; | @inject IMatDialogService MatDialogService; | ||||
| @inject ScrollLockRemover ScrollLockRemover; | @inject ScrollLockRemover ScrollLockRemover; | ||||
| <div class="row px-3"> | <div class="row px-3"> | ||||
| <div class="row no-gutters align-items-start justify-content-center w-100" style="padding-top:1em"> | <div class="row no-gutters align-items-start justify-content-center w-100" style="padding-top:1em"> | ||||
| @if (FromRoute.Equals("history_found")) { | @if (FromRoute.Equals("history_found")) { | ||||
| <h2>@i18n["HistoryFound"]</h2> | |||||
| <h2>@I18n["HistoryFound"]</h2> | |||||
| } else { | } else { | ||||
| <h2>@i18n["HistoryMissing"]</h2> | |||||
| <h2>@I18n["HistoryMissing"]</h2> | |||||
| } | } | ||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-start w-100"> | <div class="row no-gutters align-items-start w-100"> | ||||
| AllowSelection="true"> | AllowSelection="true"> | ||||
| <MatTableHeader> | <MatTableHeader> | ||||
| <th>Id</th> | <th>Id</th> | ||||
| <th>@i18n["Type"]</th> | |||||
| <th>@i18n["Date"]</th> | |||||
| <th>@I18n["Type"]</th> | |||||
| <th>@I18n["Date"]</th> | |||||
| @if (FromRoute.Equals("history_found")) { | @if (FromRoute.Equals("history_found")) { | ||||
| <th>@i18n["Address"]</th> | |||||
| <th>@I18n["Address"]</th> | |||||
| } | } | ||||
| <th>@i18n["Picture"]</th> | |||||
| <th style="width:2400px">@i18n["Action"]</th> | |||||
| <th>@I18n["Picture"]</th> | |||||
| <th style="width:2400px">@I18n["Action"]</th> | |||||
| </MatTableHeader> | </MatTableHeader> | ||||
| <MatTableRow> | <MatTableRow> | ||||
| <td>@context.ID</td> | <td>@context.ID</td> | ||||
| } | } | ||||
| protected async override void OnParametersSet() { | protected async override void OnParametersSet() { | ||||
| base.OnParametersSet(); | |||||
| if (FromRoute.Equals("history_found")) { | if (FromRoute.Equals("history_found")) { | ||||
| transmittedReports.AddRange(await ReportRepositoryService.GetTransmittedFoundReports()); | transmittedReports.AddRange(await ReportRepositoryService.GetTransmittedFoundReports()); | ||||
| } else { | } else { | ||||
| } | } | ||||
| private string translateType(ReportRepositoryItem.Type type) { | private string translateType(ReportRepositoryItem.Type type) { | ||||
| return i18n.GetString("ReportType." + type); | |||||
| return I18n.GetString("ReportType." + type); | |||||
| } | } | ||||
| private string getTypeBackgroundStyle(ReportRepositoryItem.Type type) { | private string getTypeBackgroundStyle(ReportRepositoryItem.Type type) { | ||||
| } | } | ||||
| private async void DeleteReport(ReportRepositoryItem item, bool ask = true) { | private async void DeleteReport(ReportRepositoryItem item, bool ask = true) { | ||||
| string yes = i18n.GetString("Yes"); | |||||
| string no = i18n.GetString("No"); | |||||
| string result = ask ? await MatDialogService.AskAsync(i18n.GetString("Pending." + item.ReportType + ".Delete"), new string[] { yes, no }) : yes; | |||||
| string yes = I18n.GetString("Yes"); | |||||
| string no = I18n.GetString("No"); | |||||
| string result = ask ? await MatDialogService.AskAsync(I18n.GetString("Pending." + item.ReportType + ".Delete"), new string[] { yes, no }) : yes; | |||||
| await ScrollLockRemover.removeScrollLockAsync(); | await ScrollLockRemover.removeScrollLockAsync(); | ||||
| if (result.Equals(yes)) { | if (result.Equals(yes)) { | ||||
| try { | try { | ||||
| await ReportRepositoryService.DeleteReport(item); | await ReportRepositoryService.DeleteReport(item); | ||||
| transmittedReports.Remove(item); | transmittedReports.Remove(item); | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| Toaster.ShowSuccess(i18n.GetString("Success.DeleteReport.Title"), i18n.GetString("Success.DeleteReport.Msg", item.ID)); | |||||
| Toaster.ShowSuccess(I18n.GetString("Success.DeleteReport.Title"), I18n.GetString("Success.DeleteReport.Msg", item.ID)); | |||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| Toaster.ShowWarning(i18n.GetString("Error.DeleteReport.Title"), i18n.GetString("Error.DeleteReport.Msg", item.ID)); | |||||
| Toaster.ShowWarning(I18n.GetString("Error.DeleteReport.Title"), I18n.GetString("Error.DeleteReport.Msg", item.ID)); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| private async void DeleteAll() { | private async void DeleteAll() { | ||||
| string yes = i18n.GetString("Yes"); | |||||
| string no = i18n.GetString("No"); | |||||
| string result = await MatDialogService.AskAsync(i18n.GetString("History.DELETE"), new string[] { yes, no }); | |||||
| string yes = I18n.GetString("Yes"); | |||||
| string no = I18n.GetString("No"); | |||||
| string result = await MatDialogService.AskAsync(I18n.GetString("History.DELETE"), new string[] { yes, no }); | |||||
| await ScrollLockRemover.removeScrollLockAsync(); | await ScrollLockRemover.removeScrollLockAsync(); | ||||
| if (result.Equals(yes)) { | if (result.Equals(yes)) { | ||||
| foreach (ReportRepositoryItem item in transmittedReports) { | foreach (ReportRepositoryItem item in transmittedReports) { |
| private async void Found() { | private async void Found() { | ||||
| Report report = new FoundReport(); | Report report = new FoundReport(); | ||||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||||
| UserDataProvider.MapReport(report, await UserDataProvider.Get()); | |||||
| ReportDataProvider.Report = report; | ReportDataProvider.Report = report; | ||||
| NavigationManager.NavigateTo("fundvelo/keydata/Found"); | NavigationManager.NavigateTo("fundvelo/keydata/Found"); | ||||
| } | } | ||||
| private async void Missing() { | private async void Missing() { | ||||
| Report report = new MissingReport(); | Report report = new MissingReport(); | ||||
| UserDataProvider.mapReport(report, await UserDataProvider.Get()); | |||||
| UserDataProvider.MapReport(report, await UserDataProvider.Get()); | |||||
| ReportDataProvider.Report = report; | ReportDataProvider.Report = report; | ||||
| NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | ||||
| } | } |
| @using cwebplusApp.Components; | @using cwebplusApp.Components; | ||||
| @inject NavigationManager NavigationManager; | @inject NavigationManager NavigationManager; | ||||
| @inject IStringLocalizer<Resources> i18n; | |||||
| @inject IStringLocalizer<Resources> I18n; | |||||
| @inject PageHistoryManager PageHistoryManager; | @inject PageHistoryManager PageHistoryManager; | ||||
| @inject ReportDataProvider ReportDataProvider; | @inject ReportDataProvider ReportDataProvider; | ||||
| @inject IBicycleRestService IBicycleRestService; | @inject IBicycleRestService IBicycleRestService; | ||||
| <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:0.5em">@i18n["Info"]</MatHeadline4> | |||||
| <MatHeadline4 Style="font-family:Ubuntu;padding-top:0.5em">@I18n["Info"]</MatHeadline4> | |||||
| </div> | </div> | ||||
| <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"> | ||||
| @if (running) { | @if (running) { | ||||
| <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" /> | <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" /> | ||||
| </div> | </div> | ||||
| <div class="w-100" style="text-align:center;"> | <div class="w-100" style="text-align:center;"> | ||||
| <h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Report.Transmitting"]</h6> | |||||
| <h6 style="font-style:italic;padding-bottom:1em">@I18n["Info.Report.Transmitting"]</h6> | |||||
| </div> | </div> | ||||
| } else { | } else { | ||||
| if (ResposeStatus.OK == responseStatus) { | if (ResposeStatus.OK == responseStatus) { | ||||
| <MatHeadline5 Style="font-family:Ubuntu; text-align:center">@i18n["FinishedTextMissing"]</MatHeadline5> | |||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800">@i18n["FinishedTextMissing_Heading1"]</MatSubtitle1> | |||||
| <MatHeadline5 Style="font-family:Ubuntu; text-align:center">@I18n["FinishedTextMissing"]</MatHeadline5> | |||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800">@I18n["FinishedTextMissing_Heading1"]</MatSubtitle1> | |||||
| <ul class="w-100"> | <ul class="w-100"> | ||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@i18n["FinishedTextMissing_2"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@i18n["FinishedTextMissing_3"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@I18n["FinishedTextMissing_2"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@I18n["FinishedTextMissing_3"]</li> | |||||
| </ul> | </ul> | ||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800;padding-top:20px">@i18n["FinishedTextMissing_Heading2"]</MatSubtitle1> | |||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800;padding-top:20px">@I18n["FinishedTextMissing_Heading2"]</MatSubtitle1> | |||||
| <ul class="w-100"> | <ul class="w-100"> | ||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@i18n["FinishedTextMissing_4"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@i18n["FinishedTextMissing_5"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@i18n["FinishedTextMissing_6"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@I18n["FinishedTextMissing_4"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@I18n["FinishedTextMissing_5"]</li> | |||||
| <li class="w-100" style="font-family: Ubuntu; text-align: left">@I18n["FinishedTextMissing_6"]</li> | |||||
| </ul> | </ul> | ||||
| <MatHeadline5 Class="w-100" Style="font-family: Ubuntu; text-align: left;padding-top:20px">@i18n["FinishedTextMissing_Heading3"]</MatHeadline5> | |||||
| <MatHeadline5 Class="w-100" Style="font-family: Ubuntu; text-align: left;padding-top:20px">@I18n["FinishedTextMissing_Heading3"]</MatHeadline5> | |||||
| <div class="w-100"> | <div class="w-100"> | ||||
| <MatIcon Style="padding-right:1rem"> | <MatIcon Style="padding-right:1rem"> | ||||
| <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"> | <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"> | ||||
| <path d="M9.07 7.57C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.49c0-.55-.45-1-1-1-1.24 0-2.45-.2-3.57-.57-.1-.04-.21-.05-.31-.05-.26 0-.51.1-.71.29l-2.2 2.2c-2.83-1.45-5.15-3.76-6.59-6.59l2.2-2.2c.28-.28.36-.67.25-1.02zm7.33 9.45c.85.24 1.72.39 2.6.45v1.49c-1.32-.09-2.59-.35-3.8-.75l1.2-1.19zM5.79 8.8c-.41-1.21-.67-2.48-.76-3.8h1.5c.07.89.22 1.76.46 2.59L5.79 8.8z" /> | <path d="M9.07 7.57C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.49c0-.55-.45-1-1-1-1.24 0-2.45-.2-3.57-.57-.1-.04-.21-.05-.31-.05-.26 0-.51.1-.71.29l-2.2 2.2c-2.83-1.45-5.15-3.76-6.59-6.59l2.2-2.2c.28-.28.36-.67.25-1.02zm7.33 9.45c.85.24 1.72.39 2.6.45v1.49c-1.32-.09-2.59-.35-3.8-.75l1.2-1.19zM5.79 8.8c-.41-1.21-.67-2.48-.76-3.8h1.5c.07.89.22 1.76.46 2.59L5.79 8.8z" /> | ||||
| </svg> | </svg> | ||||
| </MatIcon> | </MatIcon> | ||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800;display:contents">@i18n["FinishedTextMissing_LostOffice_Phone"]</MatSubtitle1> | |||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800;display:contents">@I18n["FinishedTextMissing_LostOffice_Phone"]</MatSubtitle1> | |||||
| </div> | </div> | ||||
| <div class="w-100"> | <div class="w-100"> | ||||
| <MatIcon Style="padding-right:1rem"> | <MatIcon Style="padding-right:1rem"> | ||||
| <path d="M4 20h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2zM20 6l-8 4.99L4 6h16zM4 8l8 5 8-5v10H4V8z" /> | <path d="M4 20h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2zM20 6l-8 4.99L4 6h16zM4 8l8 5 8-5v10H4V8z" /> | ||||
| </svg> | </svg> | ||||
| </MatIcon> | </MatIcon> | ||||
| <MatSubtitle1 Class="w-100" Style="font-family: Ubuntu;text-align:left; font-weight:800; display:contents">@i18n["FinishedTextMissing_LostOffice_Mail"]</MatSubtitle1> | |||||
| <MatSubtitle1 Class="w-100" Style="font-family: Ubuntu;text-align:left; font-weight:800; display:contents">@I18n["FinishedTextMissing_LostOffice_Mail"]</MatSubtitle1> | |||||
| </div> | </div> | ||||
| <div class="w-100"> | <div class="w-100"> | ||||
| <MatIcon Style="padding-right:1rem"> | <MatIcon Style="padding-right:1rem"> | ||||
| <circle cx="12" cy="9" r="2.5" /> | <circle cx="12" cy="9" r="2.5" /> | ||||
| </svg> | </svg> | ||||
| </MatIcon> | </MatIcon> | ||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800; display:contents">@i18n["FinishedTextMissing_LostOffice_Address"]</MatSubtitle1> | |||||
| <MatSubtitle1 Class="w-100" Style="font-family:Ubuntu; text-align:left; font-weight:800; display:contents">@I18n["FinishedTextMissing_LostOffice_Address"]</MatSubtitle1> | |||||
| </div> | </div> | ||||
| } else if (ResposeStatus.Error == responseStatus) { | } else if (ResposeStatus.Error == responseStatus) { | ||||
| <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> | <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> | ||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-top: 2em; padding-bottom: 1em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-top: 2em; padding-bottom: 1em"> | ||||
| <div class="col w-100 text-center"> | <div class="col w-100 text-center"> | ||||
| <MatButton Class="w-50" Raised="true" @onclick="Finished">@i18n["Finished"]</MatButton> | |||||
| <MatButton Class="w-50" Raised="true" @onclick="Finished">@I18n["Finished"]</MatButton> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @code { | @code { | ||||
| enum ResposeStatus : ushort { | |||||
| private enum ResposeStatus : ushort { | |||||
| OK = 1, | OK = 1, | ||||
| Error = 10, | Error = 10, | ||||
| NoConnection = 20 | NoConnection = 20 | ||||
| private ResposeStatus responseStatus = ResposeStatus.NoConnection; | private ResposeStatus responseStatus = ResposeStatus.NoConnection; | ||||
| private bool running = true; | private bool running = true; | ||||
| ReportResponse response; | |||||
| private ReportResponse response; | |||||
| protected async override void OnInitialized() { | protected async override void OnInitialized() { | ||||
| base.OnInitialized(); | base.OnInitialized(); | ||||
| } | } | ||||
| responseStatus = response == null ? ResposeStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResposeStatus.OK : ResposeStatus.Error; | responseStatus = response == null ? ResposeStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResposeStatus.OK : ResposeStatus.Error; | ||||
| } catch (HttpRequestException ex) { | } catch (HttpRequestException ex) { | ||||
| response = new(i18n.GetString("MissingBike"), new string[] { ex.Message }); | |||||
| response = new(I18n.GetString("MissingBike"), new string[] { ex.Message }); | |||||
| responseStatus = ResposeStatus.Error; | responseStatus = ResposeStatus.Error; | ||||
| } | } | ||||
| running = false; | running = false; | ||||
| if (ResposeStatus.OK == responseStatus) { | if (ResposeStatus.OK == responseStatus) { | ||||
| Toaster.ShowSuccess(i18n.GetString("MissingBike"), response.Message); | |||||
| Toaster.ShowSuccess(I18n.GetString("MissingBike"), response.Message); | |||||
| PageHistoryManager.Reset(); | PageHistoryManager.Reset(); | ||||
| } else if (ResposeStatus.Error == responseStatus) { | } else if (ResposeStatus.Error == responseStatus) { | ||||
| Toaster.ShowError(response.Message, response.GetDataAsFormattedList()); | Toaster.ShowError(response.Message, response.GetDataAsFormattedList()); | ||||
| } else { | } else { | ||||
| Toaster.ShowWarning(i18n.GetString("Warning.NoConnection.Title"), i18n.GetString("Warning.NoConnection.Msg")); | |||||
| Toaster.ShowWarning(I18n.GetString("Warning.NoConnection.Title"), I18n.GetString("Warning.NoConnection.Msg")); | |||||
| PageHistoryManager.Reset(); | PageHistoryManager.Reset(); | ||||
| } | } | ||||
| StateHasChanged(); | StateHasChanged(); |
| @using System.IO; | @using System.IO; | ||||
| @inject NavigationManager NavigationManager | @inject NavigationManager NavigationManager | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject MasterDataService MasterDataService | @inject MasterDataService MasterDataService | ||||
| @inject Toaster Toaster | @inject Toaster Toaster | ||||
| <div class="row px-3 h-100"> | <div class="row px-3 h-100"> | ||||
| <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> | <div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em"> | ||||
| <h2>@i18n["MissingBike"]</h2> | |||||
| <h2>@I18n["MissingBike"]</h2> | |||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-center justify-content-center w-100"> | <div class="row no-gutters align-items-center justify-content-center w-100"> | ||||
| <div class="mat-layout-grid w-100"> | <div class="mat-layout-grid w-100"> | ||||
| <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 Class="required" FullWidth="true" Outlined="true" Label="@i18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||||
| <MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Color"]" @bind-Value="selectedColor" Items="@Colors" ValueSelector="@(i=>i)"> | |||||
| <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)" Required="true"> | |||||
| <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 Class="required" FullWidth="true" Outlined="true" Label="@i18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||||
| <MatSelectValue Class="required" FullWidth="true" Outlined="true" Label="@I18n["Type"]" @bind-Value="selectedBcType" Items="@BicycleTypes" ValueSelector="@(i=>i)"> | |||||
| <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" @bind-Value="frameNumber"></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"> | ||||
| <MatNumericUpDownField Class="w-100" Label="@i18n["Age"]" Outlined="true" @bind-Value="@age"></MatNumericUpDownField> | |||||
| <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"> | ||||
| <MatTextField Class="w-100 form-check-label" Label="@i18n["Price"]" Format="0.00" Outlined="true" @bind-Value="@price"></MatTextField> | |||||
| <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-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["SearchService"]" @bind-Value="selectedSearchService" Items="@SearchServices" ValueSelector="@(i=>i)"> | |||||
| <MatSelectValue FullWidth="true" Outlined="true" Label="@I18n["SearchService"]" @bind-Value="selectedSearchService" Items="@SearchServices" ValueSelector="@(i=>i)"> | |||||
| <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-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["SearchServiceNbr"]" Outlined="true" type="text" @bind-Value="searchServiceNbr"></MatStringField> | |||||
| <MatStringField Class="w-100 form-check-label" Label="@I18n["SearchServiceNbr"]" Outlined="true" type="text" @bind-Value="searchServiceNbr"></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["Remark"]" Outlined="true" type="text" @bind-Value="remark"></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> | ||||
| <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em"> | <div class="row no-gutters align-items-end justify-content-center w-100" style="padding-bottom:2em;padding-top:2em"> | ||||
| <div class="col" style="padding-right:0.5em"> | <div class="col" style="padding-right:0.5em"> | ||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton> | |||||
| <MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton> | |||||
| </div> | </div> | ||||
| <div class="col" style="padding-left:0.5em"> | <div class="col" style="padding-left:0.5em"> | ||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@i18n["Continue"]</MatButton> | |||||
| <MatButton Class="w-100" Raised="true" @onclick="Next">@I18n["Continue"]</MatButton> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| Console.WriteLine("Ex.Message is: {0}.", ex.Message); | Console.WriteLine("Ex.Message is: {0}.", ex.Message); | ||||
| if (ex.Message.Contains("exceeds the maximum of")) { | if (ex.Message.Contains("exceeds the maximum of")) { | ||||
| Toaster.ShowError(i18n.GetString("Error.PhotoOrPictureToBig.Title"), i18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE / (1024 * 1024))); | |||||
| Toaster.ShowError(I18n.GetString("Error.PhotoOrPictureToBig.Title"), I18n.GetString("Error.PhotoOrPictureToBig.Msg", MAX_FILE_SIZE / (1024 * 1024))); | |||||
| } else { | } else { | ||||
| Toaster.ShowError(i18n.GetString("Error.IOException.Title"), i18n.GetString("Error.IOException.Msg")); | |||||
| Toaster.ShowError(I18n.GetString("Error.IOException.Title"), I18n.GetString("Error.IOException.Msg")); | |||||
| } | } | ||||
| } catch (JSException ex) { | } catch (JSException ex) { | ||||
| Console.WriteLine("Ex.Message is: {0}.", ex.Message); | Console.WriteLine("Ex.Message is: {0}.", ex.Message); |
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject ReportDataProvider ReportDataProvider | @inject ReportDataProvider ReportDataProvider | ||||
| @inject ReportRepositoryService ReportRepositoryService | @inject ReportRepositoryService ReportRepositoryService | ||||
| @inject IStringLocalizer<Resources> i18n; | |||||
| @inject IStringLocalizer<Resources> I18n; | |||||
| @inject Toaster Toaster; | @inject Toaster Toaster; | ||||
| @inject IMatDialogService MatDialogService; | @inject IMatDialogService MatDialogService; | ||||
| @inject ScrollLockRemover ScrollLockRemover; | @inject ScrollLockRemover ScrollLockRemover; | ||||
| <div class="row px-3"> | <div class="row px-3"> | ||||
| <div class="row no-gutters align-items-start justify-content-center w-100" style="padding-top:1em"> | <div class="row no-gutters align-items-start justify-content-center w-100" style="padding-top:1em"> | ||||
| <h2>@i18n["Pending"]</h2> | |||||
| <h2>@I18n["Pending"]</h2> | |||||
| </div> | </div> | ||||
| <div class="row no-gutters align-items-start w-100"> | <div class="row no-gutters align-items-start w-100"> | ||||
| <MatTable RowClass="ReportRepositoryItem" Items="pendingReports" class="mat-elevation-z5" ShowPaging="false" UseSortHeaderRow="true" | <MatTable RowClass="ReportRepositoryItem" Items="pendingReports" class="mat-elevation-z5" ShowPaging="false" UseSortHeaderRow="true" | ||||
| OnRowDbClick="OnReportDblClicked" AllowSelection="true"> | OnRowDbClick="OnReportDblClicked" AllowSelection="true"> | ||||
| <MatTableHeader> | <MatTableHeader> | ||||
| <th>Id</th> | <th>Id</th> | ||||
| <th>@i18n["Type"]</th> | |||||
| <th>@i18n["Date"]</th> | |||||
| <th>@i18n["Address"]</th> | |||||
| <th>@i18n["Picture"]</th> | |||||
| <th style="width:2400px">@i18n["Action"]</th> | |||||
| <th>@I18n["Type"]</th> | |||||
| <th>@I18n["Date"]</th> | |||||
| <th>@I18n["Address"]</th> | |||||
| <th>@I18n["Picture"]</th> | |||||
| <th style="width:2400px">@I18n["Action"]</th> | |||||
| </MatTableHeader> | </MatTableHeader> | ||||
| <MatTableRow> | <MatTableRow> | ||||
| <td style="display:inline-flex"> | <td style="display:inline-flex"> | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| pendingReports.AddRange(await ReportRepositoryService.GetPendingFoundReports()); | pendingReports.AddRange(await ReportRepositoryService.GetPendingFoundReports()); | ||||
| pendingReports.AddRange(await ReportRepositoryService.GetPendingMissingReports()); | pendingReports.AddRange(await ReportRepositoryService.GetPendingMissingReports()); | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| } | } | ||||
| } | } | ||||
| private string translateType(ReportRepositoryItem.Type type) { | private string translateType(ReportRepositoryItem.Type type) { | ||||
| return i18n.GetString("ReportType." + type); | |||||
| return I18n.GetString("ReportType." + type); | |||||
| } | } | ||||
| private string getTypeBackgroundStyle(ReportRepositoryItem.Type type) { | private string getTypeBackgroundStyle(ReportRepositoryItem.Type type) { | ||||
| private async void DeleteReport(ReportRepositoryItem item) { | private async void DeleteReport(ReportRepositoryItem item) { | ||||
| string yes = i18n.GetString("Yes"); | |||||
| string no = i18n.GetString("No"); | |||||
| string result = await MatDialogService.AskAsync(i18n.GetString("Pending." + item.ReportType + ".Delete"), new string[] { yes, no }); | |||||
| string yes = I18n.GetString("Yes"); | |||||
| string no = I18n.GetString("No"); | |||||
| string result = await MatDialogService.AskAsync(I18n.GetString("Pending." + item.ReportType + ".Delete"), new string[] { yes, no }); | |||||
| await ScrollLockRemover.removeScrollLockAsync(); | await ScrollLockRemover.removeScrollLockAsync(); | ||||
| if (result.Equals(yes)) { | if (result.Equals(yes)) { | ||||
| try { | try { | ||||
| await ReportRepositoryService.DeleteReport(item); | await ReportRepositoryService.DeleteReport(item); | ||||
| pendingReports.Remove(item); | pendingReports.Remove(item); | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| Toaster.ShowSuccess(i18n.GetString("Success.DeleteReport.Title"), i18n.GetString("Success.DeleteReport.Msg", item.ID)); | |||||
| Toaster.ShowSuccess(I18n.GetString("Success.DeleteReport.Title"), I18n.GetString("Success.DeleteReport.Msg", item.ID)); | |||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| Toaster.ShowWarning(i18n.GetString("Error.DeleteReport.Title"), i18n.GetString("Error.DeleteReport.Msg", item.ID)); | |||||
| Toaster.ShowWarning(I18n.GetString("Error.DeleteReport.Title"), I18n.GetString("Error.DeleteReport.Msg", item.ID)); | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| @inject NavigationManager NavigationManager; | @inject NavigationManager NavigationManager; | ||||
| @inject AppState AppState; | @inject AppState AppState; | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject MasterDataService MasterDataService; | @inject MasterDataService MasterDataService; | ||||
| @inject Toaster Toaster; | @inject Toaster Toaster; | ||||
| <div class="row align-items-end vw-100 h-50"> | <div class="row align-items-end vw-100 h-50"> | ||||
| <div class="col text-center"> | <div class="col text-center"> | ||||
| <h3 style="font-style:italic;padding-bottom:1em">@i18n["Welcome"]</h3> | |||||
| <h3 style="font-style:italic;padding-bottom:1em">@I18n["Welcome"]</h3> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="row align-items-center justify-content-center vw-100 h-25"> | <div class="row align-items-center justify-content-center vw-100 h-25"> | ||||
| <div style="width:48px;margin:0 auto;"> | <div style="width:48px;margin:0 auto;"> | ||||
| <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" /> | <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" /> | ||||
| </div> | </div> | ||||
| <h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Masterdata.Initializing"]</h6> | |||||
| <h6 style="font-style:italic;padding-bottom:1em">@I18n["Info.Masterdata.Initializing"]</h6> | |||||
| } | } | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| BicycleRestService.Initialize(Configuration); | BicycleRestService.Initialize(Configuration); | ||||
| await MasterDataService.SynchronizeMasterdata(); | await MasterDataService.SynchronizeMasterdata(); | ||||
| } catch (Exception) { | } catch (Exception) { | ||||
| Toaster.ShowWarning(i18n.GetString("Warning.Masterdata.Title"), i18n.GetString("Warning.Masterdata.Msg")); | |||||
| Toaster.ShowWarning(I18n.GetString("Warning.Masterdata.Title"), I18n.GetString("Warning.Masterdata.Msg")); | |||||
| } | } | ||||
| int sent = await BicycleRestService.TrySendPendingReports(); | int sent = await BicycleRestService.TrySendPendingReports(); | ||||
| if (sent > 0) { | if (sent > 0) { | ||||
| Toaster.ShowSuccess(i18n.GetString("Info.SendPendigs.Title"), i18n.GetString("Info.SendPendigs.Msg", sent)); | |||||
| Toaster.ShowSuccess(I18n.GetString("Info.SendPendigs.Title"), I18n.GetString("Info.SendPendigs.Msg", sent)); | |||||
| } | } | ||||
| } finally { | } finally { | ||||
| showProgressCircle = false; | showProgressCircle = false; |
| @using System.Reflection; | @using System.Reflection; | ||||
| @inject NavigationManager NavigationManager; | @inject NavigationManager NavigationManager; | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject PageHistoryManager PageHistoryManager | @inject PageHistoryManager PageHistoryManager | ||||
| @inject IJSRuntime JSRuntime; | @inject IJSRuntime JSRuntime; | ||||
| <table class="w-100"> | <table class="w-100"> | ||||
| <tr> | <tr> | ||||
| <td class="text-center"> | <td class="text-center"> | ||||
| <p class="text-left" style="max-width: 500px;display:inline-block">@i18n["Abouttext"]</p> | |||||
| <p class="text-left" style="max-width: 500px;display:inline-block">@I18n["Abouttext"]</p> | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td class="text-center"> | <td class="text-center"> | ||||
| <MatButton Raised="true" Class="w-100" @onclick="@ShowCaritasWebpage" style="max-width:500px">@i18n["Learnmore"]</MatButton> | |||||
| <MatButton Raised="true" Class="w-100" @onclick="@ShowCaritasWebpage" style="max-width:500px">@I18n["Learnmore"]</MatButton> | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td class="text-center"> | <td class="text-center"> | ||||
| <MatCaption Style="font-family:Ubuntu">@i18n["App.version", @version]</MatCaption> | |||||
| <MatCaption Style="font-family:Ubuntu">@I18n["App.version", @version]</MatCaption> | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| </table> | </table> | ||||
| <table class="w-100"> | <table class="w-100"> | ||||
| <tr> | <tr> | ||||
| <td class="text-right"> | <td class="text-right"> | ||||
| <MatCaption Style="font-family:Ubuntu">@i18n["DevelopedBy"]</MatCaption> | |||||
| <MatCaption Style="font-family:Ubuntu">@I18n["DevelopedBy"]</MatCaption> | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| private async void ShowCaritasWebpage() { | private async void ShowCaritasWebpage() { | ||||
| await JSRuntime.InvokeAsync<string>("open", $"https://www.caritas.ch", "_blank", "noopener"); | await JSRuntime.InvokeAsync<string>("open", $"https://www.caritas.ch", "_blank", "noopener"); | ||||
| } | } | ||||
| //private string GetAppVersion() { | |||||
| // return i18n.GetString("App.version", new object[] { version }); | |||||
| //} | |||||
| } | } |
| public FoundReport Report { get => report; set => report = value; } | public FoundReport Report { get => report; set => report = value; } | ||||
| public FoundReportRepositoryItem() : base(Type.FOUND, null) { | public FoundReportRepositoryItem() : base(Type.FOUND, null) { | ||||
| } | } | ||||
| public FoundReportRepositoryItem(FoundReport _report, long identifier) : base(Type.FOUND, identifier) { | public FoundReportRepositoryItem(FoundReport _report, long identifier) : base(Type.FOUND, identifier) { |
| } | } | ||||
| public MissingReport(string anrede, string vorname, string nachname, string mail, string personPLZ, | public MissingReport(string anrede, string vorname, string nachname, string mail, string personPLZ, | ||||
| string personOrt, string personStrasse, int? typId, int? markeId, int? farbeId) { | |||||
| string personOrt, string personStrasse, int? typId, int? markeId, int? farbeId) { | |||||
| this.Anrede = anrede; | this.Anrede = anrede; | ||||
| this.Vorname = vorname; | this.Vorname = vorname; | ||||
| this.Nachname = nachname; | this.Nachname = nachname; |
| public int Id { get; set; } | public int Id { get; set; } | ||||
| public string Bezeichnung { get; set; } | public string Bezeichnung { get; set; } | ||||
| public SearchService() { } | |||||
| public SearchService() { | |||||
| } | |||||
| public SearchService(int id, string type) { | public SearchService(int id, string type) { | ||||
| Id = id; | Id = id; |
| @inject AppState AppState; | @inject AppState AppState; | ||||
| @inject NavigationManager NavigationManager; | @inject NavigationManager NavigationManager; | ||||
| @inject IStringLocalizer<Resources> i18n | |||||
| @inject IJSRuntime jsRuntime; | |||||
| @inject IStringLocalizer<Resources> I18n | |||||
| @inject IJSRuntime JSRuntime; | |||||
| @inject PageHistoryManager PageHistoryManager; | @inject PageHistoryManager PageHistoryManager; | ||||
| @implements IDisposable; | @implements IDisposable; | ||||
| <MatAppBarTitle Class="navBar-title">@LocationUrl</MatAppBarTitle> | <MatAppBarTitle Class="navBar-title">@LocationUrl</MatAppBarTitle> | ||||
| </MatAppBarSection> | </MatAppBarSection> | ||||
| <MatAppBarSection align="@MatAppBarSectionAlign.End" Style="max-width:min-content"> | <MatAppBarSection align="@MatAppBarSectionAlign.End" Style="max-width:min-content"> | ||||
| <NavLink rel="noopener" target="_blank" class="text-white small" href="https://www.caritas.ch" align="@MatAppBarSectionAlign.End" style="padding-right:1em">@i18n["Learnmore"]</NavLink> | |||||
| <NavLink rel="noopener" target="_blank" class="text-white small" href="https://www.caritas.ch" align="@MatAppBarSectionAlign.End" style="padding-right:1em">@I18n["Learnmore"]</NavLink> | |||||
| </MatAppBarSection> | </MatAppBarSection> | ||||
| </MatAppBarRow> | </MatAppBarRow> | ||||
| </MatAppBar> | </MatAppBar> | ||||
| <MatAppBarContent> | <MatAppBarContent> | ||||
| <MatDrawerContainer> | <MatDrawerContainer> | ||||
| <MatDrawer @bind-Opened="@Opened" Mode="@MatDrawerMode.Modal"> | |||||
| <MatDrawer @bind-Opened="@opened" Mode="@MatDrawerMode.Modal"> | |||||
| <MatList> | <MatList> | ||||
| <MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default"> | <MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default"> | ||||
| <MatListItem Class="@((Index == 1) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0" | |||||
| <MatListItem Class="@((index == 1) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0" | |||||
| Href="caritas_services" | Href="caritas_services" | ||||
| @onclick="@((e) => ButtonClicked(1))"> | @onclick="@((e) => ButtonClicked(1))"> | ||||
| <MatIcon Icon="@MatIconNames.Apps"></MatIcon> | <MatIcon Icon="@MatIconNames.Apps"></MatIcon> | ||||
| <MatListItemText Style="padding-left:0.5em">@i18n["CaritasServices"]</MatListItemText> | |||||
| <MatListItemText Style="padding-left:0.5em">@I18n["CaritasServices"]</MatListItemText> | |||||
| </MatListItem> | </MatListItem> | ||||
| </MatRipple> | </MatRipple> | ||||
| <MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default"> | <MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default"> | ||||
| <MatListItem Class="@((Index == 2) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0" | |||||
| <MatListItem Class="@((index == 2) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0" | |||||
| Href="account" | Href="account" | ||||
| @onclick="@((e) => ButtonClicked(2))"> | @onclick="@((e) => ButtonClicked(2))"> | ||||
| <MatIcon Icon="@MatIconNames.Person_outline"></MatIcon> | <MatIcon Icon="@MatIconNames.Person_outline"></MatIcon> | ||||
| <MatListItemText Style="padding-left:0.5em">@i18n["account"]</MatListItemText> | |||||
| <MatListItemText Style="padding-left:0.5em">@I18n["account"]</MatListItemText> | |||||
| </MatListItem> | </MatListItem> | ||||
| </MatRipple> | </MatRipple> | ||||
| <MatNavMenu @ref="extrasNavMenu"> | <MatNavMenu @ref="extrasNavMenu"> | ||||
| <MatNavSubMenu @bind-Expanded="@navSubMenuOpen"> | <MatNavSubMenu @bind-Expanded="@navSubMenuOpen"> | ||||
| <MatNavSubMenuHeader Title=@i18n["Extras"]> | |||||
| <MatNavSubMenuHeader Title=@I18n["Extras"]> | |||||
| <MatNavItem AllowSelection="false"> | <MatNavItem AllowSelection="false"> | ||||
| <MatIcon Icon="@MatIconNames.View_quilt" /> @i18n["Extras"] | |||||
| <MatIcon Icon="@MatIconNames.View_quilt" /> @I18n["Extras"] | |||||
| </MatNavItem> | </MatNavItem> | ||||
| </MatNavSubMenuHeader> | </MatNavSubMenuHeader> | ||||
| <MatNavSubMenuList> | <MatNavSubMenuList> | ||||
| <MatNavSubMenu> | <MatNavSubMenu> | ||||
| <MatNavSubMenuHeader> | <MatNavSubMenuHeader> | ||||
| <MatNavItem AllowSelection="false"> | <MatNavItem AllowSelection="false"> | ||||
| <MatIcon Icon="@MatIconNames.Directions_bike" /> @i18n["fundvelo/lost_found"] | |||||
| <MatIcon Icon="@MatIconNames.Directions_bike" /> @I18n["fundvelo/lost_found"] | |||||
| </MatNavItem> | </MatNavItem> | ||||
| </MatNavSubMenuHeader> | </MatNavSubMenuHeader> | ||||
| <MatNavSubMenuList> | <MatNavSubMenuList> | ||||
| <MatNavItem Href="fundvelo/history_found" AllowSelection="true" Class="@((Index == 3)? "selected": "")" @onclick="@((e) => ButtonClicked(3))"> | |||||
| <MatIcon Icon="@MatIconNames.History" /> @i18n["HistoryFound"] | |||||
| <MatNavItem Href="fundvelo/history_found" AllowSelection="true" Class="@((index == 3)? "selected": "")" @onclick="@((e) => ButtonClicked(3))"> | |||||
| <MatIcon Icon="@MatIconNames.History" /> @I18n["HistoryFound"] | |||||
| </MatNavItem> | </MatNavItem> | ||||
| <MatNavItem Href="fundvelo/history_missing" AllowSelection="true" Class="@((Index == 4)? "selected": "")" @onclick="@((e) => ButtonClicked(4))"> | |||||
| <MatIcon Icon="@MatIconNames.History" /> @i18n["HistoryMissing"] | |||||
| <MatNavItem Href="fundvelo/history_missing" AllowSelection="true" Class="@((index == 4)? "selected": "")" @onclick="@((e) => ButtonClicked(4))"> | |||||
| <MatIcon Icon="@MatIconNames.History" /> @I18n["HistoryMissing"] | |||||
| </MatNavItem> | </MatNavItem> | ||||
| </MatNavSubMenuList> | </MatNavSubMenuList> | ||||
| </MatNavSubMenu> | </MatNavSubMenu> | ||||
| </MatNavSubMenu> | </MatNavSubMenu> | ||||
| </MatNavMenu> | </MatNavMenu> | ||||
| <MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default"> | <MatRipple Class="navmenu-mat-ripple" Color="@MatRippleColor.Default"> | ||||
| <MatListItem Class="@((Index == 5) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0" | |||||
| <MatListItem Class="@((index == 5) ? "bg-primary-color text-white" : "")" Style="margin-left:0;margin-right:0" | |||||
| Href="info" | Href="info" | ||||
| @onclick="@((e) => ButtonClicked(5))"> | @onclick="@((e) => ButtonClicked(5))"> | ||||
| <MatIcon Icon="@MatIconNames.Error_outline" Style="transform: rotate(180deg)"></MatIcon> | <MatIcon Icon="@MatIconNames.Error_outline" Style="transform: rotate(180deg)"></MatIcon> | ||||
| <MatListItemText Style="padding-left:0.5em">@i18n["info"]</MatListItemText> | |||||
| <MatListItemText Style="padding-left:0.5em">@I18n["info"]</MatListItemText> | |||||
| </MatListItem> | </MatListItem> | ||||
| </MatRipple> | </MatRipple> | ||||
| </MatList> | </MatList> | ||||
| private MatNavMenu extrasNavMenu; | private MatNavMenu extrasNavMenu; | ||||
| private bool navSubMenuOpen = false; | private bool navSubMenuOpen = false; | ||||
| private bool Opened = false; | |||||
| private int Index = 1; | |||||
| private bool opened = false; | |||||
| private int index = 1; | |||||
| private string locUrl; | private string locUrl; | ||||
| private string LocationUrl { | private string LocationUrl { | ||||
| get => locUrl; | get => locUrl; | ||||
| AppState.OnChange += StateHasChanged; | AppState.OnChange += StateHasChanged; | ||||
| NavigationManager.LocationChanged += LocationChanged; | NavigationManager.LocationChanged += LocationChanged; | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| locUrl = i18n.GetString(NavigationManager.Uri.Replace(NavigationManager.BaseUri, "")); | |||||
| locUrl = I18n.GetString(NavigationManager.Uri.Replace(NavigationManager.BaseUri, "")); | |||||
| StateHasChanged(); | StateHasChanged(); | ||||
| } | } | ||||
| private void ButtonClicked() { | private void ButtonClicked() { | ||||
| Opened = !Opened; | |||||
| opened = !opened; | |||||
| } | } | ||||
| private void ButtonClicked(int _Index) { | private void ButtonClicked(int _Index) { | ||||
| Index = _Index; | |||||
| navSubMenuOpen = (Index == 3 || Index == 4); | |||||
| index = _Index; | |||||
| navSubMenuOpen = (index == 3 || index == 4); | |||||
| StateHasChanged(); | StateHasChanged(); | ||||
| ButtonClicked(); | ButtonClicked(); | ||||
| } | } | ||||
| private void LocationChanged(object sender, LocationChangedEventArgs e) { | private void LocationChanged(object sender, LocationChangedEventArgs e) { | ||||
| locUrl = i18n.GetString(e.Location.Replace(NavigationManager.BaseUri, "")); | |||||
| locUrl = I18n.GetString(e.Location.Replace(NavigationManager.BaseUri, "")); | |||||
| if (IsInServicesUrl(e.Location)) { | if (IsInServicesUrl(e.Location)) { | ||||
| Index = 1; | |||||
| index = 1; | |||||
| } else if (e.Location.Contains("account")) { | } else if (e.Location.Contains("account")) { | ||||
| Index = 2; | |||||
| index = 2; | |||||
| } else if (e.Location.Contains("history_found")) { | } else if (e.Location.Contains("history_found")) { | ||||
| Index = 3; | |||||
| index = 3; | |||||
| } else if (e.Location.Contains("history_missing")) { | } else if (e.Location.Contains("history_missing")) { | ||||
| Index = 4; | |||||
| index = 4; | |||||
| } else if (e.Location.Contains("info")) { | } else if (e.Location.Contains("info")) { | ||||
| Index = 5; | |||||
| index = 5; | |||||
| } else { | } else { | ||||
| Index = 0; | |||||
| index = 0; | |||||
| } | } | ||||
| StateHasChanged(); | StateHasChanged(); | ||||
| } | } | ||||
| return false; | return false; | ||||
| } else { | } else { | ||||
| if (IsInServicesUrl(delta)) { | if (IsInServicesUrl(delta)) { | ||||
| Index = 1; | |||||
| index = 1; | |||||
| } else if (delta.Equals("account")) { | } else if (delta.Equals("account")) { | ||||
| Index = 2; | |||||
| index = 2; | |||||
| } else if (delta.Equals("fundvelo/history_found")) { | } else if (delta.Equals("fundvelo/history_found")) { | ||||
| Index = 3; | |||||
| index = 3; | |||||
| } else if (delta.Equals("fundvelo/history_missing")) { | } else if (delta.Equals("fundvelo/history_missing")) { | ||||
| Index = 4; | |||||
| index = 4; | |||||
| } else if (delta.Equals("info")) { | } else if (delta.Equals("info")) { | ||||
| Index = 5; | |||||
| index = 5; | |||||
| } else { | } else { | ||||
| Index = 0; | |||||
| index = 0; | |||||
| } | } | ||||
| return true; | return true; | ||||
| } | } |
| private HttpClient httpClient; | private HttpClient httpClient; | ||||
| private IConfiguration configuration; | private IConfiguration configuration; | ||||
| private OnlineStatusProvider onlineStatusProvider; | |||||
| private ReportRepositoryService reportRepositoryService; | |||||
| private ReportDataProvider reportDataProvider; | |||||
| private readonly OnlineStatusProvider onlineStatusProvider; | |||||
| private readonly ReportRepositoryService reportRepositoryService; | |||||
| public BicycleRestService(ReportRepositoryService _reportRepositoryService, OnlineStatusProvider _onlineStatusProvider, | |||||
| ReportDataProvider _reportDataProvider) { | |||||
| public BicycleRestService(ReportRepositoryService _reportRepositoryService, OnlineStatusProvider _onlineStatusProvider) { | |||||
| this.reportRepositoryService = _reportRepositoryService; | this.reportRepositoryService = _reportRepositoryService; | ||||
| this.onlineStatusProvider = _onlineStatusProvider; | this.onlineStatusProvider = _onlineStatusProvider; | ||||
| this.reportDataProvider = _reportDataProvider; | |||||
| } | } | ||||
| public void Initialize(IConfiguration _configuration) { | public void Initialize(IConfiguration _configuration) { | ||||
| await reportRepositoryService.SaveReport(reportRepositoryItem); | await reportRepositoryService.SaveReport(reportRepositoryItem); | ||||
| return response; | return response; | ||||
| } | } | ||||
| } | } | ||||
| } | } |
| namespace cwebplusApp.Shared.Services { | namespace cwebplusApp.Shared.Services { | ||||
| public class MasterDataService { | public class MasterDataService { | ||||
| private readonly IBicycleRestService _bicycleRestService; | |||||
| private readonly IJSRuntime _jsRuntime; | |||||
| private readonly IStringLocalizer<Resources> _i18n; | |||||
| private readonly OnlineStatusProvider _onlineStatusProvider; | |||||
| private readonly IBicycleRestService bicycleRestService; | |||||
| private readonly IJSRuntime jsRuntime; | |||||
| private readonly IStringLocalizer<Resources> i18n; | |||||
| private readonly OnlineStatusProvider onlineStatusProvider; | |||||
| private const string KeyNameColors = "colors"; | private const string KeyNameColors = "colors"; | ||||
| private const string KeyNameBcTypes = "bicycleTypes"; | private const string KeyNameBcTypes = "bicycleTypes"; | ||||
| private const string KeyNameBrands = "brands"; | private const string KeyNameBrands = "brands"; | ||||
| private const string KeyNameSearchservices = "searchServices"; | private const string KeyNameSearchservices = "searchServices"; | ||||
| private bool _initializedColors; | |||||
| private bool _initializedBcTypes; | |||||
| private bool _initializedBrands; | |||||
| private bool _initializedSearchServices; | |||||
| private bool _firstActivation; | |||||
| public bool FirstActivation { get => _firstActivation; } | |||||
| private ColorItem[] _colors; | |||||
| private BicycleType[] _bicycleTypes; | |||||
| private Brand[] _brands; | |||||
| private SearchService[] _searchServices; | |||||
| private bool initializedColors; | |||||
| private bool initializedBcTypes; | |||||
| private bool initializedBrands; | |||||
| private bool initializedSearchServices; | |||||
| private bool firstActivation; | |||||
| public bool FirstActivation { get => firstActivation; } | |||||
| private ColorItem[] colors; | |||||
| private BicycleType[] bicycleTypes; | |||||
| private Brand[] brands; | |||||
| private SearchService[] searchServices; | |||||
| public ColorItem[] Colors { | public ColorItem[] Colors { | ||||
| get => _colors; | |||||
| get => this.colors; | |||||
| } | } | ||||
| public BicycleType[] BicycleTypes { | public BicycleType[] BicycleTypes { | ||||
| get => _bicycleTypes; | |||||
| get => this.bicycleTypes; | |||||
| } | } | ||||
| public Brand[] Brands { | public Brand[] Brands { | ||||
| get => _brands; | |||||
| get => this.brands; | |||||
| } | } | ||||
| public SearchService[] SearchServices { | public SearchService[] SearchServices { | ||||
| get => _searchServices; | |||||
| get => this.searchServices; | |||||
| } | } | ||||
| public event EventHandler Changed; | public event EventHandler Changed; | ||||
| public MasterDataService(IJSRuntime jsRuntime, IBicycleRestService bicycleRestService, IStringLocalizer<Resources> i18n, OnlineStatusProvider onlineStatusProvider) { | |||||
| _jsRuntime = jsRuntime; | |||||
| _bicycleRestService = bicycleRestService; | |||||
| _i18n = i18n; | |||||
| _onlineStatusProvider = onlineStatusProvider; | |||||
| _firstActivation = true; | |||||
| _brands = Defaults.GetBrandDefaults(_i18n).ToArray(); | |||||
| _colors = Defaults.GetColorDefaults(_i18n).ToArray(); | |||||
| _bicycleTypes = Defaults.GetBicycleTypeDefaults(_i18n).ToArray(); | |||||
| _searchServices = Defaults.GetSearchServiceDefaults(_i18n).ToArray(); | |||||
| public MasterDataService(IJSRuntime _jsRuntime, IBicycleRestService _bicycleRestService, IStringLocalizer<Resources> _i18n, OnlineStatusProvider _onlineStatusProvider) { | |||||
| this.jsRuntime = _jsRuntime; | |||||
| this.bicycleRestService = _bicycleRestService; | |||||
| this.i18n = _i18n; | |||||
| this.onlineStatusProvider = _onlineStatusProvider; | |||||
| this.firstActivation = true; | |||||
| this.brands = Defaults.GetBrandDefaults(i18n).ToArray(); | |||||
| this.colors = Defaults.GetColorDefaults(i18n).ToArray(); | |||||
| this.bicycleTypes = Defaults.GetBicycleTypeDefaults(i18n).ToArray(); | |||||
| this.searchServices = Defaults.GetSearchServiceDefaults(i18n).ToArray(); | |||||
| } | } | ||||
| public async Task SynchronizeMasterdata() { | public async Task SynchronizeMasterdata() { | ||||
| if (_onlineStatusProvider.Online) { | |||||
| if (onlineStatusProvider.Online) { | |||||
| try { | try { | ||||
| await SynchronizeColors(); | await SynchronizeColors(); | ||||
| await SynchronizeBcTypes(); | await SynchronizeBcTypes(); | ||||
| await SynchronizeBrands(); | await SynchronizeBrands(); | ||||
| await SynchronizeSearchServices(); | await SynchronizeSearchServices(); | ||||
| } finally { | } finally { | ||||
| _firstActivation = false; | |||||
| this.firstActivation = false; | |||||
| } | } | ||||
| } else { | } else { | ||||
| throw new Exception("No internet connection available!"); | throw new Exception("No internet connection available!"); | ||||
| } | } | ||||
| public async Task SynchronizeColors() { | public async Task SynchronizeColors() { | ||||
| ColorItem[] colors = (await _bicycleRestService.GetColors()).ToArray(); | |||||
| if (colors != null && colors.Length > 0) { | |||||
| _colors = colors; | |||||
| await SaveColorsToStorage(colors); | |||||
| ColorItem[] _colors = (await bicycleRestService.GetColors()).ToArray(); | |||||
| if (_colors != null && _colors.Length > 0) { | |||||
| this.colors = _colors; | |||||
| await SaveColorsToStorage(this.colors); | |||||
| }; | }; | ||||
| } | } | ||||
| public async Task SynchronizeBcTypes() { | public async Task SynchronizeBcTypes() { | ||||
| BicycleType[] bicycleTypes = (await _bicycleRestService.GetBicycleTypes()).ToArray(); | |||||
| if (bicycleTypes != null && bicycleTypes.Length > 0) { | |||||
| _bicycleTypes = bicycleTypes; | |||||
| await SaveBcTypesToStorage(bicycleTypes); | |||||
| BicycleType[] _bicycleTypes = (await bicycleRestService.GetBicycleTypes()).ToArray(); | |||||
| if (_bicycleTypes != null && _bicycleTypes.Length > 0) { | |||||
| this.bicycleTypes = _bicycleTypes; | |||||
| await SaveBcTypesToStorage(this.bicycleTypes); | |||||
| } | } | ||||
| } | } | ||||
| public async Task SynchronizeBrands() { | public async Task SynchronizeBrands() { | ||||
| Brand[] brands = (await _bicycleRestService.GetBrands()).ToArray(); | |||||
| if (brands != null && brands.Length > 0) { | |||||
| _brands = brands; | |||||
| await SaveBrandsToStorage(brands); | |||||
| Brand[] _brands = (await bicycleRestService.GetBrands()).ToArray(); | |||||
| if (_brands != null && _brands.Length > 0) { | |||||
| this.brands = _brands; | |||||
| await SaveBrandsToStorage(this.brands); | |||||
| } | } | ||||
| } | } | ||||
| public async Task SynchronizeSearchServices() { | public async Task SynchronizeSearchServices() { | ||||
| SearchService[] searchServices = (await _bicycleRestService.GetSearchServices()).ToArray(); | |||||
| if (searchServices != null && searchServices.Length > 0) { | |||||
| _searchServices = searchServices; | |||||
| await SaveSearchServicesToStorage(searchServices); | |||||
| SearchService[] _searchServices = (await bicycleRestService.GetSearchServices()).ToArray(); | |||||
| if (_searchServices != null && _searchServices.Length > 0) { | |||||
| this.searchServices = _searchServices; | |||||
| await SaveSearchServicesToStorage(this.searchServices); | |||||
| } | } | ||||
| } | } | ||||
| public async Task<ColorItem[]> GetColors() { | public async Task<ColorItem[]> GetColors() { | ||||
| ColorItem[] colors = await GetColorsFromStorage(); | |||||
| if (colors != null && colors.Length > 0) { | |||||
| _colors = colors; | |||||
| ColorItem[] _colors = await GetColorsFromStorage(); | |||||
| if (_colors != null && _colors.Length > 0) { | |||||
| this.colors = _colors; | |||||
| } | } | ||||
| _colors = SortColors(new List<ColorItem>(_colors)).ToArray(); | |||||
| this.colors = SortColors(new List<ColorItem>(this.colors)).ToArray(); | |||||
| return Colors; | return Colors; | ||||
| } | } | ||||
| public async Task<BicycleType[]> GetBicycleTypes() { | public async Task<BicycleType[]> GetBicycleTypes() { | ||||
| BicycleType[] bicycleTypes = await GetBicycleTypesFromStorage(); | |||||
| if (bicycleTypes != null && bicycleTypes.Length > 0) { | |||||
| _bicycleTypes = bicycleTypes; | |||||
| BicycleType[] _bicycleTypes = await GetBicycleTypesFromStorage(); | |||||
| if (_bicycleTypes != null && _bicycleTypes.Length > 0) { | |||||
| this.bicycleTypes = _bicycleTypes; | |||||
| } | } | ||||
| _bicycleTypes = SortBicycleTypes(new List<BicycleType>(_bicycleTypes)).ToArray(); | |||||
| this.bicycleTypes = SortBicycleTypes(new List<BicycleType>(this.bicycleTypes)).ToArray(); | |||||
| return BicycleTypes; | return BicycleTypes; | ||||
| } | } | ||||
| public async Task<Brand[]> GetBrands() { | public async Task<Brand[]> GetBrands() { | ||||
| Brand[] brands = await GetBrandsFromStorage(); | |||||
| if (brands != null && brands.Length > 0) { | |||||
| _brands = brands; | |||||
| Brand[] _brands = await GetBrandsFromStorage(); | |||||
| if (_brands != null && _brands.Length > 0) { | |||||
| this.brands = _brands; | |||||
| } | } | ||||
| _brands = SortBrands(new List<Brand>(_brands)).ToArray(); | |||||
| this.brands = SortBrands(new List<Brand>(this.brands)).ToArray(); | |||||
| return Brands; | return Brands; | ||||
| } | } | ||||
| public async Task<SearchService[]> GetSearchServices() { | public async Task<SearchService[]> GetSearchServices() { | ||||
| SearchService[] searchServices = await GetSearchServicesFromStorage(); | |||||
| if (searchServices != null && searchServices.Length > 0) { | |||||
| _searchServices = searchServices; | |||||
| SearchService[] _searchServices = await GetSearchServicesFromStorage(); | |||||
| if (_searchServices != null && _searchServices.Length > 0) { | |||||
| this.searchServices = _searchServices; | |||||
| } | } | ||||
| _searchServices = SortSearchServices(new List<SearchService>(_searchServices)).ToArray(); | |||||
| this.searchServices = SortSearchServices(new List<SearchService>(this.searchServices)).ToArray(); | |||||
| return SearchServices; | return SearchServices; | ||||
| } | } | ||||
| public void OnStorageUpdated(string key) { | public void OnStorageUpdated(string key) { | ||||
| // Reset the settings. The next call to Get will reload the data | // Reset the settings. The next call to Get will reload the data | ||||
| if (key == KeyNameColors) { | if (key == KeyNameColors) { | ||||
| _colors = null; | |||||
| this.colors = null; | |||||
| Changed?.Invoke(this, EventArgs.Empty); | Changed?.Invoke(this, EventArgs.Empty); | ||||
| } else if (key == KeyNameBcTypes) { | } else if (key == KeyNameBcTypes) { | ||||
| _bicycleTypes = null; | |||||
| this.bicycleTypes = null; | |||||
| Changed?.Invoke(this, EventArgs.Empty); | Changed?.Invoke(this, EventArgs.Empty); | ||||
| } else if (key == KeyNameBrands) { | } else if (key == KeyNameBrands) { | ||||
| _brands = null; | |||||
| this.brands = null; | |||||
| Changed?.Invoke(this, EventArgs.Empty); | Changed?.Invoke(this, EventArgs.Empty); | ||||
| } | } | ||||
| } | } | ||||
| // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | ||||
| // This way, you can reload the settings when another instance of the application (tab / window) save the settings | // This way, you can reload the settings when another instance of the application (tab / window) save the settings | ||||
| if (!_initializedColors) { | |||||
| if (!initializedColors) { | |||||
| // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | ||||
| var reference = DotNetObjectReference.Create(this); | var reference = DotNetObjectReference.Create(this); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| _initializedColors = true; | |||||
| await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| this.initializedColors = true; | |||||
| } | } | ||||
| // Read the JSON string that contains the data from the local storage | // Read the JSON string that contains the data from the local storage | ||||
| ColorItem[] result; | ColorItem[] result; | ||||
| var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameColors); | |||||
| var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameColors); | |||||
| if (String.IsNullOrEmpty(str)) { | if (String.IsNullOrEmpty(str)) { | ||||
| result = Array.Empty<ColorItem>(); | result = Array.Empty<ColorItem>(); | ||||
| } else { | } else { | ||||
| // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | ||||
| // This way, you can reload the settings when another instance of the application (tab / window) save the settings | // This way, you can reload the settings when another instance of the application (tab / window) save the settings | ||||
| if (!_initializedBcTypes) { | |||||
| if (!initializedBcTypes) { | |||||
| // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | ||||
| var reference = DotNetObjectReference.Create(this); | var reference = DotNetObjectReference.Create(this); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| _initializedBcTypes = true; | |||||
| await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| this.initializedBcTypes = true; | |||||
| } | } | ||||
| // Read the JSON string that contains the data from the local storage | // Read the JSON string that contains the data from the local storage | ||||
| BicycleType[] result; | BicycleType[] result; | ||||
| var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBcTypes); | |||||
| var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBcTypes); | |||||
| if (String.IsNullOrEmpty(str)) { | if (String.IsNullOrEmpty(str)) { | ||||
| result = Array.Empty<BicycleType>(); | result = Array.Empty<BicycleType>(); | ||||
| } else { | } else { | ||||
| // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | ||||
| // This way, you can reload the settings when another instance of the application (tab / window) save the settings | // This way, you can reload the settings when another instance of the application (tab / window) save the settings | ||||
| if (!_initializedBrands) { | |||||
| if (!initializedBrands) { | |||||
| // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | ||||
| var reference = DotNetObjectReference.Create(this); | var reference = DotNetObjectReference.Create(this); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| _initializedBrands = true; | |||||
| await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| this.initializedBrands = true; | |||||
| } | } | ||||
| // Read the JSON string that contains the data from the local storage | // Read the JSON string that contains the data from the local storage | ||||
| Brand[] result; | Brand[] result; | ||||
| var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBrands); | |||||
| var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBrands); | |||||
| if (String.IsNullOrEmpty(str)) { | if (String.IsNullOrEmpty(str)) { | ||||
| result = Array.Empty<Brand>(); | result = Array.Empty<Brand>(); | ||||
| } else { | } else { | ||||
| // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | ||||
| // This way, you can reload the settings when another instance of the application (tab / window) save the settings | // This way, you can reload the settings when another instance of the application (tab / window) save the settings | ||||
| if (!_initializedSearchServices) { | |||||
| if (!initializedSearchServices) { | |||||
| // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | ||||
| var reference = DotNetObjectReference.Create(this); | var reference = DotNetObjectReference.Create(this); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| _initializedSearchServices = true; | |||||
| await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| this.initializedSearchServices = true; | |||||
| } | } | ||||
| // Read the JSON string that contains the data from the local storage | // Read the JSON string that contains the data from the local storage | ||||
| SearchService[] result; | SearchService[] result; | ||||
| var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameSearchservices); | |||||
| var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameSearchservices); | |||||
| if (String.IsNullOrEmpty(str)) { | if (String.IsNullOrEmpty(str)) { | ||||
| result = Array.Empty<SearchService>(); | result = Array.Empty<SearchService>(); | ||||
| } else { | } else { | ||||
| private async Task SaveColorsToStorage(ColorItem[] colors) { | private async Task SaveColorsToStorage(ColorItem[] colors) { | ||||
| var json = JsonConvert.SerializeObject(colors); | var json = JsonConvert.SerializeObject(colors); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameColors, json); | |||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameColors, json); | |||||
| } | } | ||||
| private async Task SaveBcTypesToStorage(BicycleType[] bicycleTypes) { | private async Task SaveBcTypesToStorage(BicycleType[] bicycleTypes) { | ||||
| var json = JsonConvert.SerializeObject(bicycleTypes); | var json = JsonConvert.SerializeObject(bicycleTypes); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBcTypes, json); | |||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBcTypes, json); | |||||
| } | } | ||||
| private async Task SaveBrandsToStorage(Brand[] brands) { | private async Task SaveBrandsToStorage(Brand[] brands) { | ||||
| var json = JsonConvert.SerializeObject(brands); | var json = JsonConvert.SerializeObject(brands); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBrands, json); | |||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBrands, json); | |||||
| } | } | ||||
| private async Task SaveSearchServicesToStorage(SearchService[] searchServices) { | private async Task SaveSearchServicesToStorage(SearchService[] searchServices) { | ||||
| var json = JsonConvert.SerializeObject(searchServices); | var json = JsonConvert.SerializeObject(searchServices); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameSearchservices, json); | |||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameSearchservices, json); | |||||
| } | } | ||||
| private static List<ColorItem> SortColors(List<ColorItem> cols) { | |||||
| cols.Sort(delegate (ColorItem c1, ColorItem c2) { return c1.Id == 0 ? -1 : c2.Id == 0 ? 1 : c1.Bezeichnung.CompareTo(c2.Bezeichnung); }); | |||||
| return cols; | |||||
| private static List<ColorItem> SortColors(List<ColorItem> colors) { | |||||
| colors.Sort(delegate (ColorItem c1, ColorItem c2) { return c1.Id == 0 ? -1 : c2.Id == 0 ? 1 : c1.Bezeichnung.CompareTo(c2.Bezeichnung); }); | |||||
| return colors; | |||||
| } | } | ||||
| private static List<BicycleType> SortBicycleTypes(List<BicycleType> bcTypes) { | private static List<BicycleType> SortBicycleTypes(List<BicycleType> bcTypes) { |
| using cwebplusApp.Shared.Models; | using cwebplusApp.Shared.Models; | ||||
| using Microsoft.JSInterop; | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| private const string FoundReportRepository_Store_Name = "FoundReportRepositoryItems"; | private const string FoundReportRepository_Store_Name = "FoundReportRepositoryItems"; | ||||
| private const string MissingReportRepository_Store_Name = "MissingReportRepositoryItems"; | private const string MissingReportRepository_Store_Name = "MissingReportRepositoryItems"; | ||||
| private readonly IJSRuntime jsRuntime; | |||||
| private bool initialized; | |||||
| private readonly IndexedDBManager dbManager; | private readonly IndexedDBManager dbManager; | ||||
| public ReportRepositoryService(IJSRuntime jsRuntime, IndexedDBManager _dbManager) { | |||||
| this.jsRuntime = jsRuntime; | |||||
| public ReportRepositoryService(IndexedDBManager _dbManager) { | |||||
| this.dbManager = _dbManager; | this.dbManager = _dbManager; | ||||
| } | } | ||||
| private bool online; | private bool online; | ||||
| private HashSet<OnlineStatusChangeCallBack> OnlineStatusChangeCallBacks; | private HashSet<OnlineStatusChangeCallBack> OnlineStatusChangeCallBacks; | ||||
| public OnlineStatusProvider(IJSRuntime jSRuntime) { | |||||
| this.JSRuntime = jSRuntime; | |||||
| OnlineStatusChangeCallBacks = new(); | |||||
| public OnlineStatusProvider(IJSRuntime _jSRuntime) { | |||||
| this.JSRuntime = _jSRuntime; | |||||
| this.OnlineStatusChangeCallBacks = new(); | |||||
| var dotNetObjRef = DotNetObjectReference.Create(this); | var dotNetObjRef = DotNetObjectReference.Create(this); | ||||
| JSRuntime.InvokeVoidAsync("registerOnlineStatusHandler", dotNetObjRef); | JSRuntime.InvokeVoidAsync("registerOnlineStatusHandler", dotNetObjRef); | ||||
| } | } | ||||
| [JSInvokable] | [JSInvokable] | ||||
| public void SetOnlineStatus(bool isOnline) { | |||||
| this.online = isOnline; | |||||
| foreach (OnlineStatusChangeCallBack OnlineStatusCallBack in OnlineStatusChangeCallBacks) { | |||||
| OnlineStatusCallBack?.Invoke(isOnline); | |||||
| public void SetOnlineStatus(bool _online) { | |||||
| this.online = _online; | |||||
| foreach (OnlineStatusChangeCallBack OnlineStatusCallBack in this.OnlineStatusChangeCallBacks) { | |||||
| OnlineStatusCallBack?.Invoke(this.online); | |||||
| } | } | ||||
| } | } | ||||
| public void AddOnlineStatusChangeCallBack(OnlineStatusChangeCallBack listener) { | public void AddOnlineStatusChangeCallBack(OnlineStatusChangeCallBack listener) { | ||||
| OnlineStatusChangeCallBacks.Add(listener); | |||||
| this.OnlineStatusChangeCallBacks.Add(listener); | |||||
| } | } | ||||
| public void RemoveOnlineStatusChangeCallBack(OnlineStatusChangeCallBack listener) { | public void RemoveOnlineStatusChangeCallBack(OnlineStatusChangeCallBack listener) { | ||||
| OnlineStatusChangeCallBacks.Remove(listener); | |||||
| this.OnlineStatusChangeCallBacks.Remove(listener); | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| private readonly List<string> previousPages; | private readonly List<string> previousPages; | ||||
| private NavigationManager NavigationManager; | |||||
| private readonly NavigationManager navigationManager; | |||||
| public PageHistoryManager(NavigationManager NavigationManager) { | |||||
| public PageHistoryManager(NavigationManager _navigationManager) { | |||||
| previousPages = new List<string>(); | previousPages = new List<string>(); | ||||
| this.NavigationManager = NavigationManager; | |||||
| this.navigationManager = _navigationManager; | |||||
| } | } | ||||
| public void Reset() { | public void Reset() { | ||||
| public async void NavigateBack() { | public async void NavigateBack() { | ||||
| await FireOnBeforeNavigateBackEvent(); | await FireOnBeforeNavigateBackEvent(); | ||||
| NavigationManager.NavigateTo(GetPreviousPage()); | |||||
| navigationManager.NavigateTo(GetPreviousPage()); | |||||
| } | } | ||||
| protected async Task FireOnBeforeNavigateBackEvent() { | protected async Task FireOnBeforeNavigateBackEvent() { |
| } | } | ||||
| public void ShowSuccess(string title, string message, string icon = "") { | public void ShowSuccess(string title, string message, string icon = "") { | ||||
| matToaster.Add(message, MatBlazor.MatToastType.Success, title, icon); | |||||
| this.matToaster.Add(message, MatBlazor.MatToastType.Success, title, icon); | |||||
| } | } | ||||
| public void ShowInfo(string title, string message, string icon = "") { | public void ShowInfo(string title, string message, string icon = "") { | ||||
| matToaster.Add(message, MatBlazor.MatToastType.Info, title, icon); | |||||
| this.matToaster.Add(message, MatBlazor.MatToastType.Info, title, icon); | |||||
| } | } | ||||
| public void ShowWarning(string title, string message, string icon = "") { | public void ShowWarning(string title, string message, string icon = "") { | ||||
| matToaster.Add(message, MatBlazor.MatToastType.Warning, title, icon); | |||||
| this.matToaster.Add(message, MatBlazor.MatToastType.Warning, title, icon); | |||||
| } | } | ||||
| public void ShowError(string title, string message, string icon = "") { | public void ShowError(string title, string message, string icon = "") { | ||||
| matToaster.Add(message, MatBlazor.MatToastType.Danger, title, icon); | |||||
| this.matToaster.Add(message, MatBlazor.MatToastType.Danger, title, icon); | |||||
| } | } | ||||
| } | } | ||||
| namespace cwebplusApp.Shared.Services { | namespace cwebplusApp.Shared.Services { | ||||
| public sealed class UserDataProvider { | public sealed class UserDataProvider { | ||||
| public event EventHandler Changed; | |||||
| private const string KeyName = "account"; | private const string KeyName = "account"; | ||||
| private readonly IJSRuntime _jsRuntime; | |||||
| private bool _initialized; | |||||
| private readonly IJSRuntime jsRuntime; | |||||
| private bool initialized; | |||||
| public event EventHandler Changed; | |||||
| public UserDataProvider(IJSRuntime jsRuntime) { | |||||
| _jsRuntime = jsRuntime; | |||||
| public UserDataProvider(IJSRuntime _jsRuntime) { | |||||
| this.jsRuntime = _jsRuntime; | |||||
| } | } | ||||
| public async ValueTask<UserData> Get() { | public async ValueTask<UserData> Get() { | ||||
| // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | // Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed. | ||||
| // This way, you can reload the settings when another instance of the application (tab / window) save the settings | // This way, you can reload the settings when another instance of the application (tab / window) save the settings | ||||
| if (!_initialized) { | |||||
| if (!this.initialized) { | |||||
| // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | // Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated" | ||||
| var reference = DotNetObjectReference.Create(this); | var reference = DotNetObjectReference.Create(this); | ||||
| await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| _initialized = true; | |||||
| await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference); | |||||
| this.initialized = true; | |||||
| } | } | ||||
| // Read the JSON string that contains the data from the local storage | // Read the JSON string that contains the data from the local storage | ||||
| UserData result; | UserData result; | ||||
| var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyName); | |||||
| var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyName); | |||||
| if (str != null) { | if (str != null) { | ||||
| result = JsonConvert.DeserializeObject<UserData>(str) ?? new UserData(); | result = JsonConvert.DeserializeObject<UserData>(str) ?? new UserData(); | ||||
| } else { | } else { | ||||
| return result; | return result; | ||||
| } | } | ||||
| public async Task Save(UserData _data) { | |||||
| var json = JsonConvert.SerializeObject(_data); | |||||
| await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyName, json); | |||||
| public async Task Save(UserData data) { | |||||
| var json = JsonConvert.SerializeObject(data); | |||||
| await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyName, json); | |||||
| } | } | ||||
| // This method is called from BlazorRegisterStorageEvent when the storage changed | // This method is called from BlazorRegisterStorageEvent when the storage changed | ||||
| } | } | ||||
| } | } | ||||
| public static void mapUserData(UserData userData, Report report) { | |||||
| 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.Lastname = report.Nachname; | ||||
| userData.Phone = report.Telefon; | userData.Phone = report.Telefon; | ||||
| } | } | ||||
| public static void mapReport(Report report, UserData userData) { | |||||
| public static void MapReport(Report report, UserData userData) { | |||||
| report.Anrede = userData.Salutation; | report.Anrede = userData.Salutation; | ||||
| report.Vorname = userData.Firstname; | report.Vorname = userData.Firstname; | ||||
| report.Nachname = userData.Lastname; | report.Nachname = userData.Lastname; | ||||
| report.Telefon = userData.Phone; | report.Telefon = userData.Phone; | ||||
| } | } | ||||
| public static void mapReport(Report report, char Salutation, string Firstname, string Lastname, string Phone) { | |||||
| public static void MapReport(Report report, char Salutation, string Firstname, string Lastname, string Phone) { | |||||
| report.Anrede = new string(Salutation, 1); | report.Anrede = new string(Salutation, 1); | ||||
| report.Vorname = Firstname; | report.Vorname = Firstname; | ||||
| report.Nachname = Lastname; | report.Nachname = Lastname; | ||||
| report.Telefon = Phone; | report.Telefon = Phone; | ||||
| } | } | ||||
| public static void mapMissingReport(MissingReport report, UserData userData) { | |||||
| public static void MapMissingReport(MissingReport report, UserData userData) { | |||||
| report.Anrede = userData.Salutation; | report.Anrede = userData.Salutation; | ||||
| report.Vorname = userData.Firstname; | report.Vorname = userData.Firstname; | ||||
| report.Nachname = userData.Lastname; | report.Nachname = userData.Lastname; |