wip
This commit is contained in:
parent
abcf8ee75e
commit
12869e35bf
34 changed files with 1177 additions and 156 deletions
|
|
@ -0,0 +1,42 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PlanTempus.Application.Features.Dashboard.Components;
|
||||
|
||||
public class BookingListViewComponent : ViewComponent
|
||||
{
|
||||
public IViewComponentResult Invoke(string key)
|
||||
{
|
||||
var model = BookingListCatalog.Get(key);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
|
||||
public class BookingListViewModel
|
||||
{
|
||||
public required string Key { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public required string CurrentTime { get; init; }
|
||||
public required IReadOnlyList<string> BookingKeys { get; init; }
|
||||
}
|
||||
|
||||
public static class BookingListCatalog
|
||||
{
|
||||
private static readonly Dictionary<string, BookingListViewModel> Lists = new()
|
||||
{
|
||||
["todays-bookings"] = new BookingListViewModel
|
||||
{
|
||||
Key = "todays-bookings",
|
||||
Title = "Dagens bookinger",
|
||||
CurrentTime = "10:45",
|
||||
BookingKeys = ["booking-1", "booking-2", "booking-3", "booking-4", "booking-5", "booking-6"]
|
||||
}
|
||||
};
|
||||
|
||||
public static BookingListViewModel Get(string key)
|
||||
{
|
||||
if (Lists.TryGetValue(key, out var list))
|
||||
return list;
|
||||
|
||||
throw new KeyNotFoundException($"BookingList with key '{key}' not found");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue