@using Microsoft.AspNetCore.Http

@inject IHttpContextAccessor HttpContextAccessor


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - FamilyBudget</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/layout.css" />
    <style>

    </style>
</head>
<body>
    <header>
        <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
            <div class="container">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">FamilyBudget</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">

                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-lg-end">
                    @if (HttpContextAccessor.HttpContext.Session.GetInt32("IdUtilisateur") != null)
                    {
                        <ul class="navbar-nav">
                            <li class="nav-item navbar-nav flex-grow-1">
                                <form asp-controller="Compte" asp-action="Logout" method="post" class="form-inline">
                                    <button type="submit" class="nav-link btn btn-link text-dark">Se déconnecter</button>
                                </form>
                            </li>
                        </ul>
                    }
                    else
                    {
                        <ul class="navbar-nav">
                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-controller="Compte" asp-action="Register">S'inscrire</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-controller="Compte" asp-action="Login">Se connecter</a>
                            </li>
                        </ul>
                    }
                </div>
            </div>
        </nav>
    </header>
    @if (HttpContextAccessor.HttpContext.Session.GetInt32("IdUtilisateur") != null)
    {
        <header class="left-navbar">
            <nav>
                <ul>
                    <li><a asp-controller="Acceuil" asp-action="Acceuil">Acceuil</a></li>
                    <li><a asp-controller="Facture" asp-action="facture">Factures</a></li>
                    <li><a asp-controller="Budget" asp-action="Budget">Budget</a></li>
                    <li><a asp-controller="Bank" asp-action="bank">Compte</a></li>
                    <li><a asp-controller="Depense" asp-action="Depense">Dépenses</a></li>
                    <li><a asp-controller="Revenu" asp-action="revenu">Revenus</a></li>
                </ul>
            </nav>
        </header>

    }

    <div class="container">
        <main role="main" class="pb-2">
            @RenderBody()
        </main>
    </div>
</body>
</html>
