@using AyCode.Core
@using FruitBank.Common.Models
@inject LoggedInModel LoggedInModel

<input type="checkbox" title="Navigation menu" class="navbar-toggler" />

<div class="top-row ps-3 navbar navbar-dark">
	<div class="container-fluid">
	@if (LoggedInModel.IsLoggedIn)
	{
		<a class="navbar-brand" href="">FruitBank</a>
	}
	else
	{
		<span class="navbar-brand">FruitBank</span>
	}
	</div>
</div>

<div class="nav-scrollable" onclick="if (window.innerWidth < 1600) document.querySelector('.navbar-toggler').click()">
	<nav class="flex-column">
		@if (LoggedInModel.IsLoggedIn)// || AcDomain.IsDeveloperVersion)
		{
			<div class="nav-item px-3">
				<NavLink class="nav-link" href="" Match="NavLinkMatch.All" title="Kezdőlap">
					<span class="icon home-icon" aria-hidden="true"></span> Kezdőlap
				</NavLink>
			</div>
			<div class="nav-item px-3">
				<NavLink class="nav-link" href="MeasuringIn" title="Áru bevételezés">
					<span class="icon measuring-in-icon" aria-hidden="true"></span> Áru bevételezés
				</NavLink>
			</div>
			<div class="nav-item px-3">
				<NavLink class="nav-link" href="MeasuringOut" title="Áru kiadás">
					<span class="icon measuring-out-icon" aria-hidden="true"></span> Áru kiadás
				</NavLink>
			</div>

			@if (LoggedInModel.IsAdministrator)
			{
				<div class="nav-item px-3">
					<NavLink class="nav-link" href="StockTaking" title="Leltározás">
						<span class="icon stock-taking-icon" aria-hidden="true"></span> Leltározás
					</NavLink>
				</div>
			}

			@if (LoggedInModel.IsAdministrator)
			{
				<hr class="nav-divider" />
				<div class="nav-group-title px-3">
					<span class="nav-group-label">Adminisztrátor</span>
				</div>
				<div class="nav-item px-3">
					<NavLink class="nav-link" href="OrdersAdmin" title="Rendelések">
						<span class="icon orders-icon" aria-hidden="true"></span> Rendelések
					</NavLink>
				</div>

				<div class="nav-item px-3">
					<NavLink class="nav-link" href="ShippingsAdmin" title="Szállítmányok">
						<span class="icon shippings-icon" aria-hidden="true"></span> Szállítmányok
					</NavLink>
				</div>
			}
		}
		else
		{
			<div class="nav-item px-3">
				<NavLink class="nav-link" href="Login" title="Bejelentkezés">
					<span class="icon login-icon" aria-hidden="true"></span> Bejelentkezés
				</NavLink>
			</div>
		}
	</nav>
</div>

@code 
{
	public void RefreshNavMenu()
	{
		StateHasChanged();
	}
}