@model PantheonRA.BackOffice.Models.BreadcrumbViewModel

@*<div class="row navbar">
    <div class="row container-flud">
        <ul class="nav navbar-nav col-md-12 top-menu">
            <li class="top-menu-domain-and-company-name"><span class="fontSizeUi" >@PantheonRA.BackOffice.CurrentUser.DomainName &nbsp;</span></li>
            <li class="top-menu-domain-and-company-name"><span class="fontSizeUi" >@PantheonRA.BackOffice.CurrentUser.CompanyName</span></li>  


        <li class="top-menu-item pull-right">
            <span><a href="https://www.youtube.com/watch?v=JUPBgEc66xc" target="_blank"><i class="fal fa-question-circle fa-2x"></i></a></span>
        </li>
        <li class="top-menu-item pull-right header-notification header-icon">
            <div class="icon-wrapper">
                <i class="fal fa-bell fa-2x" title="@Loc.Announcements" aria-hidden="true"></i>
                <span class="icon-badge"></span>
                <div class="icon-badge-popup animated fadeInLeft">
                    <i class="fa fa-times icon-badge-popup-close" aria-hidden="true"></i>
                    <div class="icon-badge-popup-content"></div>
                </div>
            </div>
        </li>
        <li class="top-menu-item pull-right">
            <span data-toggle="dropdown">
                <i class="fal fa-user fa-2x" title="@Loc.LogOut"></i>
            </span>
            <ul class="dropdown-menu dropdown-menu-right">
                <li class="dropdown-item user-dropdown-menu-li">@Html.ActionLink(Loc.Loggout, "LogOut", "Account", null, new { @class = "allow-redirect" })</li>
                <li class="dropdown-item user-dropdown-menu-li"><a href="#" onclick="openChangePasswordModal();">@Loc.ChangePassword</a></li>
            </ul>
        </li>

        <li class="top-menu-item pull-right">
            <span><a href="@Url.Action("Index", "Company")"><i class="fal fa-cog fa-2x"></i></a></span>
        </li>

        <li class="top-menu-item pull-right"><i class="fal fa-search fa-2x" aria-hidden="true"></i></li>

        <li class="top-menu-item pull-right top-menu-border"><i class="fal fa-plus-circle fa-2x"></i></li>
    </ul>
</div>

@Html.Partial("~/Views/Account/_ChangePassword.cshtml")

<script>
    function loadNotifications() {
        $('.header-notification .icon-badge-popup .icon-badge-popup-close').on('click', function () {
            $('.header-notification .icon-badge-popup').hide();
        });

        $('.header-notification .fa-bell').on('click', function () {
            window.location = '@Url.Action("Index", "Announcement")';
        });

        $('.header-notification .icon-badge-popup .icon-badge-popup-content').on('click', function () {
            window.location = '@Url.Action("Index", "Announcement")';
        });

        if (window.location.pathname.startsWith('/Announcement'))
            return;

        if (window.localStorage.getItem('DisplayPopup') === 'false') {
            if (window.localStorage.getItem('AnnouncementsCount') > 0) {
                $('.header-notification .icon-badge').text(window.localStorage.getItem('AnnouncementsCount'));
            }
        }
        else {
            $.ajax({
                url: "@Url.Action("GetUnseenAnnouncements", "Announcement")",
                type: 'POST',
                cache: false
            }).done(function (data) {
                if (data.length > 0) {
                    $('.header-notification .icon-badge').text(data.length);
                    $('.header-notification .fa-bell').addClass('bell-animation');
                    let numberOfDisplayedItems = data.length > 3 ? 3 : data.length;
                    let items = "";
                    for (let i = 0; i < numberOfDisplayedItems; i++) {
                        items += "<div class='icon-badge-popup-item'><span class='m-r-sm'>" + data[i].StartDate + "</span><strong>" + data[i].Title + "</strong></div>"
                    }

                    $('.header-notification .icon-badge-popup .icon-badge-popup-content').html(items);
                    $('.header-notification .icon-badge-popup').show();

                    window.localStorage.setItem('DisplayPopup', false);
                    window.localStorage.setItem('AnnouncementsCount', data.length);
                }
            }).fail(function (data) {
                console.log("Error", data);
            });
        }
    };

    window.addEventListener("load", loadNotifications, false);
</script>*@