diff --git a/Wonky.Client/Pages/SupervisorDocumentListPage.razor b/Wonky.Client/Pages/SupervisorDocumentListPage.razor index be295bd0..0756377e 100644 --- a/Wonky.Client/Pages/SupervisorDocumentListPage.razor +++ b/Wonky.Client/Pages/SupervisorDocumentListPage.razor @@ -21,9 +21,14 @@ Support Dokumentation
-
+

Support Dokumentation

+
+ + + +
@@ -80,3 +85,7 @@ else {
Ingen data
} + + + + diff --git a/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs b/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs index dc9ff3d2..48d7ad39 100644 --- a/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs +++ b/Wonky.Client/Pages/SupervisorDocumentListPage.razor.cs @@ -17,6 +17,7 @@ using System.Text.Json; using Microsoft.AspNetCore.Components; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpRepository; +using Wonky.Client.Shared; using Wonky.Entity.DTO; using Wonky.Entity.Views; @@ -39,7 +40,8 @@ public partial class SupervisorDocumentListPage : IDisposable private List Documents { get; set; } = new(); private SupportAdvisorView Advisor { get; set; } = new(); private bool Working { get; set; } = true; - + private ConfirmActionModal _confirmDeleteDocuments = new(); + private string _deleteMessage = ""; protected override async Task OnInitializedAsync() { @@ -60,7 +62,23 @@ public partial class SupervisorDocumentListPage : IDisposable Working = false; } + + + private void ShowConfirmAction() + { + _deleteMessage = $"Bekræft sletning af dokumenter for {Advisor.FullName}. Handlinger kan ikke fortryders."; + _confirmDeleteDocuments.Show(); + } + + private async Task RemoveDocuments() + { + foreach (var document in Documents) + { + await DocumentRepo.DeleteDocument(document.DocumentId); + } + Documents.Clear(); + } public void Dispose() { diff --git a/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor b/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor index 54733e47..bbdec467 100644 --- a/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor +++ b/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor @@ -36,7 +36,7 @@
- +
@@ -89,4 +89,9 @@
- \ No newline at end of file + + + + + + diff --git a/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor.cs b/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor.cs index 2a49712f..d5e6348e 100644 --- a/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor.cs +++ b/Wonky.Client/Pages/SupervisorDocumentViewEditPage.razor.cs @@ -19,6 +19,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpRepository; +using Wonky.Client.Shared; using Wonky.Entity.DTO; namespace Wonky.Client.Pages; @@ -45,7 +46,10 @@ public partial class SupervisorDocumentViewEditPage : IDisposable private EditContext FormContext { get; set; } private SupportDocumentEditView Document { get; set; } = new(); private bool Working { get; set; } = true; + private ConfirmActionModal _confirmDeleteDocument = new(); + private string _deleteMessage = ""; + protected override async Task OnInitializedAsync() { Interceptor.RegisterEvent(); @@ -64,9 +68,15 @@ public partial class SupervisorDocumentViewEditPage : IDisposable } + private void ShowConfirmAction() + { + _deleteMessage = $"Bekræft sletning af dokument {Document.Description}. Handlingen kan ikke fortrydes."; + _confirmDeleteDocument.Show(); + } private async Task RemoveDocument() { + _confirmDeleteDocument.Hide(); Toaster.ShowInfo("Sletter Dokument"); await DocumentRepo.DeleteDocument(Document.DocumentId); Navigator.NavigateTo($"/supervisor/advisors/{AdvisorId}/documents");