diff --git a/Moonlight/Shared/Components/TicketPopup/TicketPopupOverview.razor b/Moonlight/Shared/Components/TicketPopup/TicketPopupOverview.razor index 98b16c1..735345f 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 diff --git a/Moonlight/Shared/Components/TicketPopup/TicketPopupView.razor b/Moonlight/Shared/Components/TicketPopup/TicketPopupView.razor index 56dc9d9..4875d6a 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(); }