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,41 @@
@model PlanTempus.Application.Features.Dashboard.Components.WaitlistItemViewModel
<swp-waitlist-item data-key="@Model.Key">
<swp-waitlist-customer>
<swp-avatar>@Model.CustomerInitials</swp-avatar>
<swp-waitlist-customer-info>
<swp-waitlist-name>@Model.CustomerName</swp-waitlist-name>
<swp-waitlist-phone>@Model.CustomerPhone</swp-waitlist-phone>
</swp-waitlist-customer-info>
</swp-waitlist-customer>
<swp-waitlist-service>@Model.Service</swp-waitlist-service>
<swp-waitlist-meta>
<swp-waitlist-periods>
<swp-label>Ønsker:</swp-label>
@foreach (var period in Model.PreferredPeriods)
{
<swp-waitlist-period-tag>@period</swp-waitlist-period-tag>
}
</swp-waitlist-periods>
<swp-waitlist-dates>
<swp-waitlist-date>
<i class="ph ph-calendar"></i>
Tilmeldt: @Model.RegisteredDate
</swp-waitlist-date>
<swp-waitlist-date class="expires @(Model.ExpiresSoon ? "soon" : "")">
<i class="ph ph-clock"></i>
Udløber: @Model.ExpiresDate
</swp-waitlist-date>
</swp-waitlist-dates>
</swp-waitlist-meta>
<swp-waitlist-actions>
<swp-btn class="secondary">
<i class="ph ph-phone"></i>
Kontakt
</swp-btn>
<swp-btn class="primary">
<i class="ph ph-calendar-plus"></i>
Book
</swp-btn>
</swp-waitlist-actions>
</swp-waitlist-item>

View file

@ -0,0 +1,99 @@
using Microsoft.AspNetCore.Mvc;
namespace PlanTempus.Application.Features.Dashboard.Components;
/// <summary>
/// ViewComponent for rendering a waitlist item in the waitlist drawer.
/// </summary>
public class WaitlistItemViewComponent : ViewComponent
{
public IViewComponentResult Invoke(string key)
{
var model = WaitlistItemCatalog.Get(key);
return View(model);
}
}
/// <summary>
/// ViewModel for the WaitlistItem component.
/// </summary>
public class WaitlistItemViewModel
{
public required string Key { get; init; }
public required string CustomerName { get; init; }
public required string CustomerInitials { get; init; }
public required string CustomerPhone { get; init; }
public required string Service { get; init; }
public required IReadOnlyList<string> PreferredPeriods { get; init; }
public required string RegisteredDate { get; init; }
public required string ExpiresDate { get; init; }
public bool ExpiresSoon { get; init; }
}
/// <summary>
/// Catalog of waitlist items with demo data.
/// </summary>
public static class WaitlistItemCatalog
{
private static readonly Dictionary<string, WaitlistItemViewModel> Items = new()
{
["waitlist-1"] = new WaitlistItemViewModel
{
Key = "waitlist-1",
CustomerName = "Emma Christensen",
CustomerInitials = "EC",
CustomerPhone = "+45 12 34 56 78",
Service = "Dameklip + Farve",
PreferredPeriods = ["Mandag-Onsdag", "Formiddag"],
RegisteredDate = "2. jan 2026",
ExpiresDate = "16. jan 2026",
ExpiresSoon = false
},
["waitlist-2"] = new WaitlistItemViewModel
{
Key = "waitlist-2",
CustomerName = "Mikkel Sørensen",
CustomerInitials = "MS",
CustomerPhone = "+45 23 45 67 89",
Service = "Herreklip",
PreferredPeriods = ["Weekend"],
RegisteredDate = "30. dec 2025",
ExpiresDate = "6. jan 2026",
ExpiresSoon = true
},
["waitlist-3"] = new WaitlistItemViewModel
{
Key = "waitlist-3",
CustomerName = "Lise Andersen",
CustomerInitials = "LA",
CustomerPhone = "+45 34 56 78 90",
Service = "Balayage",
PreferredPeriods = ["Tirsdag-Torsdag", "Eftermiddag"],
RegisteredDate = "28. dec 2025",
ExpiresDate = "11. jan 2026",
ExpiresSoon = false
},
["waitlist-4"] = new WaitlistItemViewModel
{
Key = "waitlist-4",
CustomerName = "Peter Hansen",
CustomerInitials = "PH",
CustomerPhone = "+45 45 67 89 01",
Service = "Herreklip + Skæg",
PreferredPeriods = ["Fleksibel"],
RegisteredDate = "27. dec 2025",
ExpiresDate = "10. jan 2026",
ExpiresSoon = false
}
};
public static WaitlistItemViewModel Get(string key)
{
if (Items.TryGetValue(key, out var item))
return item;
throw new KeyNotFoundException($"WaitlistItem with key '{key}' not found");
}
public static IEnumerable<string> AllKeys => Items.Keys;
}