You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.7 KiB
111 lines
3.7 KiB
namespace Biskilog_Accounting.Client.Models
|
|
{
|
|
/// <summary>
|
|
/// Structure of the sidebar navigation menu items
|
|
/// </summary>
|
|
public class NavItem
|
|
{
|
|
/// <summary>
|
|
/// The unique id of the menu item
|
|
/// </summary>
|
|
public double Id { get; set; }
|
|
/// <summary>
|
|
/// The title of the menu item to display
|
|
/// </summary>
|
|
public string Title { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// The description of the menu item or description of the content of the page
|
|
/// </summary>
|
|
public string Description { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// The link to open the specified page tied to the menu item
|
|
/// </summary>
|
|
public string Link { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// The icon of the menu item
|
|
/// </summary>
|
|
public string Icon { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// Children or sub menu item
|
|
/// </summary>
|
|
public List<NavItem> Children { get; set; } = new List<NavItem>();
|
|
}
|
|
/// <summary>
|
|
/// Contains the list of menu Items
|
|
/// </summary>
|
|
public static class Menu
|
|
{
|
|
public static IEnumerable<NavItem> MenuList()
|
|
{
|
|
var menuItems = new List<NavItem>{
|
|
new NavItem()
|
|
{
|
|
Id = 1,
|
|
Description = "Analytics page",
|
|
Icon = "bx-home-circle",
|
|
Link = "",
|
|
Title = "Dashboard"
|
|
},
|
|
new NavItem()
|
|
{
|
|
Id = 2,
|
|
Description = "Customers",
|
|
Icon = "bx-users",
|
|
Link = "customers",
|
|
Title = "Customers"
|
|
},
|
|
new NavItem()
|
|
{
|
|
Id = 3,
|
|
Description = "Employees",
|
|
Icon = "bx-users",
|
|
Link = "employees",
|
|
Title = "Employees"
|
|
},
|
|
new NavItem()
|
|
{
|
|
Id = 4,
|
|
Description = "Products",
|
|
Icon = "bx-box",
|
|
Link = "",
|
|
Title = "Products",
|
|
Children = new List<NavItem>
|
|
{
|
|
new NavItem
|
|
{
|
|
Id = 4.1,
|
|
Description = "Inventory",
|
|
Title = "Inventory"
|
|
},
|
|
new NavItem
|
|
{
|
|
Id = 4.2,
|
|
Description = "Inventory",
|
|
Title = "Bulk Price Changes"
|
|
},
|
|
new NavItem
|
|
{
|
|
Id = 4.3,
|
|
Description = "Inventory",
|
|
Title = "Products Statistics",
|
|
Icon = "bx-detail"
|
|
}
|
|
}
|
|
},
|
|
};
|
|
|
|
var uniqueIds = new HashSet<double>();
|
|
|
|
//Validates list to check if there are no duplicate Ids
|
|
foreach (var menuItem in menuItems)
|
|
{
|
|
if (!uniqueIds.Add(menuItem.Id))
|
|
{
|
|
throw new Exception($"Duplicate Id found: {menuItem.Id}");
|
|
}
|
|
}
|
|
|
|
return menuItems;
|
|
}
|
|
}
|
|
}
|
|
|