PlanTempusApp/PlanTempus.Application/Features/Menu/Services/MockMenuService.cs
Janus C. H. Knudsen 405dabeb34 Add reports page with sales analytics and UI components
Introduces comprehensive reports feature with interactive sales dashboard
Includes dynamic data tables, charts, and filtering capabilities
Enhances application with new statistics and reporting functionality
2026-01-21 21:37:09 +01:00

196 lines
6.4 KiB
C#

using PlanTempus.Application.Features.Localization.Services;
using PlanTempus.Application.Features.Menu.Models;
namespace PlanTempus.Application.Features.Menu.Services;
/// <summary>
/// Mock implementation of IMenuService with hardcoded menu data.
/// </summary>
public class MockMenuService : IMenuService
{
private readonly ILocalizationService _localize;
public MockMenuService(ILocalizationService localize)
{
_localize = localize;
}
public List<MenuGroup> GetMenuForRole(UserRole role, string? currentUrl = null)
{
var allGroups = GetAllMenuGroups();
return allGroups
.Select(g => new MenuGroup
{
Id = g.Id,
Label = _localize.Get($"groups.{g.Id}"),
SortOrder = g.SortOrder,
Items = g.Items
.Where(i => role >= i.MinimumRole)
.Select(i => new MenuItem
{
Id = i.Id,
Label = _localize.Get($"menu.{i.Id}"),
Icon = i.Icon,
Url = i.Url,
MinimumRole = i.MinimumRole,
SortOrder = i.SortOrder,
IsActive = currentUrl != null && i.Url.Equals(currentUrl, StringComparison.OrdinalIgnoreCase)
})
.OrderBy(i => i.SortOrder)
.ToList()
})
.Where(g => g.Items.Any())
.OrderBy(g => g.SortOrder)
.ToList();
}
private static List<MenuGroup> GetAllMenuGroups()
{
return new List<MenuGroup>
{
// OVERVIEW GROUP
new MenuGroup
{
Id = "overview",
Label = "Dashboard",
SortOrder = 1,
Items = new List<MenuItem>
{
new MenuItem
{
Id = "home",
Label = "Dashboard",
Icon = "ph-squares-four",
Url = "/",
MinimumRole = UserRole.Staff,
SortOrder = 1
},
new MenuItem
{
Id = "calendar",
Label = "Kalender",
Icon = "ph-calendar",
Url = "/poc-calendar.html",
MinimumRole = UserRole.Staff,
SortOrder = 2
},
new MenuItem
{
Id = "pos",
Label = "Kasse",
Icon = "ph-cash-register",
Url = "/kasse",
MinimumRole = UserRole.Staff,
SortOrder = 3
}
}
},
// DATA GROUP
new MenuGroup
{
Id = "data",
Label = "Data",
SortOrder = 2,
Items = new List<MenuItem>
{
new MenuItem
{
Id = "products",
Label = "Produkter & Lager",
Icon = "ph-package",
Url = "/poc-produkter.html",
MinimumRole = UserRole.Manager,
SortOrder = 1
},
new MenuItem
{
Id = "suppliers",
Label = "Leverandører",
Icon = "ph-truck",
Url = "/poc-leverandoerer.html",
MinimumRole = UserRole.Manager,
SortOrder = 2
},
new MenuItem
{
Id = "customers",
Label = "Kunder",
Icon = "ph-users",
Url = "/kunder",
MinimumRole = UserRole.Staff,
SortOrder = 3
},
new MenuItem
{
Id = "employees",
Label = "Medarbejdere",
Icon = "ph-users-three",
Url = "/medarbejdere",
MinimumRole = UserRole.Manager,
SortOrder = 4
},
new MenuItem
{
Id = "services",
Label = "Services",
Icon = "ph-scissors",
Url = "/services",
MinimumRole = UserRole.Manager,
SortOrder = 5
}
}
},
// ANALYSE GROUP
new MenuGroup
{
Id = "analytics",
Label = "Analyse",
SortOrder = 3,
Items = new List<MenuItem>
{
new MenuItem
{
Id = "reports",
Label = "Statistik & Rapporter",
Icon = "ph-chart-line-up",
Url = "/rapporter",
MinimumRole = UserRole.Manager,
SortOrder = 1
}
}
},
// SYSTEM GROUP
new MenuGroup
{
Id = "system",
Label = "System",
SortOrder = 4,
Items = new List<MenuItem>
{
new MenuItem
{
Id = "settings",
Label = "Indstillinger",
Icon = "ph-gear",
Url = "/indstillinger",
MinimumRole = UserRole.Admin,
SortOrder = 1
},
new MenuItem
{
Id = "account",
Label = "Abonnement & Konto",
Icon = "ph-credit-card",
Url = "/konto",
MinimumRole = UserRole.Admin,
SortOrder = 2
}
}
}
};
}
}