Sfoglia il codice sorgente

clean code and refactorings

master
Flo Smilari 4 anni fa
parent
commit
1b0889ca41

+ 18
- 19
Pages/AccountPage.razor Vedi File

@@ -6,7 +6,7 @@
@inject NavigationManager NavigationManager
@inject UserDataProvider UserDataProvider
@inject IStringLocalizer<Resources> i18n
@inject IStringLocalizer<Resources> I18n
@inject PageHistoryManager PageHistoryManager
@inject ReportDataProvider ReportDataProvider
@@ -15,41 +15,41 @@
<div class="row no-gutters align-items-start w-100">
<div class="row no-gutters align-items-center w-100" style="padding-top:2em">
<div class="col-12">
<MatSelect Class="w-100 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>
</div>
</div>
<div class="row no-gutters w-100">
<div class="col-6" style="padding-right:0.5em">
<MatStringField Class="w-100" Label="@i18n["Firstname"]" Outlined="true" type="text" @bind-Value="@Account.Firstname" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Firstname"]" Outlined="true" type="text" @bind-Value="@Account.Firstname" Required="true"></MatStringField>
</div>
<div class="col-6" style="padding-left:0.5em">
<MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Lastname"]" Outlined="true" type="text" @bind-Value="@Account.Lastname" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@i18n["Address"]" Outlined="true" type="text" @bind-Value="@Account.Address" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Address"]" Outlined="true" type="text" @bind-Value="@Account.Address" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-4" style="padding-right:0.5em">
<MatStringField Class="w-100" Label="@i18n["Zip"]" Outlined="true" type="text" @bind-Value="@Account.Zip" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Zip"]" Outlined="true" type="text" @bind-Value="@Account.Zip" Required="true"></MatStringField>
</div>
<div class="col-8" style="padding-left:0.5em">
<MatStringField Class="w-100" Label="@i18n["City"]" Outlined="true" type="text" @bind-Value="@Account.City" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["City"]" Outlined="true" type="text" @bind-Value="@Account.City" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@i18n["Phone"]" Outlined="true" type="text" @bind-Value="@Account.Phone" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Phone"]" Outlined="true" type="text" @bind-Value="@Account.Phone" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<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>
@@ -73,15 +73,15 @@
</div>
<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">
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton>
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
</div>
<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>
} else {
<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>
@@ -100,14 +100,14 @@
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
Account = await GetUserData();
if (!string.IsNullOrEmpty(FromRoute) && ReportDataProvider.Report != null) {
UserDataProvider.mapUserData(Account, ReportDataProvider.Report);
UserDataProvider.MapUserData(Account, ReportDataProvider.Report);
}
StateHasChanged();
}
private void OnBeforeNavigateBack() {
if (ReportDataProvider.Report != null) {
UserDataProvider.mapReport(ReportDataProvider.Report, Account);
UserDataProvider.MapReport(ReportDataProvider.Report, Account);
}
}
@@ -120,17 +120,16 @@
NavigationManager.NavigateTo("caritas_services");
}
private async Task<UserData> GetUserData() {
return await UserDataProvider.Get();
}
private void Next() {
if ("Found".Equals(FromRoute)) {
UserDataProvider.mapReport(ReportDataProvider.Report, Account);
UserDataProvider.MapReport(ReportDataProvider.Report, Account);
NavigationManager.NavigateTo("fundvelo/conclusion_found");
} else {
UserDataProvider.mapMissingReport(ReportDataProvider.GetMissingReport(), Account);
UserDataProvider.MapMissingReport(ReportDataProvider.GetMissingReport(), Account);
NavigationManager.NavigateTo("fundvelo/conclusion_missing");
}
}

+ 1
- 1
Pages/CaritasServicesPage.razor Vedi File

@@ -39,9 +39,9 @@
@code {
protected override void OnInitialized() {
base.OnInitialized();
PageHistoryManager.Reset();
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
base.OnInitialized();
}
private void FundVelo_LostFound() {

+ 17
- 17
Pages/Fundvelo/CaritasServiceFundVeloAlternatePickupContactPage.razor Vedi File

@@ -5,73 +5,73 @@
@inject NavigationManager NavigationManager
@inject UserDataProvider UserDataProvider
@inject IStringLocalizer<Resources> i18n
@inject IStringLocalizer<Resources> I18n
@inject PageHistoryManager PageHistoryManager
@inject ReportDataProvider ReportDataProvider
<div class="row px-3 h-100">
@*<div class="row no-gutters align-items-start justify-content-center w-100">
<MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@i18n["PickupContact"]</MatHeadline4>
<MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@I18n["PickupContact"]</MatHeadline4>
</div>*@
<div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em">
<h2>@i18n["PickupContact"]</h2>
<h2>@I18n["PickupContact"]</h2>
</div>
<div class="row no-gutters align-items-start w-100">
<div class="row no-gutters w-100">
<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>
</div>
</div>
<div class="row no-gutters w-100">
<div class="col-6" style="padding-right:0.5em">
<MatStringField Class="w-100" Label="@i18n["Firstname"]" Outlined="true" type="text" @bind-Value="pucFirstname" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Firstname"]" Outlined="true" type="text" @bind-Value="pucFirstname" Required="true"></MatStringField>
</div>
<div class="col-6" style="padding-left:0.5em">
<MatStringField Class="w-100" Label="@i18n["Lastname"]" Outlined="true" type="text" @bind-Value="pucLastname" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Lastname"]" Outlined="true" type="text" @bind-Value="pucLastname" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@i18n["Address"]" Outlined="true" type="text" @bind-Value="pucAddress" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Address"]" Outlined="true" type="text" @bind-Value="pucAddress" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-4" style="padding-right:0.5em">
<MatStringField Class="w-100" Label="@i18n["Zip"]" Outlined="true" type="text" @bind-Value="pucZip" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Zip"]" Outlined="true" type="text" @bind-Value="pucZip" Required="true"></MatStringField>
</div>
<div class="col-8" style="padding-left:0.5em">
<MatStringField Class="w-100" Label="@i18n["City"]" Outlined="true" type="text" @bind-Value="pucCity" Required="true"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["City"]" Outlined="true" type="text" @bind-Value="pucCity" Required="true"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@i18n["Mobile"]" Outlined="true" type="text" @bind-Value="pucMobile"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Mobile"]" Outlined="true" type="text" @bind-Value="pucMobile"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@i18n["Phone"]" Outlined="true" type="text" @bind-Value="pucPhone"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Phone"]" Outlined="true" type="text" @bind-Value="pucPhone"></MatStringField>
</div>
</div>
<div class="row no-gutters align-items-center w-100">
<div class="col-12">
<MatStringField Class="w-100" Label="@i18n["Mail"]" Outlined="true" type="text" @bind-Value="pucEmail"></MatStringField>
<MatStringField Class="w-100" Label="@I18n["Mail"]" Outlined="true" type="text" @bind-Value="pucEmail"></MatStringField>
</div>
</div>
</div>
<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">
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton>
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
</div>
<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>
@@ -89,7 +89,7 @@
private string pucPhone;
private string pucEmail;
protected async override void OnInitialized() {
protected override void OnInitialized() {
base.OnInitialized();
PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack);
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);

+ 9
- 9
Pages/Fundvelo/CaritasServiceFundVeloFoundConclusion.razor Vedi File

@@ -5,7 +5,7 @@
@using cwebplusApp.Components;
@inject NavigationManager NavigationManager;
@inject IStringLocalizer<Resources> i18n;
@inject IStringLocalizer<Resources> I18n;
@inject PageHistoryManager PageHistoryManager;
@inject ReportDataProvider ReportDataProvider;
@inject IBicycleRestService IBicycleRestService;
@@ -14,12 +14,12 @@
<div class="row px-3 h-100">
<div class="row no-gutters align-items-start justify-content-center w-100">
<MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@i18n["Confirmation"]</MatHeadline4>
<MatHeadline4 Style="font-family:Ubuntu;padding-top:1em">@I18n["Confirmation"]</MatHeadline4>
</div>
@if (ResponseStatus.OK == responseStatus) {
<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">
<MatHeadline6 Style="font-family:Ubuntu">@i18n["FinishedTextFound"]</MatHeadline6>
<MatHeadline6 Style="font-family:Ubuntu">@I18n["FinishedTextFound"]</MatHeadline6>
</div>
<div class="w-100" style="text-align: center">
<MatHeadline6 Style="font-family:Ubuntu">@referenceNumber</MatHeadline6>
@@ -32,7 +32,7 @@
<MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" />
</div>
<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>
} else {
if (ResponseStatus.OK == responseStatus) {
@@ -52,7 +52,7 @@
</div>
<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">
<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>
@@ -70,7 +70,7 @@
private ResponseStatus responseStatus = ResponseStatus.NoConnection;
private bool running = true;
private string referenceNumber;
ReportResponse response;
private ReportResponse response;
protected async override void OnInitialized() {
base.OnInitialized();
@@ -83,19 +83,19 @@
}
responseStatus = response==null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error;
} catch (HttpRequestException ex) {
response = new(i18n.GetString("FoundBike"), new string[] { ex.Message });
response = new(I18n.GetString("FoundBike"), new string[] { ex.Message });
responseStatus = ResponseStatus.Error;
}
running = false;
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] : "-";
PageHistoryManager.Reset();
} else if (ResponseStatus.Error == responseStatus) {
Toaster.ShowError(response.Message, response.GetDataAsFormattedList());
} 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();
}
StateHasChanged();

+ 16
- 16
Pages/Fundvelo/CaritasServiceFundVeloFoundKeyDataPage.razor Vedi File

