diff --git a/Client/Modules/SZUAbsolventenverein.Module.PremiumArea/ApplicationList.razor b/Client/Modules/SZUAbsolventenverein.Module.PremiumArea/ApplicationList.razor index 8066fe5..f78f566 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.PremiumArea/ApplicationList.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.PremiumArea/ApplicationList.razor @@ -28,8 +28,30 @@
-
@(string.IsNullOrEmpty(app.Title) ? "Ingenieur-Antrag" : app.Title)
-
von @GetUserName(app.UserId)
+
+
@(string.IsNullOrEmpty(app.Title) ? "Ingenieur-Antrag" : app.Title)
+ @if (Oqtane.Security.UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin)) + { + @if (_confirmDeleteId == app.ApplicationId) + { +
+ + +
+ } + else + { + + } + } +
+
von @GetUserName(app.UserId)
@if (!string.IsNullOrEmpty(app.ShortDescription)) {

@app.ShortDescription

@@ -112,6 +134,7 @@ else private EngineerApplication _reportApp; private string _reportReason; private Dictionary _userNames = new(); + private int _confirmDeleteId = -1; protected override async Task OnInitializedAsync() { @@ -174,6 +197,22 @@ else } } + private async Task DeleteApp(EngineerApplication app) + { + try + { + await ApplicationService.DeleteApplicationAsync(app.ApplicationId, ModuleState.ModuleId); + _applications.Remove(app); + _confirmDeleteId = -1; + AddModuleMessage("Antrag erfolgreich gelöscht.", MessageType.Success); + } + catch (Exception ex) + { + AddModuleMessage("Fehler beim Löschen: " + ex.Message, MessageType.Error); + _confirmDeleteId = -1; + } + } + private string GetUserName(int userId) { return _userNames.TryGetValue(userId, out var name) ? name : $"Benutzer {userId}";