PavelAndreyev1337_itransition-course-project/CollectionApp/CollectionApp.WEB/Views/Shared/_Layout.cshtml
@using Microsoft.AspNetCore.Mvc.Localization

@inject IViewLocalizer Localizer

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Collections</title>
    <link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/lib/bootstrap-icons/font/bootstrap-icons.min.css" />
    <link rel="stylesheet" href="~/css/styles.css" />
    <link rel="icon" href="~/img/icon.svg" />
    <link id="dark-theme-style" rel="stylesheet" />
    <script src="~/lib/js-cookie/js.cookie.min.js"></script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container-fluid">
            <a class="navbar-brand" href="/">
                <img src="~/img/icon.svg" width="30" height="30" alt="">
                Collections
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggler">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarToggler">
                <form class="d-flex mx-auto needs-validation"
                      method="get"
                      asp-controller="Item"
                      asp-action="GetItemsFullTextSearch"
                      style="width: 40%;"
                      novalidate>
                    <input class="form-control me-2"
                           type="search"
                           placeholder="@Localizer["Type"]"
                           name="query"
                           required>
                    <button class="btn btn-outline-success" type="submit">@Localizer["Search"]</button>
                </form>
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link"
                           asp-controller="Home"
                           asp-action="GetAllCollections">
                            @Localizer["Collections"]
                        </a>
                    </li>
                    @if (!User.Identity.IsAuthenticated)
                    {
                        <li class="nav-item">
                            <a class="nav-link" href="#" data-bs-toggle="modal" data-bs-target="#exampleModal">
                                @Localizer["SignIn"]
                            </a>
                        </li>
                    }
                    else
                    {
                        @if (User.IsInRole("admin"))
                        {
                            <li class="nav-item">
                                <a class="nav-link"
                                   asp-controller="Admin"
                                   asp-action="Index">
                                    @Localizer["AdminPanel"]
                                </a>
                            </li>
                        }
                        @if (ViewContext.ActionDescriptor.AttributeRouteInfo?.Name == "Items")
                        {
                            <li class="nav-item">
                                <a class="nav-link"
                                   asp-controller="Item"
                                   asp-action="Create"
                                   asp-route-collectionId="@Context.Request.RouteValues["collectionId"]"
                                   asp-route-userId="@ViewData["userId"]">
                                    @Localizer["AddItem"]
                                </a>
                            </li>
                        }
                        else if (ViewContext.ActionDescriptor.AttributeRouteInfo?.Name == "Profile")
                        {
                            <li class="nav-item">
                                <a class="nav-link"
                                   asp-controller="Collection"
                                   asp-action="Create"
                                   asp-route-userId="@ViewData["userId"]">
                                    @Localizer["AddCollection"]
                                </a>
                            </li>
                        }
                        <li class="nav-item">
                            <a class="nav-link"
                               asp-controller="Collection"
                               asp-action="Index">
                                @Localizer["MyCollection"]
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link"
                               asp-controller="Account"
                               asp-action="Logout">
                                @Localizer["Logout"]
                            </a>
                        </li>
                    }
                    <li class="nav-item me-1">
                        @await Html.PartialAsync("_SelectLanguagePartial")
                    </li>
                    <li class="nav-item">
                        <a href="#"
                           class="btn btn-outline-info ml-auto font-weight-bold"
                           id="theme-toggler">
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">@Localizer["SignIn"]</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div id="modalContent" class="modal-body d-flex flex-column">
                    <a class="btn btn-primary w-75 mt-1 mx-auto oauth-btn"
                       asp-controller="Account"
                       asp-action="SetLogin"
                       asp-route-provider="Facebook">
                        <i class="bi bi-facebook"></i>
                        Facebook
                    </a>
                    <a class="btn btn-danger w-75 my-1 mx-auto oauth-btn"
                       asp-controller="Account"
                       asp-action="SetLogin"
                       asp-route-provider="Reddit">
                        <i class="bi bi-reddit"></i>
                        Reddit
                    </a>
                </div>
            </div>
        </div>
    </div>
    <div class="container body-content">
        @RenderBody()
    </div>
    <script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/index.js"></script>
</body>
</html>
