Erste lauffähige Version
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
@page "/"
|
||||
@rendermode InteractiveServer
|
||||
@using TodoTicketApp.Models
|
||||
@using TodoTicketApp.Services
|
||||
@inject ITicketService TicketService
|
||||
@inject NavigationManager Nav
|
||||
|
||||
<PageTitle>Ticket Dashboard</PageTitle>
|
||||
|
||||
<div class="dashboard-container">
|
||||
<div class="quick-entry">
|
||||
<input class="form-control form-control-lg"
|
||||
placeholder="Ticket-Titel eingeben..."
|
||||
@bind="newTicketTitle"
|
||||
@onkeyup="HandleKeyUp" />
|
||||
</div>
|
||||
|
||||
<div class="ticket-list">
|
||||
@foreach (var ticket in TicketService.GetPendingTickets())
|
||||
{
|
||||
<div class="ticket-card priority-@ticket.Priority.ToString().ToLower()">
|
||||
<div class="ticket-header" @onclick="() => GoToDetails(ticket.Id)">
|
||||
<span class="prio-tag">@ticket.Priority</span>
|
||||
<h5>@ticket.Title</h5>
|
||||
<small>@ticket.CreatedAt.ToLocalTime().ToString("g")</small>
|
||||
</div>
|
||||
|
||||
<div class="ticket-body" @onclick="() => GoToDetails(ticket.Id)">
|
||||
<p>@(ticket.Description.Length > 200 ? ticket.Description.Substring(0, 200) + "..." : ticket.Description)</p>
|
||||
</div>
|
||||
|
||||
<div class="ticket-footer">
|
||||
<span class="comments-info">
|
||||
<i class="bi bi-chat-left-text"></i> @ticket.Comments.Count Kommentare
|
||||
</span>
|
||||
<button class="btn btn-sm btn-outline-success" @onclick="() => Complete(ticket.Id)">
|
||||
Erledigen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string newTicketTitle = "";
|
||||
|
||||
private async Task HandleKeyUp(KeyboardEventArgs e)
|
||||
{
|
||||
if (e.Key == "Enter" && !string.IsNullOrWhiteSpace(newTicketTitle))
|
||||
{
|
||||
var newTicket = new Ticket { Title = newTicketTitle };
|
||||
TicketService.AddTicket(newTicket);
|
||||
newTicketTitle = "";
|
||||
// Hier könnten wir direkt auf die Detailseite navigieren:
|
||||
// Nav.NavigateTo($"/ticket/edit/{newTicket.Id}");
|
||||
}
|
||||
}
|
||||
|
||||
private void Complete(Guid id) => TicketService.CompleteTicket(id);
|
||||
private void GoToDetails(Guid id) => Nav.NavigateTo($"/ticket/edit/{id}");
|
||||
}
|
||||
|
||||
<style>
|
||||
.dashboard-container { max-width: 800px; margin: 2rem auto; }
|
||||
.quick-entry { margin-bottom: 2rem; }
|
||||
.ticket-card {
|
||||
background: #f8f9fa; border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
|
||||
border-left: 5px solid #ccc; cursor: pointer; transition: transform 0.1s;
|
||||
}
|
||||
.ticket-card:hover { transform: scale(1.01); }
|
||||
.priority-critical { border-left-color: #dc3545; }
|
||||
.priority-high { border-left-color: #fd7e14; }
|
||||
.ticket-header { display: flex; justify-content: space-between; align-items: center; }
|
||||
.prio-tag { font-size: 0.7rem; font-weight: bold; text-transform: uppercase; }
|
||||
.ticket-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user