瀏覽代碼

- Found report conclusion handling

- v 0.2.0
master
Flo Smilari 4 年之前
父節點
當前提交
9b4176a1d3

+ 34
- 9
Pages/CaritasServiceFundVeloFoundConclusion.razor 查看文件

@inject ReportDataProvider ReportDataProvider; @inject ReportDataProvider ReportDataProvider;
@inject ILFBicycleRest ILFBicycleRest; @inject ILFBicycleRest ILFBicycleRest;
@inject Toaster Toaster; @inject Toaster Toaster;
@inject AppState AppState;
<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>
<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) { if (responseOk) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)"> <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<DoneImage></DoneImage> <DoneImage></DoneImage>
private Animate doneAnimZoom; private Animate doneAnimZoom;
private bool responseOk = false; private bool responseOk = false;
private bool running = true; private bool running = true;
private string referenceNumber;
ReportResponse response;
protected async override void OnInitialized() { protected async override void OnInitialized() {
base.OnInitialized(); base.OnInitialized();
PageHistoryManager.AddPageToHistory(NavigationManager.Uri); 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; running = false;
StateHasChanged();
if(responseOk) {
if (responseOk) {
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 { } else {
Toaster.ShowError(response.Message, response.GetDataAsFormattedList()); Toaster.ShowError(response.Message, response.GetDataAsFormattedList());
} }
StateHasChanged();
AppState.NotifyChanged();
} }
private void Finished() { private void Finished() {

+ 3
- 3
Pages/CaritasServiceFundVeloFoundKeyDataPage.razor.cs 查看文件

using System.Threading.Tasks; using System.Threading.Tasks;
namespace cwebplusApp.Pages { namespace cwebplusApp.Pages {
public partial class CaritasServiceFundVeloKeyDataPageBase : ComponentBase {
public class CaritasServiceFundVeloKeyDataPageBase : ComponentBase {
protected readonly LatLng center; protected readonly LatLng center;
protected Map mapRef; protected Map mapRef;
private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) { private static string GetFormattedAddressZipAndTown(NominatimReverseAddress addressDto) {
string country_code = addressDto.address.country_code; string country_code = addressDto.address.country_code;
string zip = SplitAndGetFirstPostcode(addressDto.address.postcode); 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; return !String.IsNullOrEmpty(country_code) ? country_code.ToUpper() + "-" + zip + " " + town : zip + " " + town;
} }
addressDto = await NominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng); addressDto = await NominatimService.GetAddressForCoordinates(mouseEvent.LatLng.Lat, mouseEvent.LatLng.Lng);
if (addressDto != null) { if (addressDto != null) {
this.bicycleGeoPosition.Address = GetFormattedAddressStreet(addressDto); this.bicycleGeoPosition.Address = GetFormattedAddressStreet(addressDto);
this.bicycleGeoPosition.City = 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.Zip = SplitAndGetFirstPostcode(addressDto.address.postcode);
this.bicycleGeoPosition.DisplayCity = GetFormattedAddressZipAndTown(addressDto); this.bicycleGeoPosition.DisplayCity = GetFormattedAddressZipAndTown(addressDto);
} else { } else {

+ 11
- 2
Pages/InfoPage.razor 查看文件

@page "/info" @page "/info"
@using cwebplusApp.Shared.Services; @using cwebplusApp.Shared.Services;
@using System;
@using System.Reflection;
@inject NavigationManager NavigationManager; @inject NavigationManager NavigationManager;
@inject IStringLocalizer<Resources> i18n @inject IStringLocalizer<Resources> i18n
</tr> </tr>
<tr> <tr>
<td class="text-center"> <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> </td>
</tr> </tr>
</table> </table>
@code { @code {
private string version;
protected override void OnInitialized() { protected override void OnInitialized() {
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
base.OnInitialized(); base.OnInitialized();
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
version = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
} }
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 });
//}
} }

+ 4
- 0
Shared/AppState.cs 查看文件

} }
} }
public void NotifyChanged() {
NotifyStateChanged();
}
private void NotifyStateChanged() => OnChange?.Invoke(); private void NotifyStateChanged() => OnChange?.Invoke();
} }
} }

+ 6
- 1
Shared/Models/ReportResponse.cs 查看文件

