diff --git a/Client/App.razor b/Client/App.razor index 6fd3ed1..21a5fd3 100644 --- a/Client/App.razor +++ b/Client/App.razor @@ -1,4 +1,5 @@ - +@using Biskilog_Accounting.Client.Layouts; + diff --git a/Client/Biskilog Accounting.Client.csproj b/Client/Biskilog Accounting.Client.csproj index f82683b..199aeff 100644 --- a/Client/Biskilog Accounting.Client.csproj +++ b/Client/Biskilog Accounting.Client.csproj @@ -23,4 +23,8 @@ + + + + diff --git a/Client/Elements/Footer.razor b/Client/Elements/Footer.razor new file mode 100644 index 0000000..2a99ca9 --- /dev/null +++ b/Client/Elements/Footer.razor @@ -0,0 +1,11 @@ +
+
+
+ Biskilog © @DateTime.Now.Year + +
+ +
+
\ No newline at end of file diff --git a/Client/Elements/Headbar.razor b/Client/Elements/Headbar.razor new file mode 100644 index 0000000..d6c5c7b --- /dev/null +++ b/Client/Elements/Headbar.razor @@ -0,0 +1,98 @@ + + + + + \ No newline at end of file diff --git a/Client/Elements/MenuItem.razor b/Client/Elements/MenuItem.razor new file mode 100644 index 0000000..e121659 --- /dev/null +++ b/Client/Elements/MenuItem.razor @@ -0,0 +1,29 @@ +@using Biskilog_Accounting.Client.Models; +@if (Item.Children.Count == 0) +{ + +} +else +{ + +} \ No newline at end of file diff --git a/Client/Elements/MenuItem.razor.cs b/Client/Elements/MenuItem.razor.cs new file mode 100644 index 0000000..a838aa3 --- /dev/null +++ b/Client/Elements/MenuItem.razor.cs @@ -0,0 +1,45 @@ +using Biskilog_Accounting.Client.Models; +using Microsoft.AspNetCore.Components; +using System.Linq; + +namespace Biskilog_Accounting.Client.Elements +{ + public partial class MenuItem + { + [Parameter] + public NavItem Item { get; set; } + [Parameter] + public double ActiveId { get; set; } + [Parameter] + public EventCallback ActiveChanged { get; set; } + private string m_expand { get; set; } = string.Empty; + + protected override void OnParametersSet() + { + //Collapse expanded parents if none of its child is active + if (!Item.Children.Any(i => i.Id == ActiveId)) + { + m_expand = string.Empty; + } + base.OnParametersSet(); + } + private void Toggle() + { + if (String.IsNullOrEmpty(m_expand)) + { + m_expand = "menu-item-animating open"; + } + else + { + m_expand = ""; + } + } + + private void ItemClick(double a_id) + { + ActiveId = a_id; + ActiveChanged.InvokeAsync(a_id); + } + + } +} diff --git a/Client/Elements/Sidebar.razor b/Client/Elements/Sidebar.razor new file mode 100644 index 0000000..efc9935 --- /dev/null +++ b/Client/Elements/Sidebar.razor @@ -0,0 +1,40 @@ +@using Biskilog_Accounting.Client.Models; + + + +@code { + private double m_activeId = 1; + + + private void HandleMenuClick(double a_selectedId) + { + m_activeId = a_selectedId; + StateHasChanged(); + } +} \ No newline at end of file diff --git a/Client/Layouts/MainLayout.razor b/Client/Layouts/MainLayout.razor new file mode 100644 index 0000000..17cbfab --- /dev/null +++ b/Client/Layouts/MainLayout.razor @@ -0,0 +1,28 @@ +@inherits LayoutComponentBase +@using Biskilog_Accounting.Client.Elements + +
+
+ + + + +
+ + +
+ + + @Body + + + +
+ +
+ +
+ +
+
+ \ No newline at end of file diff --git a/Client/MainLayout.razor b/Client/MainLayout.razor deleted file mode 100644 index de2be6c..0000000 --- a/Client/MainLayout.razor +++ /dev/null @@ -1,5 +0,0 @@ -@inherits LayoutComponentBase - -
- @Body -
diff --git a/Client/Models/NavItem.cs b/Client/Models/NavItem.cs new file mode 100644 index 0000000..238c149 --- /dev/null +++ b/Client/Models/NavItem.cs @@ -0,0 +1,111 @@ +namespace Biskilog_Accounting.Client.Models +{ + /// + /// Structure of the sidebar navigation menu items + /// + public class NavItem + { + /// + /// The unique id of the menu item + /// + public double Id { get; set; } + /// + /// The title of the menu item to display + /// + public string Title { get; set; } = string.Empty; + /// + /// The description of the menu item or description of the content of the page + /// + public string Description { get; set; } = string.Empty; + /// + /// The link to open the specified page tied to the menu item + /// + public string Link { get; set; } = string.Empty; + /// + /// The icon of the menu item + /// + public string Icon { get; set; } = string.Empty; + /// + /// Children or sub menu item + /// + public List Children { get; set; } = new List(); + } + /// + /// Contains the list of menu Items + /// + public static class Menu + { + public static IEnumerable MenuList() + { + var menuItems = new List{ + 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 + { + 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(); + + //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; + } + } +} diff --git a/Client/Pages/Auth/Login.razor b/Client/Pages/Auth/Login.razor index 498c8a3..cf883e8 100644 --- a/Client/Pages/Auth/Login.razor +++ b/Client/Pages/Auth/Login.razor @@ -1,5 +1,5 @@ @layout AuthLayout -@page "/" +@page "/login" ', returnEnd: true,\n subLanguage: ['css', 'xml']\n }\n },\n {\n className: 'tag',\n // See the comment in the