@@ -10,7 +10,7 @@
@using System.IO;
@inject NavigationManager NavigationManager
@inject IStringLocalizer<Resources> i18n
@inject IStringLocalizer<Resources> I18n
@inject PageHistoryManager PageHistoryManager
@inject MasterDataService MasterDataService
@inject Toaster Toaster
@@ -20,7 +20,7 @@
<div class="row px-3 h-100">
<div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em">
<h2>@i18n["FoundBike"]</h2>
<h2>@I18n["FoundBike"]</h2>
</div>
<div class="row no-gutters align-items-center justify-content-center w-100">
@@ -107,13 +107,13 @@
<MatStringField Class="w-100 form-check-label" Label="@getAddressLbl()" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.Address"></MatStringField>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@i18n["PlaceOfDiscovery"]" Outlined="true" Required="true" type="text" @bind-Value="@bicycleGeoPosition.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 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 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>
@@ -121,7 +121,7 @@
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop">
<div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<MatSelectValue 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>
<div>
<span class="btn-sm" style="background-color:@context.Code;
@@ -135,7 +135,7 @@
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="outlined">
<MatAutocompleteList TItem="Brand" FullWidth="true" Label="@i18n["Brand"]" 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>
<div>
<span>@context?.Bezeichnung</span>
@@ -145,7 +145,7 @@
</div>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<MatSelectValue 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>
<div>
<span>@context?.Bezeichnung</span>
@@ -155,17 +155,17 @@
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text" @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 class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@i18n["Remark"]" Outlined="true" type="text" @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 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>
<MatCheckbox @bind-Value="@abholadresseIsNotContact" Label="@i18n["AlternatePickupContact"]"></MatCheckbox>
<MatCheckbox @bind-Value="@abholadresseIsNotContact" Label="@I18n["AlternatePickupContact"]"></MatCheckbox>
</div>
</div>
</div>
@@ -176,10 +176,10 @@
<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">
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton>
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
</div>
<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>
@@ -281,7 +281,7 @@
private string getAddressLbl() {
return i18n.GetString("Address") + " (" + i18n.GetString("PlaceOfDiscovery") + ")";
return I18n.GetString("Address") + " (" + I18n.GetString("PlaceOfDiscovery") + ")";
}
private async Task OnGatheringPicture(InputFileChangeEventArgs e) {
@@ -299,9 +299,9 @@
} catch (IOException ex) {
Console.WriteLine("Ex.Message is: {0}.", ex.Message);
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 {
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) {
Console.WriteLine("Ex.Message is: {0}.", ex.Message);

+ 2
- 3
Pages/Fundvelo/CaritasServiceFundVeloFoundKeyDataPage.razor.cs Vedi File

@@ -14,11 +14,11 @@ namespace cwebplusApp.Pages {
protected readonly LatLng center;
protected Map mapRef;
protected MapOptions mapOptions;
protected BicycleGeoPosition bicycleGeoPosition;
private Marker bicyclePositionMarker;
private MarkerOptions bicycleMarkerOptions;
private NominatimReverseAddress addressDto;
private Marker devicePositionMarker;
[Inject]
@@ -38,7 +38,6 @@ namespace cwebplusApp.Pages {
private NominatimService NominatimService { get; set; }
private NominatimReverseAddress addressDto;
public CaritasServiceFundVeloKeyDataPageBase() : base() {

+ 18
- 17
Pages/Fundvelo/CaritasServiceFundVeloHistoryPage.razor Vedi File

@@ -7,7 +7,7 @@
@inject PageHistoryManager PageHistoryManager
@inject ReportDataProvider ReportDataProvider
@inject ReportRepositoryService ReportRepositoryService
@inject IStringLocalizer<Resources> i18n;
@inject IStringLocalizer<Resources> I18n;
@inject Toaster Toaster;
@inject IMatDialogService MatDialogService;
@inject ScrollLockRemover ScrollLockRemover;
@@ -15,9 +15,9 @@
<div class="row px-3">
<div class="row no-gutters align-items-start justify-content-center w-100" style="padding-top:1em">
@if (FromRoute.Equals("history_found")) {
<h2>@i18n["HistoryFound"]</h2>
<h2>@I18n["HistoryFound"]</h2>
} else {
<h2>@i18n["HistoryMissing"]</h2>
<h2>@I18n["HistoryMissing"]</h2>
}
</div>
<div class="row no-gutters align-items-start w-100">
@@ -25,13 +25,13 @@
AllowSelection="true">
<MatTableHeader>
<th>Id</th>
<th>@i18n["Type"]</th>
<th>@i18n["Date"]</th>
<th>@I18n["Type"]</th>
<th>@I18n["Date"]</th>
@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>
<MatTableRow>
<td>@context.ID</td>
@@ -78,6 +78,7 @@
}
protected async override void OnParametersSet() {
base.OnParametersSet();
if (FromRoute.Equals("history_found")) {
transmittedReports.AddRange(await ReportRepositoryService.GetTransmittedFoundReports());
} else {
@@ -87,7 +88,7 @@
}
private string translateType(ReportRepositoryItem.Type type) {
return i18n.GetString("ReportType." + type);
return I18n.GetString("ReportType." + type);
}
private string getTypeBackgroundStyle(ReportRepositoryItem.Type type) {
@@ -119,26 +120,26 @@
}
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();
if (result.Equals(yes)) {
try {
await ReportRepositoryService.DeleteReport(item);
transmittedReports.Remove(item);
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) {
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() {
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();
if (result.Equals(yes)) {
foreach (ReportRepositoryItem item in transmittedReports) {

+ 2
- 2
Pages/Fundvelo/CaritasServiceFundVeloLostFoundPage.razor Vedi File

@@ -75,14 +75,14 @@
private async void Found() {
Report report = new FoundReport();
UserDataProvider.mapReport(report, await UserDataProvider.Get());
UserDataProvider.MapReport(report, await UserDataProvider.Get());
ReportDataProvider.Report = report;
NavigationManager.NavigateTo("fundvelo/keydata/Found");
}
private async void Missing() {
Report report = new MissingReport();
UserDataProvider.mapReport(report, await UserDataProvider.Get());
UserDataProvider.MapReport(report, await UserDataProvider.Get());
ReportDataProvider.Report = report;
NavigationManager.NavigateTo("fundvelo/keydata/Missing");
}

+ 21
- 21
Pages/Fundvelo/CaritasServiceFundVeloMissingConclusion.razor Vedi File

@@ -5,7 +5,7 @@
@using cwebplusApp.Components;
@inject NavigationManager NavigationManager;
@inject IStringLocalizer<Resources> i18n;
@inject IStringLocalizer<Resources> I18n;
@inject PageHistoryManager PageHistoryManager;
@inject ReportDataProvider ReportDataProvider;
@inject IBicycleRestService IBicycleRestService;
@@ -14,7 +14,7 @@
<div class="row px-3 h-100">
<div class="row no-gutters align-items-start justify-content-center w-100">
<MatHeadline4 Style="font-family:Ubuntu;padding-top:0.5em">@i18n["Info"]</MatHeadline4>
<MatHeadline4 Style="font-family:Ubuntu;padding-top:0.5em">@I18n["Info"]</MatHeadline4>
</div>
<div class="row no-gutters align-items-start justify-content-center w-100">
@if (running) {
@@ -22,23 +22,23 @@
<MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" />
</div>
<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>
} else {
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">
<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>
<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">
<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>
<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">
<MatIcon Style="padding-right:1rem">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
@@ -47,7 +47,7 @@
<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>
</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 class="w-100">
<MatIcon Style="padding-right:1rem">
@@ -57,7 +57,7 @@
<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>
</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 class="w-100">
<MatIcon Style="padding-right:1rem">
@@ -68,7 +68,7 @@
<circle cx="12" cy="9" r="2.5" />
</svg>
</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>
} else if (ResposeStatus.Error == responseStatus) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
@@ -83,7 +83,7 @@
</div>
<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">
<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>
@@ -91,7 +91,7 @@
@code {
enum ResposeStatus : ushort {
private enum ResposeStatus : ushort {
OK = 1,
Error = 10,
NoConnection = 20
@@ -99,7 +99,7 @@
private ResposeStatus responseStatus = ResposeStatus.NoConnection;
private bool running = true;
ReportResponse response;
private ReportResponse response;
protected async override void OnInitialized() {
base.OnInitialized();
@@ -112,18 +112,18 @@
}
responseStatus = response == null ? ResposeStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResposeStatus.OK : ResposeStatus.Error;
} catch (HttpRequestException ex) {
response = new(i18n.GetString("MissingBike"), new string[] { ex.Message });
response = new(I18n.GetString("MissingBike"), new string[] { ex.Message });
responseStatus = ResposeStatus.Error;
}
running = false;
if (ResposeStatus.OK == responseStatus) {
Toaster.ShowSuccess(i18n.GetString("MissingBike"), response.Message);
Toaster.ShowSuccess(I18n.GetString("MissingBike"), response.Message);
PageHistoryManager.Reset();
} else if (ResposeStatus.Error == responseStatus) {
Toaster.ShowError(response.Message, response.GetDataAsFormattedList());
} 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();
}
StateHasChanged();

+ 15
- 15
Pages/Fundvelo/CaritasServiceFundVeloMissingKeyDataPage.razor Vedi File

@@ -9,7 +9,7 @@
@using System.IO;
@inject NavigationManager NavigationManager
@inject IStringLocalizer<Resources> i18n
@inject IStringLocalizer<Resources> I18n
@inject PageHistoryManager PageHistoryManager
@inject MasterDataService MasterDataService
@inject Toaster Toaster
@@ -18,7 +18,7 @@
<div class="row px-3 h-100">
<div class="row no-gutters align-items-center justify-content-center w-100" style="padding-top:1em">
<h2>@i18n["MissingBike"]</h2>
<h2>@I18n["MissingBike"]</h2>
</div>
<div class="row no-gutters align-items-center justify-content-center w-100">
<div class="mat-layout-grid w-100">
@@ -70,7 +70,7 @@
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop">
<MatSelectValue 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>
<div>
<span class="btn-sm" style="background-color:@context.Code;
@@ -84,7 +84,7 @@
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop">
<div class="outlined">
<MatAutocompleteList TItem="Brand" FullWidth="true" Label="@i18n["Brand"]" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)" Required="true">
<MatAutocompleteList TItem="Brand" FullWidth="true" Label="@I18n["Brand"]" Items="@Brands" OnTextChanged="setBrandValue" @bind-Value="SelectedBrand" CustomStringSelector="@(i => i?.Bezeichnung)" Required="true">
<ItemTemplate>
<div>
<span>@context?.Bezeichnung</span>
@@ -94,7 +94,7 @@
</div>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop">
<MatSelectValue 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>
<div>
<span>@context?.Bezeichnung</span>
@@ -103,21 +103,21 @@
</MatSelectValue>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@i18n["FrameNumber"]" Outlined="true" type="text" @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 class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-8-tablet mat-layout-grid-cell-span-4-desktop">
<div class="mat-layout-grid-inner">
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<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 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 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>
<div>
<span>@context?.Bezeichnung</span>
@@ -126,12 +126,12 @@
</MatSelectValue>
</div>
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-4-phone mat-layout-grid-cell-span-4-tablet mat-layout-grid-cell-span-12-desktop">
<MatStringField Class="w-100 form-check-label" Label="@i18n["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 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>
@@ -141,10 +141,10 @@
<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">
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@i18n["Cancel"]</MatButton>
<MatButton Class="w-100" Outlined="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
</div>
<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>
@@ -250,9 +250,9 @@
} catch (IOException ex) {
Console.WriteLine("Ex.Message is: {0}.", ex.Message);
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 {
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) {
Console.WriteLine("Ex.Message is: {0}.", ex.Message);

+ 13
- 14
Pages/Fundvelo/CaritasServiceFundVeloPendingOverviewPage.razor Vedi File

@@ -7,25 +7,25 @@
@inject PageHistoryManager PageHistoryManager
@inject ReportDataProvider ReportDataProvider
@inject ReportRepositoryService ReportRepositoryService
@inject IStringLocalizer<Resources> i18n;
@inject IStringLocalizer<Resources> I18n;
@inject Toaster Toaster;
@inject IMatDialogService MatDialogService;
@inject ScrollLockRemover ScrollLockRemover;
<div class="row px-3">
<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 class="row no-gutters align-items-start w-100">
<MatTable RowClass="ReportRepositoryItem" Items="pendingReports" class="mat-elevation-z5" ShowPaging="false" UseSortHeaderRow="true"
OnRowDbClick="OnReportDblClicked" AllowSelection="true">
<MatTableHeader>
<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>
<MatTableRow>
<td style="display:inline-flex">
@@ -59,7 +59,6 @@
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
pendingReports.AddRange(await ReportRepositoryService.GetPendingFoundReports());
pendingReports.AddRange(await ReportRepositoryService.GetPendingMissingReports());
StateHasChanged();
}
@@ -74,7 +73,7 @@
}
private string translateType(ReportRepositoryItem.Type type) {
return i18n.GetString("ReportType." + type);
return I18n.GetString("ReportType." + type);
}
private string getTypeBackgroundStyle(ReportRepositoryItem.Type type) {
@@ -107,18 +106,18 @@
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();
if (result.Equals(yes)) {
try {
await ReportRepositoryService.DeleteReport(item);
pendingReports.Remove(item);
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) {
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));
}
}
}

+ 5
- 5
Pages/IndexPage.razor Vedi File

@@ -5,7 +5,7 @@
@inject NavigationManager NavigationManager;
@inject AppState AppState;
@inject IStringLocalizer<Resources> i18n
@inject IStringLocalizer<Resources> I18n
@inject PageHistoryManager PageHistoryManager
@inject MasterDataService MasterDataService;
@inject Toaster Toaster;
@@ -20,7 +20,7 @@
<div class="row align-items-end vw-100 h-50">
<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 class="row align-items-center justify-content-center vw-100 h-25">
@@ -29,7 +29,7 @@
<div style="width:48px;margin:0 auto;">
<MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" />
</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>
@@ -52,11 +52,11 @@
BicycleRestService.Initialize(Configuration);
await MasterDataService.SynchronizeMasterdata();
} 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();
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 {
showProgressCircle = false;

+ 5
- 9
Pages/InfoPage.razor Vedi File

@@ -5,7 +5,7 @@
@using System.Reflection;
@inject NavigationManager NavigationManager;
@inject IStringLocalizer<Resources> i18n
@inject IStringLocalizer<Resources> I18n
@inject PageHistoryManager PageHistoryManager
@inject IJSRuntime JSRuntime;
@@ -17,17 +17,17 @@
<table class="w-100">
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
</table>
@@ -36,7 +36,7 @@
<table class="w-100">
<tr>
<td class="text-right">
<MatCaption Style="font-family:Ubuntu">@i18n["DevelopedBy"]</MatCaption>
<MatCaption Style="font-family:Ubuntu">@I18n["DevelopedBy"]</MatCaption>
</td>
</tr>
<tr>
@@ -72,8 +72,4 @@
private async void ShowCaritasWebpage() {
await JSRuntime.InvokeAsync<string>("open", $"https://www.caritas.ch", "_blank", "noopener");
}
//private string GetAppVersion() {
// return i18n.GetString("App.version", new object[] { version });
//}
}

+ 0
- 1
Shared/Models/Fundvelo/FoundReportRepositoryItem.cs Vedi File

@@ -5,7 +5,6 @@
public FoundReport Report { get => report; set => report = value; }
public FoundReportRepositoryItem() : base(Type.FOUND, null) {
}
public FoundReportRepositoryItem(FoundReport _report, long identifier) : base(Type.FOUND, identifier) {

+ 1
- 1
Shared/Models/Fundvelo/MissingReport.cs Vedi File

@@ -17,7 +17,7 @@
}
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.Vorname = vorname;
this.Nachname = nachname;

+ 2
- 1
Shared/Models/Fundvelo/SearchService.cs Vedi File

@@ -4,7 +4,8 @@
public int Id { get; set; }
public string Bezeichnung { get; set; }
public SearchService() { }
public SearchService() {
}
public SearchService(int id, string type) {
Id = id;

+ 36
- 37
Shared/NavMenu.razor Vedi File

@@ -3,8 +3,8 @@
@inject AppState AppState;
@inject NavigationManager NavigationManager;
@inject IStringLocalizer<Resources> i18n
@inject IJSRuntime jsRuntime;
@inject IStringLocalizer<Resources> I18n
@inject IJSRuntime JSRuntime;
@inject PageHistoryManager PageHistoryManager;
@implements IDisposable;
@@ -23,50 +23,50 @@
<MatAppBarTitle Class="navBar-title">@LocationUrl</MatAppBarTitle>
</MatAppBarSection>
<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>
</MatAppBarRow>
</MatAppBar>
<MatAppBarContent>
<MatDrawerContainer>
<MatDrawer @bind-Opened="@Opened" Mode="@MatDrawerMode.Modal">
<MatDrawer @bind-Opened="@opened" Mode="@MatDrawerMode.Modal">
<MatList>
<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"
@onclick="@((e) => ButtonClicked(1))">
<MatIcon Icon="@MatIconNames.Apps"></MatIcon>
<MatListItemText Style="padding-left:0.5em">@i18n["CaritasServices"]</MatListItemText>
<MatListItemText Style="padding-left:0.5em">@I18n["CaritasServices"]</MatListItemText>
</MatListItem>
</MatRipple>
<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"
@onclick="@((e) => ButtonClicked(2))">
<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>
</MatRipple>
<MatNavMenu @ref="extrasNavMenu">
<MatNavSubMenu @bind-Expanded="@navSubMenuOpen">
<MatNavSubMenuHeader Title=@i18n["Extras"]>
<MatNavSubMenuHeader Title=@I18n["Extras"]>
<MatNavItem AllowSelection="false">
<MatIcon Icon="@MatIconNames.View_quilt" />&nbsp; @i18n["Extras"]
<MatIcon Icon="@MatIconNames.View_quilt" />&nbsp; @I18n["Extras"]
</MatNavItem>
</MatNavSubMenuHeader>
<MatNavSubMenuList>
<MatNavSubMenu>
<MatNavSubMenuHeader>
<MatNavItem AllowSelection="false">
<MatIcon Icon="@MatIconNames.Directions_bike" />&nbsp; @i18n["fundvelo/lost_found"]
<MatIcon Icon="@MatIconNames.Directions_bike" />&nbsp; @I18n["fundvelo/lost_found"]
</MatNavItem>
</MatNavSubMenuHeader>
<MatNavSubMenuList>
<MatNavItem Href="fundvelo/history_found" AllowSelection="true" Class="@((Index == 3)? "selected": "")" @onclick="@((e) => ButtonClicked(3))">
<MatIcon Icon="@MatIconNames.History" />&nbsp; @i18n["HistoryFound"]
<MatNavItem Href="fundvelo/history_found" AllowSelection="true" Class="@((index == 3)? "selected": "")" @onclick="@((e) => ButtonClicked(3))">
<MatIcon Icon="@MatIconNames.History" />&nbsp; @I18n["HistoryFound"]
</MatNavItem>
<MatNavItem Href="fundvelo/history_missing" AllowSelection="true" Class="@((Index == 4)? "selected": "")" @onclick="@((e) => ButtonClicked(4))">
<MatIcon Icon="@MatIconNames.History" />&nbsp; @i18n["HistoryMissing"]
<MatNavItem Href="fundvelo/history_missing" AllowSelection="true" Class="@((index == 4)? "selected": "")" @onclick="@((e) => ButtonClicked(4))">
<MatIcon Icon="@MatIconNames.History" />&nbsp; @I18n["HistoryMissing"]
</MatNavItem>
</MatNavSubMenuList>
</MatNavSubMenu>
@@ -74,11 +74,11 @@
</MatNavSubMenu>
</MatNavMenu>
<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"
@onclick="@((e) => ButtonClicked(5))">
<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>
</MatRipple>
</MatList>
@@ -95,9 +95,8 @@
private MatNavMenu extrasNavMenu;
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 LocationUrl {
get => locUrl;
@@ -117,17 +116,17 @@
AppState.OnChange += StateHasChanged;
NavigationManager.LocationChanged += LocationChanged;
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
locUrl = i18n.GetString(NavigationManager.Uri.Replace(NavigationManager.BaseUri, ""));
locUrl = I18n.GetString(NavigationManager.Uri.Replace(NavigationManager.BaseUri, ""));
StateHasChanged();
}
private void ButtonClicked() {
Opened = !Opened;
opened = !opened;
}
private void ButtonClicked(int _Index) {
Index = _Index;
navSubMenuOpen = (Index == 3 || Index == 4);
index = _Index;
navSubMenuOpen = (index == 3 || index == 4);
StateHasChanged();
ButtonClicked();
}
@@ -138,19 +137,19 @@
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)) {
Index = 1;
index = 1;
} else if (e.Location.Contains("account")) {
Index = 2;
index = 2;
} else if (e.Location.Contains("history_found")) {
Index = 3;
index = 3;
} else if (e.Location.Contains("history_missing")) {
Index = 4;
index = 4;
} else if (e.Location.Contains("info")) {
Index = 5;
index = 5;
} else {
Index = 0;
index = 0;
}
StateHasChanged();
}
@@ -169,17 +168,17 @@
return false;
} else {
if (IsInServicesUrl(delta)) {
Index = 1;
index = 1;
} else if (delta.Equals("account")) {
Index = 2;
index = 2;
} else if (delta.Equals("fundvelo/history_found")) {
Index = 3;
index = 3;
} else if (delta.Equals("fundvelo/history_missing")) {
Index = 4;
index = 4;
} else if (delta.Equals("info")) {
Index = 5;
index = 5;
} else {
Index = 0;
index = 0;
}
return true;
}

+ 3
- 8
Shared/Services/Fundvelo/BicycleRestService.cs Vedi File

@@ -18,15 +18,12 @@ namespace cwebplusApp.Shared.Services {
private HttpClient httpClient;
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.onlineStatusProvider = _onlineStatusProvider;
this.reportDataProvider = _reportDataProvider;
}
public void Initialize(IConfiguration _configuration) {
@@ -187,7 +184,5 @@ namespace cwebplusApp.Shared.Services {
await reportRepositoryService.SaveReport(reportRepositoryItem);
return response;
}
}
}

+ 88
- 88
Shared/Services/Fundvelo/MasterDataService.cs Vedi File

@@ -10,65 +10,65 @@ using System.Threading.Tasks;
namespace cwebplusApp.Shared.Services {
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 KeyNameBcTypes = "bicycleTypes";
private const string KeyNameBrands = "brands";
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 {
get => _colors;
get => this.colors;
}
public BicycleType[] BicycleTypes {
get => _bicycleTypes;
get => this.bicycleTypes;
}
public Brand[] Brands {
get => _brands;
get => this.brands;
}
public SearchService[] SearchServices {
get => _searchServices;
get => this.searchServices;
}
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() {
if (_onlineStatusProvider.Online) {
if (onlineStatusProvider.Online) {
try {
await SynchronizeColors();
await SynchronizeBcTypes();
await SynchronizeBrands();
await SynchronizeSearchServices();
} finally {
_firstActivation = false;
this.firstActivation = false;
}
} else {
throw new Exception("No internet connection available!");
@@ -76,70 +76,70 @@ namespace cwebplusApp.Shared.Services {
}
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() {
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() {
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() {
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() {
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;
}
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;
}
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;
}
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;
}
@@ -148,13 +148,13 @@ namespace cwebplusApp.Shared.Services {
public void OnStorageUpdated(string key) {
// Reset the settings. The next call to Get will reload the data
if (key == KeyNameColors) {
_colors = null;
this.colors = null;
Changed?.Invoke(this, EventArgs.Empty);
} else if (key == KeyNameBcTypes) {
_bicycleTypes = null;
this.bicycleTypes = null;
Changed?.Invoke(this, EventArgs.Empty);
} else if (key == KeyNameBrands) {
_brands = null;
this.brands = null;
Changed?.Invoke(this, EventArgs.Empty);
}
}
@@ -163,16 +163,16 @@ namespace cwebplusApp.Shared.Services {
// Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed.
// This way, you can reload the settings when another instance of the application (tab / window) save the settings
if (!_initializedColors) {
if (!initializedColors) {
// Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated"
var reference = DotNetObjectReference.Create(this);
await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
_initializedColors = true;
await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
this.initializedColors = true;
}
// Read the JSON string that contains the data from the local storage
ColorItem[] result;
var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameColors);
var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameColors);
if (String.IsNullOrEmpty(str)) {
result = Array.Empty<ColorItem>();
} else {
@@ -185,16 +185,16 @@ namespace cwebplusApp.Shared.Services {
// Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed.
// This way, you can reload the settings when another instance of the application (tab / window) save the settings
if (!_initializedBcTypes) {
if (!initializedBcTypes) {
// Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated"
var reference = DotNetObjectReference.Create(this);
await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
_initializedBcTypes = true;
await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
this.initializedBcTypes = true;
}
// Read the JSON string that contains the data from the local storage
BicycleType[] result;
var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBcTypes);
var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBcTypes);
if (String.IsNullOrEmpty(str)) {
result = Array.Empty<BicycleType>();
} else {
@@ -207,16 +207,16 @@ namespace cwebplusApp.Shared.Services {
// Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed.
// This way, you can reload the settings when another instance of the application (tab / window) save the settings
if (!_initializedBrands) {
if (!initializedBrands) {
// Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated"
var reference = DotNetObjectReference.Create(this);
await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
_initializedBrands = true;
await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
this.initializedBrands = true;
}
// Read the JSON string that contains the data from the local storage
Brand[] result;
var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBrands);
var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameBrands);
if (String.IsNullOrEmpty(str)) {
result = Array.Empty<Brand>();
} else {
@@ -229,16 +229,16 @@ namespace cwebplusApp.Shared.Services {
// Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed.
// This way, you can reload the settings when another instance of the application (tab / window) save the settings
if (!_initializedSearchServices) {
if (!initializedSearchServices) {
// Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated"
var reference = DotNetObjectReference.Create(this);
await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
_initializedSearchServices = true;
await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
this.initializedSearchServices = true;
}
// Read the JSON string that contains the data from the local storage
SearchService[] result;
var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameSearchservices);
var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyNameSearchservices);
if (String.IsNullOrEmpty(str)) {
result = Array.Empty<SearchService>();
} else {
@@ -250,27 +250,27 @@ namespace cwebplusApp.Shared.Services {
private async Task SaveColorsToStorage(ColorItem[] colors) {
var json = JsonConvert.SerializeObject(colors);
await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameColors, json);
await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameColors, json);
}
private async Task SaveBcTypesToStorage(BicycleType[] bicycleTypes) {
var json = JsonConvert.SerializeObject(bicycleTypes);
await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBcTypes, json);
await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBcTypes, json);
}
private async Task SaveBrandsToStorage(Brand[] brands) {
var json = JsonConvert.SerializeObject(brands);
await _jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBrands, json);
await jsRuntime.InvokeVoidAsync("BlazorSetLocalStorage", KeyNameBrands, json);
}
private async Task SaveSearchServicesToStorage(SearchService[] 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) {

+ 1
- 5
Shared/Services/Fundvelo/ReportRepositoryService.cs Vedi File

@@ -1,5 +1,4 @@
using cwebplusApp.Shared.Models;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -10,13 +9,10 @@ namespace cwebplusApp.Shared.Services {
private const string FoundReportRepository_Store_Name = "FoundReportRepositoryItems";
private const string MissingReportRepository_Store_Name = "MissingReportRepositoryItems";
private readonly IJSRuntime jsRuntime;
private bool initialized;
private readonly IndexedDBManager dbManager;
public ReportRepositoryService(IJSRuntime jsRuntime, IndexedDBManager _dbManager) {
this.jsRuntime = jsRuntime;
public ReportRepositoryService(IndexedDBManager _dbManager) {
this.dbManager = _dbManager;
}

+ 9
- 9
Shared/Services/OnlineStatusProvider.cs Vedi File

@@ -13,27 +13,27 @@ namespace cwebplusApp.Shared.Services {
private bool online;
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);
JSRuntime.InvokeVoidAsync("registerOnlineStatusHandler", dotNetObjRef);
}
[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) {
OnlineStatusChangeCallBacks.Add(listener);
this.OnlineStatusChangeCallBacks.Add(listener);
}
public void RemoveOnlineStatusChangeCallBack(OnlineStatusChangeCallBack listener) {
OnlineStatusChangeCallBacks.Remove(listener);
this.OnlineStatusChangeCallBacks.Remove(listener);
}
}
}

+ 4
- 4
Shared/Services/PageHistoryManager.cs Vedi File

@@ -10,11 +10,11 @@ namespace cwebplusApp.Shared.Services {
private readonly List<string> previousPages;
private NavigationManager NavigationManager;
private readonly NavigationManager navigationManager;
public PageHistoryManager(NavigationManager NavigationManager) {
public PageHistoryManager(NavigationManager _navigationManager) {
previousPages = new List<string>();
this.NavigationManager = NavigationManager;
this.navigationManager = _navigationManager;
}
public void Reset() {
@@ -44,7 +44,7 @@ namespace cwebplusApp.Shared.Services {
public async void NavigateBack() {
await FireOnBeforeNavigateBackEvent();
NavigationManager.NavigateTo(GetPreviousPage());
navigationManager.NavigateTo(GetPreviousPage());
}
protected async Task FireOnBeforeNavigateBackEvent() {

+ 4
- 4
Shared/Services/Toaster.cs Vedi File

@@ -10,20 +10,20 @@ namespace cwebplusApp.Shared.Services {
}
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 = "") {
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 = "") {
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 = "") {
matToaster.Add(message, MatBlazor.MatToastType.Danger, title, icon);
this.matToaster.Add(message, MatBlazor.MatToastType.Danger, title, icon);
}
}

+ 17
- 16
Shared/Services/UserDataProvider.cs Vedi File

@@ -7,30 +7,31 @@ using System.Threading.Tasks;
namespace cwebplusApp.Shared.Services {
public sealed class UserDataProvider {
public event EventHandler Changed;
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() {
// Register the Storage event handler. This handler calls OnStorageUpdated when the storage changed.
// This way, you can reload the settings when another instance of the application (tab / window) save the settings
if (!_initialized) {
if (!this.initialized) {
// Create a reference to the current object, so the JS function can call the public method "OnStorageUpdated"
var reference = DotNetObjectReference.Create(this);
await _jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
_initialized = true;
await jsRuntime.InvokeVoidAsync("BlazorRegisterStorageEvent", reference);
this.initialized = true;
}
// Read the JSON string that contains the data from the local storage
UserData result;
var str = await _jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyName);
var str = await jsRuntime.InvokeAsync<string>("BlazorGetLocalStorage", KeyName);
if (str != null) {
result = JsonConvert.DeserializeObject<UserData>(str) ?? new UserData();
} else {
@@ -39,9 +40,9 @@ namespace cwebplusApp.Shared.Services {
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
@@ -53,28 +54,28 @@ namespace cwebplusApp.Shared.Services {
}
}
public static void mapUserData(UserData userData, Report report) {
public static void MapUserData(UserData userData, Report report) {
userData.Salutation = report.Anrede;
userData.Firstname = report.Vorname;
userData.Lastname = report.Nachname;
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.Vorname = userData.Firstname;
report.Nachname = userData.Lastname;
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.Vorname = Firstname;
report.Nachname = Lastname;
report.Telefon = Phone;
}
public static void mapMissingReport(MissingReport report, UserData userData) {
public static void MapMissingReport(MissingReport report, UserData userData) {
report.Anrede = userData.Salutation;
report.Vorname = userData.Firstname;
report.Nachname = userData.Lastname;

Loading…
Annulla
Salva