瀏覽代碼

- Validation of mandatory fields

- Back navigation on conclusion error
master
Flo Smilari 4 年之前
父節點
當前提交
d242aee068

+ 48
- 27
Pages/Fundvelo/CaritasServiceFundVeloFoundConclusion.razor 查看文件

@@ -26,35 +26,48 @@
</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 (ResponseStatus.OK == responseStatus) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<DoneImage></DoneImage>
</Animate>
} else if (ResponseStatus.Error == responseStatus) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<FailureImage></FailureImage>
</Animate>
<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 {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<WarningImage></WarningImage>
</Animate>
if (ResponseStatus.OK == responseStatus) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<DoneImage></DoneImage>
</Animate>
} else if (ResponseStatus.Error == responseStatus) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<FailureImage></FailureImage>
</Animate>
} else {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<WarningImage></WarningImage>
</Animate>
}
}
}
</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>
</div>
</div>
@if (!running) {
if (ResponseStatus.Error == responseStatus) {
<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="EditData">@I18n["EditData"]</MatButton>
</div>
<div class="col" style="padding-left:0.5em">
<MatButton Class="w-100" Raised="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
</div>
</div>
} else {
<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>
</div>
</div>
}
}
</div>
@@ -80,7 +93,7 @@
} else {
response = await IBicycleRestService.SendFoundReport(ReportDataProvider.Report);
}
responseStatus = response==null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error;
responseStatus = response == null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error;
} catch (HttpRequestException ex) {
response = new(I18n.GetString("FoundBike"), new string[] { ex.Message });
responseStatus = ResponseStatus.Error;
@@ -105,4 +118,12 @@
NavigationManager.NavigateTo("caritas_services");
}
private void Cancel() {
NavigationManager.NavigateTo("caritas_services");
}
private void EditData() {
NavigationManager.NavigateTo("/fundvelo/keydata/Found");
}
}

+ 34
- 13
Pages/Fundvelo/CaritasServiceFundVeloMissingConclusion.razor 查看文件

