| @@ -9,16 +9,31 @@ | |||
| @inject ReportDataProvider ReportDataProvider; | |||
| @inject ILFBicycleRest ILFBicycleRest; | |||
| @inject Toaster Toaster; | |||
| @inject AppState AppState; | |||
| <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> | |||
| </div> | |||
| <div class="row no-gutters align-items-start justify-content-center w-100"> | |||
| <MatHeadline6 Style="font-family:Ubuntu">@i18n["FinishedTextFound"]</MatHeadline6> | |||
| </div> | |||
| <div class="row no-gutters align-items-start justify-content-center w-100"> | |||
| @if (!running) { | |||
| @if (responseOk) { | |||
| <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> | |||
| </div> | |||
| <div class="w-100" style="text-align: center"> | |||
| <MatHeadline6 Style="font-family:Ubuntu">@referenceNumber</MatHeadline6> | |||
| </div> | |||
| </div> | |||
| } | |||
| <div class="row no-gutters align-items-start justify-content-center w-100" style="height:fit-content"> | |||
| @if (running) { | |||
| <div style="width:48px;margin:0 auto;"> | |||
| <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> | |||
| </div> | |||
| } else { | |||
| if (responseOk) { | |||
| <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> | |||
| <DoneImage></DoneImage> | |||
| @@ -43,20 +58,30 @@ | |||
| private Animate doneAnimZoom; | |||
| private bool responseOk = false; | |||
| private bool running = true; | |||
| private string referenceNumber; | |||
| ReportResponse response; | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| ReportResponse response = await ILFBicycleRest.SendFoundReport(ReportDataProvider.GetFoundReport()); | |||
| responseOk = System.Net.HttpStatusCode.OK == response.StatusCode ? true : false; | |||
| try { | |||
| response = await ILFBicycleRest.SendFoundReport(ReportDataProvider.GetFoundReport()); | |||
| responseOk = System.Net.HttpStatusCode.OK == response.StatusCode ? true : false; | |||
| } catch (HttpRequestException ex) { | |||
| response = new(i18n.GetString("FoundBike"), new string[] { ex.Message }); | |||
| responseOk = false; | |||
| } | |||
| running = false; | |||
| StateHasChanged(); | |||
| if(responseOk) { | |||
| if (responseOk) { | |||
| Toaster.ShowSuccess(i18n.GetString("FoundBike"), response.Message); | |||
| referenceNumber = (response.Data != null && response.Data.Length > 0) ? response.Data[0] : "-"; | |||
| PageHistoryManager.Reset(); | |||
| } else { | |||
| Toaster.ShowError(response.Message, response.GetDataAsFormattedList()); | |||
| } | |||
| StateHasChanged(); | |||
| AppState.NotifyChanged(); | |||
| } | |||
| private void Finished() { | |||
| @@ -9,7 +9,7 @@ using System; | |||
| using System.Threading.Tasks; | |||
| namespace cwebplusApp.Pages { | |||
| public partial class CaritasServiceFundVeloKeyDataPageBase : ComponentBase { | |||
| public class CaritasServiceFundVeloKeyDataPageBase : ComponentBase { | |||
| protected readonly LatLng center; | |||
| protected Map mapRef; | |||
| @@ -116,7 +116,7 @@ namespace cwebplusApp.Pages { | |||
| private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { | |||
| string country_code = addressDto.address.country_code; | |||
| string zip = SplitAndGetFirstPostcode(addressDto.address.postcode); | |||
| string town = addressDto.address.village ?? addressDto.address.town ?? addressDto.address.city; | |||
| string town = addressDto.address.city ?? addressDto.address.town ?? addressDto.address.village; | |||
| return !String.IsNullOrEmpty(country_code) ? country_code.ToUpper() + "-" + zip + " " + town : zip + " " + town; | |||
| } | |||
| @@ -134,7 +134,7 @@ namespace cwebplusApp.Pages { | |||
| addressDto = await NominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng); | |||
| if (addressDto != null) { | |||
| this.bicycleGeoPosition.Address = GetFormattedAddressStreet(addressDto); | |||
| this.bicycleGeoPosition.City = addressDto.address.village ?? addressDto.address.town ?? addressDto.address.city; | |||
| this.bicycleGeoPosition.City = addressDto.address.city ?? addressDto.address.town ?? addressDto.address.village; | |||
| this.bicycleGeoPosition.Zip = SplitAndGetFirstPostcode(addressDto.address.postcode); | |||
| this.bicycleGeoPosition.DisplayCity = GetFormattedAddressZipAndTown(addressDto); | |||
| } else { | |||
| @@ -1,6 +1,8 @@ | |||
| @page "/info" | |||
| @using cwebplusApp.Shared.Services; | |||
| @using System; | |||
| @using System.Reflection; | |||
| @inject NavigationManager NavigationManager; | |||
| @inject IStringLocalizer<Resources> i18n | |||
| @@ -25,7 +27,7 @@ | |||
| </tr> | |||
| <tr> | |||
| <td class="text-center"> | |||
| <MatCaption Style="font-family:Ubuntu">Version: 0.1.0</MatCaption> | |||
| <MatCaption Style="font-family:Ubuntu">@i18n["App.version", @version]</MatCaption> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| @@ -59,12 +61,19 @@ | |||
| @code { | |||
| private string version; | |||
| protected override void OnInitialized() { | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| version = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; | |||
| } | |||
| 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 }); | |||
| //} | |||
| } | |||
| @@ -15,6 +15,10 @@ namespace cwebplusApp.Shared { | |||
| } | |||
| } | |||
| public void NotifyChanged() { | |||
| NotifyStateChanged(); | |||
| } | |||
| private void NotifyStateChanged() => OnChange?.Invoke(); | |||
| } | |||
| } | |||
| @@ -7,10 +7,15 @@ namespace cwebplusApp.Shared.Models { | |||
| public string Message { get; set; } | |||
| public string[] Data { get; set; } | |||
| public ReportResponse(string message, string[] data) { | |||
| this.Message = message; | |||
| this.Data = data; | |||
| } | |||
| public string GetDataAsFormattedList() { | |||
| string result = ""; | |||
| foreach (string s in Data) { | |||
| result += s + '\r'+'\n'; | |||
| result += s + '\r' + '\n'; | |||
| } | |||
| return result; | |||
| } | |||
| @@ -1,9 +1,11 @@ | |||
| @using cwebplusApp.Shared.Services; | |||
| @inject AppState AppState; | |||
| @inject NavigationManager NavigationManager; | |||
| @inject IStringLocalizer<Resources> i18n | |||
| @inject IJSRuntime jsRuntime; | |||
| @inject PageHistoryManager PageHistoryManager; | |||
| @implements IDisposable; | |||
| @@ -132,6 +132,9 @@ | |||
| <data name="AlternatePickupContact" xml:space="preserve"> | |||
| <value>Abweichender Abholkontakt</value> | |||
| </data> | |||
| <data name="App.version" xml:space="preserve"> | |||
| <value>Version: {0}</value> | |||
| </data> | |||
| <data name="Bike.Child_Bycicle" xml:space="preserve"> | |||
| <value>Kindervelo</value> | |||
| </data> | |||
| @@ -289,7 +292,7 @@ | |||
| <value>Fertig</value> | |||
| </data> | |||
| <data name="FinishedTextFound" xml:space="preserve"> | |||
| <value>Hier kommen Informationen zum Ende des Gefunden-Meldeprozesses.</value> | |||
| <value>Meldenummer:</value> | |||
| </data> | |||
| <data name="FinishedTextMissing" xml:space="preserve"> | |||
| <value>Hier kommen Informationen zum Ende des Vermisst-Meldeprozesses.</value> | |||
| @@ -333,6 +336,9 @@ | |||
| <data name="Info.Masterdata.Initializing" xml:space="preserve"> | |||
| <value>Am Initialisieren...</value> | |||
| </data> | |||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | |||
| <value>Am Übertragen der Meldung...</value> | |||
| </data> | |||
| <data name="Lastname" xml:space="preserve"> | |||
| <value>Nachname</value> | |||
| </data> | |||
| @@ -132,6 +132,9 @@ | |||
| <data name="AlternatePickupContact" xml:space="preserve"> | |||
| <value>Contact de ramassage déviant</value> | |||
| </data> | |||
| <data name="App.version" xml:space="preserve"> | |||
| <value>Version: {0}</value> | |||
| </data> | |||
| <data name="Bike.Child_Bycicle" xml:space="preserve"> | |||
| <value>Vélo pour enfants</value> | |||
| </data> | |||
| @@ -289,7 +292,7 @@ | |||
| <value>Terminé</value> | |||
| </data> | |||
| <data name="FinishedTextFound" xml:space="preserve"> | |||
| <value>Voici l'information sur la fin du processus de déclaration de vélo découverte.</value> | |||
| <value>Numéro du rapport:</value> | |||
| </data> | |||
| <data name="FinishedTextMissing" xml:space="preserve"> | |||
| <value>Voici des informations sur la fin du processus de signalement de vélo disparus.</value> | |||
| @@ -333,6 +336,9 @@ | |||
| <data name="Info.Masterdata.Initializing" xml:space="preserve"> | |||
| <value>Initialisation...</value> | |||
| </data> | |||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | |||
| <value>Transmettant le rapport...</value> | |||
| </data> | |||
| <data name="Lastname" xml:space="preserve"> | |||
| <value>Nom de famille</value> | |||
| </data> | |||
| @@ -132,6 +132,9 @@ | |||
| <data name="AlternatePickupContact" xml:space="preserve"> | |||
| <value>Contatto di prelievo deviante</value> | |||
| </data> | |||
| <data name="App.version" xml:space="preserve"> | |||
| <value>Versione: {0}</value> | |||
| </data> | |||
| <data name="Bike.Child_Bycicle" xml:space="preserve"> | |||
| <value>Bicicletta per bambino</value> | |||
| </data> | |||
| @@ -289,7 +292,7 @@ | |||
| <value>Termina</value> | |||
| </data> | |||
| <data name="FinishedTextFound" xml:space="preserve"> | |||
| <value>Qui appariranno informazioni al termine del processo di "Bicicletta trovata " </value> | |||
| <value>Numero del rapporto:</value> | |||
| </data> | |||
| <data name="FinishedTextMissing" xml:space="preserve"> | |||
| <value>Qui appariranno informazioni al termine del processo di "Bicicletta dispersa"</value> | |||
| @@ -333,6 +336,9 @@ | |||
| <data name="Info.Masterdata.Initializing" xml:space="preserve"> | |||
| <value>Inizializzazione...</value> | |||
| </data> | |||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | |||
| <value>Trasmissione del rapporto...</value> | |||
| </data> | |||
| <data name="Lastname" xml:space="preserve"> | |||
| <value>Cognome</value> | |||
| </data> | |||
| @@ -132,6 +132,9 @@ | |||
| <data name="AlternatePickupContact" xml:space="preserve"> | |||
| <value>Alternate Pickup Contact</value> | |||
| </data> | |||
| <data name="App.version" xml:space="preserve"> | |||
| <value>Version: {0}</value> | |||
| </data> | |||
| <data name="Bike.Child_Bycicle" xml:space="preserve"> | |||
| <value>Children Bycicle</value> | |||
| </data> | |||
| @@ -289,7 +292,7 @@ | |||
| <value>Finished</value> | |||
| </data> | |||
| <data name="FinishedTextFound" xml:space="preserve"> | |||
| <value>Hier kommen Informationen zum Ende des Gefunden-Meldeprozesses.</value> | |||
| <value>Report number:</value> | |||
| </data> | |||
| <data name="FinishedTextMissing" xml:space="preserve"> | |||
| <value>Hier kommen Informationen zum Ende des Vermisst-Meldeprozesses.</value> | |||
| @@ -333,6 +336,9 @@ | |||
| <data name="Info.Masterdata.Initializing" xml:space="preserve"> | |||
| <value>Initializing...</value> | |||
| </data> | |||
| <data name="Info.Report.Transmitting" xml:space="preserve"> | |||
| <value>Transmitting report...</value> | |||
| </data> | |||
| <data name="Lastname" xml:space="preserve"> | |||
| <value>Last name</value> | |||
| </data> | |||
| @@ -10,7 +10,7 @@ | |||
| <PropertyGroup> | |||
| <TargetFramework>net5.0</TargetFramework> | |||
| <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest> | |||
| <Version>0.1.0</Version> | |||
| <Version>0.2.0</Version> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| @@ -5,5 +5,6 @@ | |||
| </PropertyGroup> | |||
| <PropertyGroup> | |||
| <ActiveDebugProfile>CaritasPWA</ActiveDebugProfile> | |||
| <NameOfLastUsedPublishProfile>D:\Work\Caritas\cwebplusApp\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | |||
| </PropertyGroup> | |||
| </Project> | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "name": "Caritas PWA", | |||
| "short_name": "CaritasPWA", | |||
| "name": "CwebPlusApp", | |||
| "short_name": "Cweb+ App", | |||
| "start_url": "./", | |||
| "display": "standalone", | |||
| "background_color": "#ffffff", | |||
| @@ -2,7 +2,7 @@ | |||
| // This is because caching would make development more difficult (changes would not | |||
| // be reflected on the first load after each change). | |||
| const staticCacheName = 'site-static-v1'; // IMPORTANT: CHANGE THE VERSION IN THIS NAME EVERY TIME THE APP IS DEPLOYED ON SERVER WITH CHANGES!!! | |||
| const staticCacheName = 'site-static-v-0-2-0'; // IMPORTANT: CHANGE THE VERSION IN THIS NAME EVERY TIME THE APP IS DEPLOYED ON SERVER WITH CHANGES!!! | |||
| const appsettings_url = 'appsettings.json'; | |||
| const assets = [ | |||
| './', | |||