wip
This commit is contained in:
parent
abcf8ee75e
commit
12869e35bf
34 changed files with 1177 additions and 156 deletions
|
|
@ -0,0 +1,66 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PlanTempus.Application.Features.Dashboard.Components;
|
||||
|
||||
public class AttentionItemViewComponent : ViewComponent
|
||||
{
|
||||
public IViewComponentResult Invoke(string key)
|
||||
{
|
||||
var model = AttentionItemCatalog.Get(key);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
|
||||
public class AttentionItemViewModel
|
||||
{
|
||||
public required string Key { get; init; }
|
||||
public required string Icon { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public required string Description { get; init; }
|
||||
public required string ActionText { get; init; }
|
||||
public required string Severity { get; init; }
|
||||
}
|
||||
|
||||
public static class AttentionItemCatalog
|
||||
{
|
||||
private static readonly Dictionary<string, AttentionItemViewModel> Attentions = new()
|
||||
{
|
||||
["attention-1"] = new AttentionItemViewModel
|
||||
{
|
||||
Key = "attention-1",
|
||||
Icon = "x-circle",
|
||||
Title = "Aflyst booking",
|
||||
Description = "Mette Hansen aflyste kl. 15:00 – tid nu ledig",
|
||||
ActionText = "Fyld tid",
|
||||
Severity = "urgent"
|
||||
},
|
||||
["attention-2"] = new AttentionItemViewModel
|
||||
{
|
||||
Key = "attention-2",
|
||||
Icon = "clock",
|
||||
Title = "Ubekræftet booking",
|
||||
Description = "Ida Rasmussen har ikke bekræftet kl. 11:30",
|
||||
ActionText = "Send påmindelse",
|
||||
Severity = "warning"
|
||||
},
|
||||
["attention-3"] = new AttentionItemViewModel
|
||||
{
|
||||
Key = "attention-3",
|
||||
Icon = "gift",
|
||||
Title = "Gavekort udløber snart",
|
||||
Description = "GC-D2R4-6TY9 udløber om 3 uger (200 DKK)",
|
||||
ActionText = "Se gavekort",
|
||||
Severity = "info"
|
||||
}
|
||||
};
|
||||
|
||||
public static AttentionItemViewModel Get(string key)
|
||||
{
|
||||
if (Attentions.TryGetValue(key, out var attention))
|
||||
return attention;
|
||||
|
||||
throw new KeyNotFoundException($"AttentionItem with key '{key}' not found");
|
||||
}
|
||||
|
||||
public static IEnumerable<string> AllKeys => Attentions.Keys;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@model PlanTempus.Application.Features.Dashboard.Components.AttentionItemViewModel
|
||||
|
||||
<swp-attention-item data-key="@Model.Key" class="@Model.Severity">
|
||||
<swp-attention-icon>
|
||||
<i class="ph ph-@Model.Icon"></i>
|
||||
</swp-attention-icon>
|
||||
<swp-attention-content>
|
||||
<swp-item-title>@Model.Title</swp-item-title>
|
||||
<swp-item-desc>@Model.Description</swp-item-desc>
|
||||
</swp-attention-content>
|
||||
<swp-attention-action>@Model.ActionText</swp-attention-action>
|
||||
</swp-attention-item>
|
||||
Loading…
Add table
Add a link
Reference in a new issue