From f17ff9246dc67950a9bc8d53f6bab219aaff6140 Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Mon, 8 Jan 2024 08:32:39 +0100 Subject: [PATCH 1/2] Implemented input disable on closed tickets for users --- .../TicketPopup/TicketPopupView.razor | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/Moonlight/Shared/Components/TicketPopup/TicketPopupView.razor b/Moonlight/Shared/Components/TicketPopup/TicketPopupView.razor index 56dc9d99..4875d6a6 100644 --- a/Moonlight/Shared/Components/TicketPopup/TicketPopupView.razor +++ b/Moonlight/Shared/Components/TicketPopup/TicketPopupView.razor @@ -66,22 +66,34 @@ @code { - [CascadingParameter] - public TicketPopupMain TicketPopupMain { get; set; } + [CascadingParameter] public TicketPopupMain TicketPopupMain { get; set; } private bool HasStarted = false; - + private ChatFileSelect FileSelect; private string MessageContent = ""; @@ -89,11 +101,11 @@ { await lazyLoader.SetText("Starting chat client"); - // Initialize chat service and start it + // Initialize chat service and start it TicketService.Chat.OnUpdate = OnUpdate; await TicketService.Chat.Start(TicketPopupMain.CurrentTicket); - // Let the ui know that we are ready + // Let the ui know that we are ready HasStarted = true; await InvokeAsync(StateHasChanged); } @@ -119,7 +131,7 @@ string.IsNullOrEmpty(MessageContent) ? $"Upload of {FileSelect.SelectedFile.Name}" : MessageContent, FileSelect.SelectedFile.OpenReadStream(1024 * 1024 * 5), FileSelect.SelectedFile.Name - ); + ); await FileSelect.RemoveSelection(); } From 2510d6748c21c0ffa6ff253883d7ad013bb9f22f Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Mon, 8 Jan 2024 08:32:57 +0100 Subject: [PATCH 2/2] Implemented viewing of closed tickets for users --- .../TicketPopup/TicketPopupOverview.razor | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Moonlight/Shared/Components/TicketPopup/TicketPopupOverview.razor b/Moonlight/Shared/Components/TicketPopup/TicketPopupOverview.razor index 98b16c11..735345f8 100644 --- a/Moonlight/Shared/Components/TicketPopup/TicketPopupOverview.razor +++ b/Moonlight/Shared/Components/TicketPopup/TicketPopupOverview.razor @@ -18,14 +18,24 @@
-
-

Need help? Create a ticket

+
+
+ + @if (ViewClosed) + { + + } + else + { + + } +
- + @if (Tickets.Any()) { foreach (var ticket in Tickets) @@ -45,7 +55,7 @@ } else { -
No open tickets found
+
No @(ViewClosed ? "closed" : "open") tickets found
}
@@ -56,16 +66,27 @@ [CascadingParameter] public TicketPopupMain TicketPopupMain { get; set; } + private LazyLoader LazyLoader; + private Ticket[] Tickets; + private bool ViewClosed = false; private Task LoadTickets(LazyLoader _) { Tickets = TicketRepository .Get() .Where(x => x.Creator.Id == IdentityService.CurrentUser.Id) - .Where(x => x.Open) + .Where(x => x.Open == !ViewClosed) .ToArray(); return Task.CompletedTask; } + + private async Task ToggleViewClosed() + { + ViewClosed = !ViewClosed; + await InvokeAsync(StateHasChanged); + + await LazyLoader.Reload(); + } } \ No newline at end of file