This commit is contained in:
Janus C. H. Knudsen 2026-01-11 18:18:36 +01:00
parent abcf8ee75e
commit 12869e35bf
34 changed files with 1177 additions and 156 deletions

View file

@ -0,0 +1,40 @@
using Microsoft.AspNetCore.Mvc;
namespace PlanTempus.Application.Features.Dashboard.Components;
public class AttentionListViewComponent : ViewComponent
{
public IViewComponentResult Invoke(string key)
{
var model = AttentionListCatalog.Get(key);
return View(model);
}
}
public class AttentionListViewModel
{
public required string Key { get; init; }
public required string Title { get; init; }
public required IReadOnlyList<string> AttentionKeys { get; init; }
}
public static class AttentionListCatalog
{
private static readonly Dictionary<string, AttentionListViewModel> Lists = new()
{
["current-attentions"] = new AttentionListViewModel
{
Key = "current-attentions",
Title = "Opmærksomheder",
AttentionKeys = ["attention-1", "attention-2", "attention-3"]
}
};
public static AttentionListViewModel Get(string key)
{
if (Lists.TryGetValue(key, out var list))
return list;
throw new KeyNotFoundException($"AttentionList with key '{key}' not found");
}
}

View file

@ -0,0 +1,18 @@
@model PlanTempus.Application.Features.Dashboard.Components.AttentionListViewModel
<swp-card data-key="@Model.Key">
<swp-card-header>
<swp-card-title>
<i class="ph ph-warning-circle"></i>
@Model.Title
</swp-card-title>
</swp-card-header>
<swp-card-content>
<swp-attention-list>
@foreach (var attentionKey in Model.AttentionKeys)
{
@await Component.InvokeAsync("AttentionItem", attentionKey)
}
</swp-attention-list>
</swp-card-content>
</swp-card>