public string Message { get; set; } public string Message { get; set; }
public string[] Data { get; set; } public string[] Data { get; set; }
public ReportResponse(string message, string[] data) {
this.Message = message;
this.Data = data;
}
public string GetDataAsFormattedList() { public string GetDataAsFormattedList() {
string result = ""; string result = "";
foreach (string s in Data) { foreach (string s in Data) {
result += s + '\r'+'\n';
result += s + '\r' + '\n';
} }
return result; return result;
} }

+ 2
- 0
Shared/NavMenu.razor 查看文件

@using cwebplusApp.Shared.Services; @using cwebplusApp.Shared.Services;
@inject AppState AppState; @inject AppState AppState;
@inject NavigationManager NavigationManager; @inject NavigationManager NavigationManager;
@inject IStringLocalizer<Resources> i18n @inject IStringLocalizer<Resources> i18n
@inject IJSRuntime jsRuntime; @inject IJSRuntime jsRuntime;
@inject PageHistoryManager PageHistoryManager; @inject PageHistoryManager PageHistoryManager;
@implements IDisposable; @implements IDisposable;

+ 7
- 1
Shared/ResourceFiles/Resources.de.resx 查看文件

<data name="AlternatePickupContact" xml:space="preserve"> <data name="AlternatePickupContact" xml:space="preserve">
<value>Abweichender Abholkontakt</value> <value>Abweichender Abholkontakt</value>
</data> </data>
<data name="App.version" xml:space="preserve">
<value>Version: {0}</value>
</data>
<data name="Bike.Child_Bycicle" xml:space="preserve"> <data name="Bike.Child_Bycicle" xml:space="preserve">
<value>Kindervelo</value> <value>Kindervelo</value>
</data> </data>
<value>Fertig</value> <value>Fertig</value>
</data> </data>
<data name="FinishedTextFound" xml:space="preserve"> <data name="FinishedTextFound" xml:space="preserve">
<value>Hier kommen Informationen zum Ende des Gefunden-Meldeprozesses.</value>
<value>Meldenummer:</value>
</data> </data>
<data name="FinishedTextMissing" xml:space="preserve"> <data name="FinishedTextMissing" xml:space="preserve">
<value>Hier kommen Informationen zum Ende des Vermisst-Meldeprozesses.</value> <value>Hier kommen Informationen zum Ende des Vermisst-Meldeprozesses.</value>
<data name="Info.Masterdata.Initializing" xml:space="preserve"> <data name="Info.Masterdata.Initializing" xml:space="preserve">
<value>Am Initialisieren...</value> <value>Am Initialisieren...</value>
</data> </data>
<data name="Info.Report.Transmitting" xml:space="preserve">
<value>Am Übertragen der Meldung...</value>
</data>
<data name="Lastname" xml:space="preserve"> <data name="Lastname" xml:space="preserve">
<value>Nachname</value> <value>Nachname</value>
</data> </data>

+ 7
- 1
Shared/ResourceFiles/Resources.fr.resx 查看文件

<data name="AlternatePickupContact" xml:space="preserve"> <data name="AlternatePickupContact" xml:space="preserve">
<value>Contact de ramassage déviant</value> <value>Contact de ramassage déviant</value>
</data> </data>
<data name="App.version" xml:space="preserve">
<value>Version: {0}</value>
</data>
<data name="Bike.Child_Bycicle" xml:space="preserve"> <data name="Bike.Child_Bycicle" xml:space="preserve">
<value>Vélo pour enfants</value> <value>Vélo pour enfants</value>
</data> </data>
<value>Terminé</value> <value>Terminé</value>
</data> </data>
<data name="FinishedTextFound" xml:space="preserve"> <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>
<data name="FinishedTextMissing" xml:space="preserve"> <data name="FinishedTextMissing" xml:space="preserve">
<value>Voici des informations sur la fin du processus de signalement de vélo disparus.</value> <value>Voici des informations sur la fin du processus de signalement de vélo disparus.</value>
<data name="Info.Masterdata.Initializing" xml:space="preserve"> <data name="Info.Masterdata.Initializing" xml:space="preserve">
<value>Initialisation...</value> <value>Initialisation...</value>
</data> </data>
<data name="Info.Report.Transmitting" xml:space="preserve">
<value>Transmettant le rapport...</value>
</data>
<data name="Lastname" xml:space="preserve"> <data name="Lastname" xml:space="preserve">
<value>Nom de famille</value> <value>Nom de famille</value>
</data> </data>

+ 7
- 1
Shared/ResourceFiles/Resources.it.resx 查看文件

