From a896b5839b21ee822c88789cc4a8a6e92febc7f4 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Mon, 15 May 2023 09:55:00 +0200 Subject: [PATCH] WIP --- .../Local.Services/AuthenticationService.cs | 9 ++++---- .../Pages/SupervisorDocumentListPage.razor | 21 +++++++++++++------ .../Pages/SupervisorDocumentListPage.razor.cs | 4 ++-- .../Pages/SupervisorDocumentNewPage.razor | 15 +++++++++++-- .../Pages/SupervisorDocumentNewPage.razor.cs | 9 ++++++++ .../SupervisorDocumentViewEditPage.razor | 14 ++++++------- Wonky.Client/wwwroot/appsettings.json | 2 +- 7 files changed, 51 insertions(+), 23 deletions(-) diff --git a/Wonky.Client/Local.Services/AuthenticationService.cs b/Wonky.Client/Local.Services/AuthenticationService.cs index 6ae84127..d6ac4408 100644 --- a/Wonky.Client/Local.Services/AuthenticationService.cs +++ b/Wonky.Client/Local.Services/AuthenticationService.cs @@ -137,10 +137,9 @@ public class AuthenticationService : IAuthenticationService { _client.DefaultRequestHeaders.Authorization = null; var profileBackup = await _preference.GetProfile(); - await Task.Delay(150); + var km = profileBackup.KmMorning; await _localStorage.ClearAsync(); - await Task.Delay(150); - await _preference.SetProfile(profileBackup); + await _preference.SetKmMorning(km); ((AuthStateProvider)_authStateProvider).NotifyUserLogout(); } @@ -148,9 +147,9 @@ public class AuthenticationService : IAuthenticationService { var response = await _client.GetAsync(_apiConfig.Value.UserInfoAuth).ConfigureAwait(true); var content = await response.Content.ReadAsStringAsync(); - var userInfo = JsonSerializer.Deserialize(content, _options); + var userInfo = JsonSerializer.Deserialize(content, _options) ?? new UserManagerEditView(); if(write) await _infoService.SetUserInfo(userInfo); - return userInfo ?? new UserManagerEditView(); + return userInfo; } } \ No newline at end of file diff --git a/Wonky.Client/Pages/SupervisorDocumentListPage.razor b/Wonky.Client/Pages/SupervisorDocumentListPage.razor index 2a011b7d..43257f4e 100644 --- a/Wonky.Client/Pages/SupervisorDocumentListPage.razor +++ b/Wonky.Client/Pages/SupervisorDocumentListPage.razor @@ -24,17 +24,26 @@

@Advisor.FullName

+ + +
+
+

Support Dokumentation

+
-
- -
-
-

Support Dokumentation

+
+
+
+
+ Loading... +
+
+
diff --git a/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs b/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs index 63717dc8..dc9ff3d2 100644 --- a/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs +++ b/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs @@ -38,7 +38,7 @@ public partial class SupervisorDocumentListPage : IDisposable // ######################################################### private List Documents { get; set; } = new(); private SupportAdvisorView Advisor { get; set; } = new(); - // private bool _working = true; + private bool Working { get; set; } = true; protected override async Task OnInitializedAsync() @@ -57,7 +57,7 @@ public partial class SupervisorDocumentListPage : IDisposable Logger.LogDebug("Documents => {}",JsonSerializer.Serialize(Documents)); - // _working = false; + Working = false; } diff --git a/Wonky.Client/Pages/SupervisorDocumentNewPage.razor b/Wonky.Client/Pages/SupervisorDocumentNewPage.razor index 368cc51d..c3224cf2 100644 --- a/Wonky.Client/Pages/SupervisorDocumentNewPage.razor +++ b/Wonky.Client/Pages/SupervisorDocumentNewPage.razor @@ -22,17 +22,28 @@ Support Dokumentation
-
+

@Document.AdvisorName

+
+
+
Support Dokumentation
+
+
+
+
+ Loading... +
+
+
+
-
diff --git a/Wonky.Client/Pages/SupervisorDocumentNewPage.razor.cs b/Wonky.Client/Pages/SupervisorDocumentNewPage.razor.cs index 852af9b5..4aec14f7 100644 --- a/Wonky.Client/Pages/SupervisorDocumentNewPage.razor.cs +++ b/Wonky.Client/Pages/SupervisorDocumentNewPage.razor.cs @@ -50,6 +50,7 @@ public partial class SupervisorDocumentNewPage : IDisposable private SupportDocumentEditView Document { get; set; } = new(); private DateTime DocumentDate { get; set; } = DateTime.Now; private bool FormInvalid { get; set; } = true; + private bool Working { get; set; } = true; protected override async Task OnInitializedAsync() { @@ -78,11 +79,18 @@ public partial class SupervisorDocumentNewPage : IDisposable Document.AdvisorId = Advisor.AdvisorId; Document.AdvisorName = Advisor.FullName; Document.CountryCode = Advisor.CountryCode; + Working = false; } private async Task SubmitDocument() { + if (Working) + { + return; + } + + Working = true; Document.DocumentDate = $"{DocumentDate:yyyy-MM-dd}"; Toaster.ShowInfo("Gemmer Evaluering"); Logger.LogDebug("Document => {}", JsonSerializer.Serialize(Document, new JsonSerializerOptions(JsonSerializerDefaults.Web))); @@ -97,6 +105,7 @@ public partial class SupervisorDocumentNewPage : IDisposable Navigator.NavigateTo($"/supervisor/advisors/{AdvisorId}/documents"); } Toaster.ClearAll(); + Working = false; } private void HandleFieldChanged(object sender, FieldChangedEventArgs e) diff --git a/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor b/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor index a4221f88..78fd1716 100644 --- a/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor +++ b/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor @@ -23,20 +23,20 @@

@Document.AdvisorName

+
+
+
+

Support Dokumentation

+
-
-
-
-

Support Dokumentation

-
-
+
-
+
Loading...
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index e6c17b19..f1d34fff 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "142.2", + "version": "142.3", "rc": true, "sandBox": true, "image": "grumpy-coder.png"