Added ticket models. Did some ui
This commit is contained in:
parent
8c82631569
commit
4159170244
8 changed files with 208 additions and 136 deletions
|
@ -1,5 +1,6 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Moonlight.App.Database.Entities;
|
using Moonlight.App.Database.Entities;
|
||||||
|
using Moonlight.App.Database.Entities.Tickets;
|
||||||
using Moonlight.App.Services;
|
using Moonlight.App.Services;
|
||||||
|
|
||||||
namespace Moonlight.App.Database;
|
namespace Moonlight.App.Database;
|
||||||
|
@ -9,6 +10,8 @@ public class DataContext : DbContext
|
||||||
private readonly ConfigService ConfigService;
|
private readonly ConfigService ConfigService;
|
||||||
|
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<User> Users { get; set; }
|
||||||
|
//public DbSet<Ticket> Tickets { get; set; }
|
||||||
|
//public DbSet<TicketMessage> TicketMessages { get; set; }
|
||||||
|
|
||||||
public DataContext(ConfigService configService)
|
public DataContext(ConfigService configService)
|
||||||
{
|
{
|
||||||
|
|
18
Moonlight/App/Database/Entities/Tickets/Ticket.cs
Normal file
18
Moonlight/App/Database/Entities/Tickets/Ticket.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using Moonlight.App.Database.Enums;
|
||||||
|
|
||||||
|
namespace Moonlight.App.Database.Entities.Tickets;
|
||||||
|
|
||||||
|
public class Ticket
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public User Creator { get; set; }
|
||||||
|
public string Name { get; set; } = "";
|
||||||
|
public string Description { get; set; } = "";
|
||||||
|
public string Tries { get; set; } = "";
|
||||||
|
public TicketPriority Priority { get; set; } = TicketPriority.Low;
|
||||||
|
public bool Open { get; set; } = true;
|
||||||
|
|
||||||
|
public List<TicketMessage> Messages = new();
|
||||||
|
|
||||||
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||||
|
}
|
11
Moonlight/App/Database/Entities/Tickets/TicketMessage.cs
Normal file
11
Moonlight/App/Database/Entities/Tickets/TicketMessage.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
namespace Moonlight.App.Database.Entities.Tickets;
|
||||||
|
|
||||||
|
public class TicketMessage
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public User? Sender { get; set; }
|
||||||
|
public bool IsSupport { get; set; }
|
||||||
|
public string Content { get; set; } = "";
|
||||||
|
public string? Attachment { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
}
|
9
Moonlight/App/Database/Enums/TicketPriority.cs
Normal file
9
Moonlight/App/Database/Enums/TicketPriority.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Moonlight.App.Database.Enums;
|
||||||
|
|
||||||
|
public enum TicketPriority
|
||||||
|
{
|
||||||
|
Low,
|
||||||
|
Medium,
|
||||||
|
High,
|
||||||
|
Critical
|
||||||
|
}
|
|
@ -14,7 +14,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App\Database\Enums\" />
|
|
||||||
<Folder Include="App\Database\Migrations\" />
|
<Folder Include="App\Database\Migrations\" />
|
||||||
<Folder Include="App\Http\Middleware\" />
|
<Folder Include="App\Http\Middleware\" />
|
||||||
<Folder Include="App\Http\Requests\" />
|
<Folder Include="App\Http\Requests\" />
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
<div class="mb-4 me-4 d-flex justify-content-end fixed-bottom" style="pointer-events: none;">
|
|
||||||
@if (ShowLiveChat)
|
|
||||||
{
|
|
||||||
if (ShowChatsView)
|
|
||||||
{
|
|
||||||
<div class="card border border-2 border-primary" style="pointer-events: all">
|
|
||||||
<div class="card-header">
|
|
||||||
<span class="card-title fs-5">Chats</span>
|
|
||||||
<div class="card-toolbar">
|
|
||||||
<button @onclick="ToggleShow" class="btn btn-rounded-circle btn-icon">
|
|
||||||
<i class="bx bx-sm bx-x"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body pt-5">
|
|
||||||
<div class="scroll-y me-n5 pe-5" style="height: 50vh; width: 40vh; display: flex; flex-direction: column;">
|
|
||||||
<a href="#" @onclick="() => SetShowChats(false)" class="d-flex flex-stack py-4">
|
|
||||||
<div class="d-flex align-items-center">
|
|
||||||
<div class="symbol symbol-45px symbol-circle ">
|
|
||||||
<span class="symbol-label bg-light-danger text-danger fs-6 fw-bolder ">M</span>
|
|
||||||
</div>
|
|
||||||
<div class="ms-5">
|
|
||||||
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary mb-2">Melody Macy</a>
|
|
||||||
<div class="fw-semibold text-muted">melody@altbox.com</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex flex-column align-items-end ms-2">
|
|
||||||
<span class="text-muted fs-7 mb-1">2 weeks</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<div class="separator separator-dashed d-none"></div>
|
|
||||||
<div class="d-flex flex-stack py-4">
|
|
||||||
<div class="d-flex align-items-center">
|
|
||||||
<div class="symbol symbol-45px symbol-circle ">
|
|
||||||
<img alt="Pic" src="/metronic8/demo38/assets/media/avatars/300-1.jpg">
|
|
||||||
</div>
|
|
||||||
<div class="ms-5">
|
|
||||||
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary mb-2">Max Smith</a>
|
|
||||||
<div class="fw-semibold text-muted">max@kt.com</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex flex-column align-items-end ms-2">
|
|
||||||
<span class="text-muted fs-7 mb-1">1 day</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="card border border-2 border-primary" style="pointer-events: all">
|
|
||||||
<div class="card-header">
|
|
||||||
<span class="card-title fs-5">Some chat</span>
|
|
||||||
<div class="card-toolbar">
|
|
||||||
<button @onclick="() => SetShowChats(true)" class="btn btn-rounded-circle btn-icon">
|
|
||||||
<i class="bx bx-sm bx-chevron-left"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body bg-black">
|
|
||||||
<div class="scroll-y me-n5 pe-5" style="height: 50vh; width: 40vh; display: flex; flex-direction: column-reverse;">
|
|
||||||
@for (int i = 0; i < 9; i++)
|
|
||||||
{
|
|
||||||
<div class="d-flex justify-content-start mb-10 ">
|
|
||||||
<div class="d-flex flex-column align-items-start">
|
|
||||||
<div class="d-flex align-items-center mb-2">
|
|
||||||
<div class="symbol symbol-35px symbol-circle ">
|
|
||||||
<img alt="Pic" src="/metronic8/demo38/assets/media/avatars/300-25.jpg">
|
|
||||||
</div>
|
|
||||||
<div class="ms-3">
|
|
||||||
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary me-1">Brian Cox</a>
|
|
||||||
<span class="text-muted fs-7 mb-1">2 mins</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="p-5 rounded bg-light-info text-dark fw-semibold mw-lg-400px text-start" data-kt-element="message-text">
|
|
||||||
How likely are you to recommend our company to your friends and family ?
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex justify-content-end mb-10 ">
|
|
||||||
<div class="d-flex flex-column align-items-end">
|
|
||||||
<div class="d-flex align-items-center mb-2">
|
|
||||||
<div class="me-3">
|
|
||||||
<span class="text-muted fs-7 mb-1">5 mins</span>
|
|
||||||
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary ms-1">You</a>
|
|
||||||
</div>
|
|
||||||
<div class="symbol symbol-35px symbol-circle ">
|
|
||||||
<img alt="Pic" src="/metronic8/demo38/assets/media/avatars/300-1.jpg">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="p-5 rounded bg-light-primary text-dark fw-semibold mw-lg-400px text-end" data-kt-element="message-text">
|
|
||||||
Hey there, we’re just writing to let you know that you’ve been subscribed to a repository on GitHub.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control" placeholder="Type a message"/>
|
|
||||||
<button class="btn btn-secondary">Send</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<button @onclick="ToggleShow" class="btn btn-lg btn-icon btn-rounded-circle btn-white border border-primary" style="pointer-events: all">
|
|
||||||
<i class="bx bg-lg bx-chat"></i>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@code
|
|
||||||
{
|
|
||||||
private bool ShowLiveChat = false;
|
|
||||||
private bool ShowChatsView = true;
|
|
||||||
|
|
||||||
private async Task ToggleShow()
|
|
||||||
{
|
|
||||||
ShowLiveChat = !ShowLiveChat;
|
|
||||||
await InvokeAsync(StateHasChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SetShowChats(bool state)
|
|
||||||
{
|
|
||||||
ShowChatsView = state;
|
|
||||||
await InvokeAsync(StateHasChanged);
|
|
||||||
}
|
|
||||||
}
|
|
163
Moonlight/Shared/Components/Partials/LiveChat/LiveChatMain.razor
Normal file
163
Moonlight/Shared/Components/Partials/LiveChat/LiveChatMain.razor
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
<div class="mb-4 me-4 d-flex justify-content-end fixed-bottom" style="pointer-events: none;">
|
||||||
|
@if (ViewIndex == 1)
|
||||||
|
{
|
||||||
|
<div class="card border border-2 border-primary" style="pointer-events: all">
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-title fs-5">Chats</span>
|
||||||
|
<div class="card-toolbar">
|
||||||
|
<button @onclick="() => SetViewIndex(0)" class="btn btn-rounded-circle btn-icon">
|
||||||
|
<i class="bx bx-sm bx-x"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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="d-flex flex-stack py-4 justify-content-center">
|
||||||
|
<button @onclick="() => SetViewIndex(3)" class="btn btn-success">New ticket</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="#" @onclick="() => SetViewIndex(2)" class="d-flex flex-stack py-4">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="symbol symbol-45px symbol-circle ">
|
||||||
|
<span class="symbol-label bg-light-danger text-danger fs-6 fw-bolder ">M</span>
|
||||||
|
</div>
|
||||||
|
<div class="ms-5">
|
||||||
|
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary mb-2">Melody Macy</a>
|
||||||
|
<div class="fw-semibold text-muted">melody@altbox.com</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-column align-items-end ms-2">
|
||||||
|
<span class="text-muted fs-7 mb-1">2 weeks</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<div class="separator separator-dashed d-none"></div>
|
||||||
|
<div class="d-flex flex-stack py-4">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="symbol symbol-45px symbol-circle ">
|
||||||
|
<img alt="Pic" src="/metronic8/demo38/assets/media/avatars/300-1.jpg">
|
||||||
|
</div>
|
||||||
|
<div class="ms-5">
|
||||||
|
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary mb-2">Max Smith</a>
|
||||||
|
<div class="fw-semibold text-muted">max@kt.com</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-column align-items-end ms-2">
|
||||||
|
<span class="text-muted fs-7 mb-1">1 day</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (ViewIndex == 2)
|
||||||
|
{
|
||||||
|
<div class="card border border-2 border-primary" style="pointer-events: all">
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-title fs-5">Some chat</span>
|
||||||
|
<div class="card-toolbar">
|
||||||
|
<button @onclick="() => SetViewIndex(1)" class="btn btn-rounded-circle btn-icon">
|
||||||
|
<i class="bx bx-sm bx-chevron-left"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body bg-black">
|
||||||
|
<div class="scroll-y me-n5 pe-5" style="height: 50vh; width: 40vh; display: flex; flex-direction: column-reverse;">
|
||||||
|
@for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
<div class="d-flex justify-content-start mb-10 ">
|
||||||
|
<div class="d-flex flex-column align-items-start">
|
||||||
|
<div class="d-flex align-items-center mb-2">
|
||||||
|
<div class="symbol symbol-35px symbol-circle ">
|
||||||
|
<img alt="Pic" src="/metronic8/demo38/assets/media/avatars/300-25.jpg">
|
||||||
|
</div>
|
||||||
|
<div class="ms-3">
|
||||||
|
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary me-1">Brian Cox</a>
|
||||||
|
<span class="text-muted fs-7 mb-1">2 mins</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-5 rounded bg-light-info text-dark fw-semibold mw-lg-400px text-start" data-kt-element="message-text">
|
||||||
|
How likely are you to recommend our company to your friends and family ?
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end mb-10 ">
|
||||||
|
<div class="d-flex flex-column align-items-end">
|
||||||
|
<div class="d-flex align-items-center mb-2">
|
||||||
|
<div class="me-3">
|
||||||
|
<span class="text-muted fs-7 mb-1">5 mins</span>
|
||||||
|
<a href="#" class="fs-5 fw-bold text-gray-900 text-hover-primary ms-1">You</a>
|
||||||
|
</div>
|
||||||
|
<div class="symbol symbol-35px symbol-circle ">
|
||||||
|
<img alt="Pic" src="/metronic8/demo38/assets/media/avatars/300-1.jpg">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-5 rounded bg-light-primary text-dark fw-semibold mw-lg-400px text-end" data-kt-element="message-text">
|
||||||
|
Hey there, we’re just writing to let you know that you’ve been subscribed to a repository on GitHub.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="input-group">
|
||||||
|
<input class="form-control" placeholder="Type a message"/>
|
||||||
|
<button class="btn btn-secondary">Send</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (ViewIndex == 3)
|
||||||
|
{
|
||||||
|
<div class="card border border-2 border-primary p-5" style="pointer-events: all">
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-title fs-5">Create ticket</span>
|
||||||
|
<div class="card-toolbar">
|
||||||
|
<button @onclick="() => SetViewIndex(1)" class="btn btn-rounded-circle btn-icon">
|
||||||
|
<i class="bx bx-sm bx-chevron-left"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body" style="width: 40vh;">
|
||||||
|
<div class="mb-5">
|
||||||
|
<label class="form-label">Name</label>
|
||||||
|
<input class="form-control" type="text"/>
|
||||||
|
</div>
|
||||||
|
<div class="mb-5">
|
||||||
|
<label class="form-label">Description</label>
|
||||||
|
<textarea class="form-control"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb-5">
|
||||||
|
<label class="form-label">Tries</label>
|
||||||
|
<textarea class="form-control"></textarea>
|
||||||
|
</div>
|
||||||
|
<select class="mb-5 form-select">
|
||||||
|
<option>None</option>
|
||||||
|
<option>LOL</option>
|
||||||
|
<option>NEIN</option>
|
||||||
|
<option>OOF</option>
|
||||||
|
</select>
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<button class="btn btn-primary" type="submit">Create</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button @onclick="() => SetViewIndex(1)" class="btn btn-lg btn-icon btn-rounded-circle btn-white border border-primary" style="pointer-events: all">
|
||||||
|
<i class="bx bg-lg bx-chat"></i>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code
|
||||||
|
{
|
||||||
|
private int ViewIndex = 0;
|
||||||
|
|
||||||
|
private async Task SetViewIndex(int index)
|
||||||
|
{
|
||||||
|
ViewIndex = index;
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
<div class="d-flex flex-column flex-root app-root">
|
@using Moonlight.Shared.Components.Partials.LiveChat
|
||||||
|
|
||||||
|
<div class="d-flex flex-column flex-root app-root">
|
||||||
<div class="app-page flex-column flex-column-fluid">
|
<div class="app-page flex-column flex-column-fluid">
|
||||||
<CascadingValue Value="this">
|
<CascadingValue Value="this">
|
||||||
<PageHeader />
|
<PageHeader />
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
<div class="app-container container-fluid">
|
<div class="app-container container-fluid">
|
||||||
@ChildContent
|
@ChildContent
|
||||||
|
|
||||||
<LiveChat />
|
<LiveChatMain />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue