New source control repo for Biskilog POS - secure hub to store & manage source code. Streamlines dev process, tracks changes, & improves collaboration. Ensures reliable software.
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.

168 lines
5.9 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 = "Transactions",
Title = "Transactions",
Icon = "bxs-cart",
Link = "/transactions/sales",
//Children = new List<NavItem>
//{
// new NavItem()
// {
// Id = 2.1,
// Title = "Sales",
// Link = "/transactions/sales",
// },
// new NavItem()
// {
// Id = 2.2,
// Title = "Statistics",
// },
//},
},
new NavItem()
{
Id = 3,
Description = "Products",
Icon = "bx-box",
Title = "Products",
Children = new List<NavItem>
{
new NavItem
{
Id = 3.1,
Description = "Brands",
Title = "Brands",
Link = "/products/brands",
},
new NavItem
{
Id = 3.2,
Description = "Category",
Title = "Category",
Link = "/products/categories",
},
new NavItem
{
Id = 3.3,
Description = "Inventory",
Title = "Inventory",
Link = "/products/inventory",
},
//new NavItem
//{
// Id = 3.4,
// Description = "Inventory",
// Title = "Bulk Price Changes",
// Link = "",
//},
//new NavItem
//{
// Id = 3.5,
// Description = "Inventory",
// Title = "Products Statistics",
// Link = "",
//}
}
},
new NavItem()
{
Id = 4,
Description = "Customers",
Icon = "bxs-group",
Link = "customers",
Title = "Customers"
},
new NavItem()
{
Id = 5,
Description = "Users",
Icon = "bxs-user-account",
Link = "users",
Title = "Users"
},
//new NavItem()
// {
// Id = 6,
// Description = "Warehouse Management",
// Icon = "bxs-factory",
// Title = "Warehouse Management",
// Children = new List<NavItem> {
// new NavItem(){
// Id = 6.1,
// Description = "Item Inventory for the warehouse",
// Title = "Inventory",
// Link = "",
// },
// },
// },
};
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;
}
}
}