<data name="AlternatePickupContact" xml:space="preserve"> <data name="AlternatePickupContact" xml:space="preserve">
<value>Contatto di prelievo deviante</value> <value>Contatto di prelievo deviante</value>
</data> </data>
<data name="App.version" xml:space="preserve">
<value>Versione: {0}</value>
</data>
<data name="Bike.Child_Bycicle" xml:space="preserve"> <data name="Bike.Child_Bycicle" xml:space="preserve">
<value>Bicicletta per bambino</value> <value>Bicicletta per bambino</value>
</data> </data>
<value>Termina</value> <value>Termina</value>
</data> </data>
<data name="FinishedTextFound" xml:space="preserve"> <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>
<data name="FinishedTextMissing" xml:space="preserve"> <data name="FinishedTextMissing" xml:space="preserve">
<value>Qui appariranno informazioni al termine del processo di "Bicicletta dispersa"</value> <value>Qui appariranno informazioni al termine del processo di "Bicicletta dispersa"</value>
<data name="Info.Masterdata.Initializing" xml:space="preserve"> <data name="Info.Masterdata.Initializing" xml:space="preserve">
<value>Inizializzazione...</value> <value>Inizializzazione...</value>
</data> </data>
<data name="Info.Report.Transmitting" xml:space="preserve">
<value>Trasmissione del rapporto...</value>
</data>
<data name="Lastname" xml:space="preserve"> <data name="Lastname" xml:space="preserve">
<value>Cognome</value> <value>Cognome</value>
</data> </data>

+ 7
- 1
Shared/ResourceFiles/Resources.resx 查看文件

<data name="AlternatePickupContact" xml:space="preserve"> <data name="AlternatePickupContact" xml:space="preserve">
<value>Alternate Pickup Contact</value> <value>Alternate Pickup Contact</value>
</data> </data>
<data name="App.version" xml:space="preserve">
<value>Version: {0}</value>
</data>
<data name="Bike.Child_Bycicle" xml:space="preserve"> <data name="Bike.Child_Bycicle" xml:space="preserve">
<value>Children Bycicle</value> <value>Children Bycicle</value>
</data> </data>
<value>Finished</value> <value>Finished</value>
</data> </data>
<data name="FinishedTextFound" xml:space="preserve"> <data name="FinishedTextFound" xml:space="preserve">
<value>Hier kommen Informationen zum Ende des Gefunden-Meldeprozesses.</value>
<value>Report number:</value>
</data> </data>
<data name="FinishedTextMissing" xml:space="preserve"> <data name="FinishedTextMissing" xml:space="preserve">
<value>Hier kommen Informationen zum Ende des Vermisst-Meldeprozesses.</value> <value>Hier kommen Informationen zum Ende des Vermisst-Meldeprozesses.</value>
<data name="Info.Masterdata.Initializing" xml:space="preserve"> <data name="Info.Masterdata.Initializing" xml:space="preserve">
<value>Initializing...</value> <value>Initializing...</value>
</data> </data>
<data name="Info.Report.Transmitting" xml:space="preserve">
<value>Transmitting report...</value>
</data>
<data name="Lastname" xml:space="preserve"> <data name="Lastname" xml:space="preserve">
<value>Last name</value> <value>Last name</value>
</data> </data>

+ 1
- 1
cwebplusApp.csproj 查看文件

<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest> <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<Version>0.1.0</Version>
<Version>0.2.0</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

+ 1
- 0
cwebplusApp.csproj.user 查看文件

</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ActiveDebugProfile>CaritasPWA</ActiveDebugProfile> <ActiveDebugProfile>CaritasPWA</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>D:\Work\Caritas\cwebplusApp\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

+ 2
- 2
wwwroot/manifest.json 查看文件

{ {
"name": "Caritas PWA",
"short_name": "CaritasPWA",
"name": "CwebPlusApp",
"short_name": "Cweb+ App",
"start_url": "./", "start_url": "./",
"display": "standalone", "display": "standalone",
"background_color": "#ffffff", "background_color": "#ffffff",

+ 1
- 1
wwwroot/service-worker.js 查看文件

// This is because caching would make development more difficult (changes would not // This is because caching would make development more difficult (changes would not
// be reflected on the first load after each change). // 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 appsettings_url = 'appsettings.json';
const assets = [ const assets = [
'./', './',

Loading…
取消
儲存