@@ -25,7 +25,7 @@
<h6 style="font-style:italic;padding-bottom:1em">@I18n["Info.Report.Transmitting"]</h6>
</div>
} else {
if (ResposeStatus.OK == responseStatus) {
if (ResponseStatus.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>
<ul class="w-100">
@@ -70,7 +70,7 @@
</MatIcon>
<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) {
} else if (ResponseStatus.Error == responseStatus) {
<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(2.5)">
<FailureImage></FailureImage>
</Animate>
@@ -81,23 +81,36 @@
}
}
</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>
</div>
</div>
@if (!running) {
if (ResponseStatus.Error == responseStatus) {
<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="EditData">@I18n["EditData"]</MatButton>
</div>
<div class="col" style="padding-left:0.5em">
<MatButton Class="w-100" Raised="true" @onclick="Cancel">@I18n["Cancel"]</MatButton>
</div>
</div>
} else {
<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>
</div>
</div>
}
}
</div>
@code {
private enum ResposeStatus : ushort {
enum ResponseStatus : ushort {
OK = 1,
Error = 10,
NoConnection = 20
}
private ResposeStatus responseStatus = ResposeStatus.NoConnection;
private ResponseStatus responseStatus = ResponseStatus.NoConnection;
private bool running = true;
private ReportResponse response;
@@ -109,17 +122,17 @@
} else {
response = await IBicycleRestService.SendMissingReport(ReportDataProvider.Report);
}
responseStatus = response == null ? ResposeStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResposeStatus.OK : ResposeStatus.Error;
responseStatus = response == null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error;
} catch (HttpRequestException ex) {
response = new(I18n.GetString("MissingBike"), new string[] { ex.Message });
responseStatus = ResposeStatus.Error;
responseStatus = ResponseStatus.Error;
}
running = false;
if (ResposeStatus.OK == responseStatus) {
if (ResponseStatus.OK == responseStatus) {
Toaster.ShowSuccess(I18n.GetString("MissingBike"), response.Message);
PageHistoryManager.Reset();
} else if (ResposeStatus.Error == responseStatus) {
} else if (ResponseStatus.Error == responseStatus) {
Toaster.ShowError(response.Message, response.GetDataAsFormattedList());
} else {
Toaster.ShowWarning(I18n.GetString("Warning.NoConnection.Title"), I18n.GetString("Warning.NoConnection.Msg"));
@@ -133,4 +146,12 @@
NavigationManager.NavigateTo("caritas_services");
}
private void Cancel() {
NavigationManager.NavigateTo("caritas_services");
}
private void EditData() {
NavigationManager.NavigateTo("/fundvelo/keydata/Missing");
}
}

+ 6
- 1
Pages/Fundvelo/CaritasServiceFundVeloMissingKeyDataPage.razor 查看文件

@@ -228,7 +228,12 @@
private void Next() {
updateDtoFromGUI();
PageHistoryManager.AddPageToHistory(NavigationManager.Uri);
NavigationManager.NavigateTo("fundvelo/account/Missing");
try {
Validator.ValidateMissingReportKeyData(ReportDataProvider.GetMissingReport());
NavigationManager.NavigateTo("fundvelo/account/Missing");
} catch (ArgumentException ex) {
Toaster.ShowWarning(I18n.GetString("Warning.MandatoryFields.Title"), I18n.GetString("Warning.MandatoryFields.Msg"));
}
}
private void Cancel() {

+ 3
- 0
Shared/ResourceFiles/Resources.de.resx 查看文件

@@ -285,6 +285,9 @@ Die KulturLegi wirkt dem entgegen indem sie Kultur-, Bildungs- und Sportangebote
<data name="DevelopedBy" xml:space="preserve">
<value>Entwickelt durch</value>
</data>
<data name="EditData" xml:space="preserve">
<value>Daten ändern</value>
</data>
<data name="Error.DeleteReport.Msg" xml:space="preserve">
<value>Die Meldung mit der ID {0:d} konnte nicht gelöscht werden!</value>
</data>

+ 3
- 0
Shared/ResourceFiles/Resources.fr.resx 查看文件

@@ -285,6 +285,9 @@ La KulturLegi s'attaque à ce problème en rendant les activités culturelles,
<data name="DevelopedBy" xml:space="preserve">
<value>Développé par</value>
</data>
<data name="EditData" xml:space="preserve">
<value>Changez data</value>
</data>
<data name="Error.DeleteReport.Msg" xml:space="preserve">
<value>Le rapport avec l'ID {0:d} n'a pas pu être supprimé !</value>
</data>

+ 3
- 0
Shared/ResourceFiles/Resources.it.resx 查看文件

@@ -285,6 +285,9 @@ La KulturLegi si oppone a questo rendendo le attività culturali, educative e sp
<data name="DevelopedBy" xml:space="preserve">
<value>Sviluppata da</value>
</data>
<data name="EditData" xml:space="preserve">
<value>Modifica dati</value>
</data>
<data name="Error.DeleteReport.Msg" xml:space="preserve">
<value>Il rapporto con ID {0:d} non può essere cancellato!</value>
</data>

+ 3
- 0
Shared/ResourceFiles/Resources.resx 查看文件

@@ -285,6 +285,9 @@ The KulturLegi counteracts this by making cultural, educational and sporting act
<data name="DevelopedBy" xml:space="preserve">
<value>Developed by</value>
</data>
<data name="EditData" xml:space="preserve">
<value>Edit data</value>
</data>
<data name="Error.DeleteReport.Msg" xml:space="preserve">
<value>The Report with ID {0:d} could not be deleted!</value>
</data>

+ 12
- 4
Shared/Services/Fundvelo/Validator.cs 查看文件

@@ -1,11 +1,8 @@
using cwebplusApp.Shared.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace cwebplusApp.Shared.Services {
public class Validator {
public static void ValidateFoundReportKeyData(FoundReport report) {
@@ -22,6 +19,17 @@ namespace cwebplusApp.Shared.Services {
}
}
public static void ValidateMissingReportKeyData(MissingReport report) {
int notValid = 0;
notValid += (report.FarbeId == null) ? 1 : 0;
notValid += (report.MarkeId == null && String.IsNullOrEmpty(report.NeueMarke)) ? 1 : 0;
notValid += (report.TypId == null) ? 1 : 0;
if (notValid > 0) {
throw new ArgumentException("ValidationException");
}
}
public static void ValidateAlternatePickContact(FoundReport report) {
if (!report.AbholadresseIstKontakt) {
int notValid = 0;

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

@@ -79,7 +79,7 @@ self.addEventListener('install', event => {
// activate event
self.addEventListener('activate', event => {
//delete any caches that aren't in expectedCaches
//which will get rid of site-static-v<n-1>
//which will get rid of site-static-v<old-version>
event.waitUntil(
caches.keys().then(keys => Promise.all(
keys.map(key => {

Loading…
取消
儲存