Merge pull request #353 from Moonlight-Panel/v2_ImproveTicketing
Improved ticketing
This commit is contained in:
commit
8d1cb47a8a
2 changed files with 49 additions and 16 deletions
|
@ -18,14 +18,24 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body pt-5">
|
<div class="card-body pt-5">
|
||||||
<div class="scroll-y me-n5 pe-5" style="height: 50vh; width: 40vh; display: flex; flex-direction: column;">
|
<div class="scroll-y me-n5 pe-5" style="height: 50vh; width: 40vh; display: flex; flex-direction: column;">
|
||||||
<div class="d-flex flex-stack py-2 justify-content-center">
|
<div class="d-flex flex-stack py-2">
|
||||||
<h3 class="align-middle text-center">Need help? Create a <a @onclick="() => TicketPopupMain.SetViewIndex(3)" @onclick:preventDefault href="#" class="text-primary">ticket</a></h3>
|
<div class="btn-group w-100">
|
||||||
|
<button class="btn btn-primary" type="button" @onclick="() => TicketPopupMain.SetViewIndex(3)">Create ticket</button>
|
||||||
|
@if (ViewClosed)
|
||||||
|
{
|
||||||
|
<button class="btn btn-success" type="button" @onclick="ToggleViewClosed">Open tickets</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-danger" type="button" @onclick="ToggleViewClosed">Closed tickets</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex flex-stack py-4">
|
<div class="d-flex flex-stack py-4">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LazyLoader Load="LoadTickets">
|
<LazyLoader @ref="LazyLoader" Load="LoadTickets">
|
||||||
@if (Tickets.Any())
|
@if (Tickets.Any())
|
||||||
{
|
{
|
||||||
foreach (var ticket in Tickets)
|
foreach (var ticket in Tickets)
|
||||||
|
@ -45,7 +55,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="text-center text-muted fs-5">No open tickets found</div>
|
<div class="text-center text-muted fs-5">No @(ViewClosed ? "closed" : "open") tickets found</div>
|
||||||
}
|
}
|
||||||
</LazyLoader>
|
</LazyLoader>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,16 +66,27 @@
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
public TicketPopupMain TicketPopupMain { get; set; }
|
public TicketPopupMain TicketPopupMain { get; set; }
|
||||||
|
|
||||||
|
private LazyLoader LazyLoader;
|
||||||
|
|
||||||
private Ticket[] Tickets;
|
private Ticket[] Tickets;
|
||||||
|
private bool ViewClosed = false;
|
||||||
|
|
||||||
private Task LoadTickets(LazyLoader _)
|
private Task LoadTickets(LazyLoader _)
|
||||||
{
|
{
|
||||||
Tickets = TicketRepository
|
Tickets = TicketRepository
|
||||||
.Get()
|
.Get()
|
||||||
.Where(x => x.Creator.Id == IdentityService.CurrentUser.Id)
|
.Where(x => x.Creator.Id == IdentityService.CurrentUser.Id)
|
||||||
.Where(x => x.Open)
|
.Where(x => x.Open == !ViewClosed)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task ToggleViewClosed()
|
||||||
|
{
|
||||||
|
ViewClosed = !ViewClosed;
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
|
||||||
|
await LazyLoader.Reload();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -66,19 +66,31 @@
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
@if (HasStarted && TicketService.Chat.Ticket.Open)
|
||||||
|
{
|
||||||
<textarea @bind="MessageContent" class="form-control form-control-solid-bg rounded-end me-3" placeholder="Type a message" style="height: 1vh"></textarea>
|
<textarea @bind="MessageContent" class="form-control form-control-solid-bg rounded-end me-3" placeholder="Type a message" style="height: 1vh"></textarea>
|
||||||
<ChatFileSelect @ref="FileSelect"/>
|
<ChatFileSelect @ref="FileSelect"/>
|
||||||
<WButton OnClick="SendMessage" CssClasses="ms-2 btn btn-icon btn-bg-light btn-color-white">
|
<WButton OnClick="SendMessage" CssClasses="ms-2 btn btn-icon btn-bg-light btn-color-white">
|
||||||
<i class="bx bx-sm bx-send"></i>
|
<i class="bx bx-sm bx-send"></i>
|
||||||
</WButton>
|
</WButton>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<textarea @bind="MessageContent" class="form-control form-control-solid-bg rounded-end me-3 disabled" disabled="disabled" placeholder="Type a message" style="height: 1vh"></textarea>
|
||||||
|
<label class="btn btn-icon btn-bg-light btn-color-primary rounded-start rounded-end disabled" disabled="">
|
||||||
|
<i class="bx bx-sm bx-upload"></i>
|
||||||
|
</label>
|
||||||
|
<button class="ms-2 btn btn-icon btn-bg-light btn-color-white disabled" disabled="disabled">
|
||||||
|
<i class="bx bx-sm bx-send"></i>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code
|
@code
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter] public TicketPopupMain TicketPopupMain { get; set; }
|
||||||
public TicketPopupMain TicketPopupMain { get; set; }
|
|
||||||
|
|
||||||
private bool HasStarted = false;
|
private bool HasStarted = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue