<?php include 'head.tpl'; ?>
<?php include 'player.tpl'; ?>
<header>
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
        <div class="container">

            <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas" aria-controls="offcanvas" aria-expanded="false" aria-label="Toggle navigation">
                <span class="fas fa-bars"></span>
            </button>

            <a class="navbar-logo" href="<?php echo PATH_SYSTEM; ?>">
                <img loading="lazy" src="<?php echo PATH_SYSTEM; ?>public/<?php echo $setting->logo_site; ?>" alt="logo">
            </a>

            <?php if (statusModule('users', 'clients') == 1) {
                if ($clientId) { ?>
                    <button class="navbar-toggler" type="button" aria-label="user">
                        <span class="dropdown">
                            <a href="#" class="text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                <img src="<?php echo PATH_SYSTEM; ?>public/avatar/<?php echo $client->avatar; ?>" alt="<?php echo $client->full_name; ?>" width="32" height="32" class="rounded-circle avatar-user">
                            </a>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li><a class="dropdown-item" href="<?php echo PATH_SYSTEM; ?>profile"><?php echo $_LANG['profile']; ?></a></li>
                                <?php if ($client->level > 0) { ?>
                                    <li>
                                        <hr class="dropdown-divider">
                                    </li>
                                    <li><a class="dropdown-item" href="#" onclick="window.open('<?php echo PATH_SYSTEM; ?>admin','_blank')"><?php echo $_LANG['panel-admin']; ?></a></li>
                                <?php } ?>
                                <li>
                                    <hr class="dropdown-divider">
                                </li>
                                <li><a id="logout" class="dropdown-item" href="<?php echo PATH_SYSTEM; ?>logout"><?php echo $_LANG['logout']; ?></a></li>
                            </ul>
                        </span>
                    </button>
                <?php } else { ?>
                    <button class="navbar-toggler" type="button" aria-label="user" data-bs-toggle="modal" data-bs-target="#modalLogin">
                        <span class="fas fa-user"></span>
                    </button>
                <?php }
            } else { ?>
                <span class="navbar-toggler"></span>
            <?php } ?>


            <div class="offcanvas offcanvas-start" id="offcanvas">
                <div class="offcanvas-body">

                    <ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
                        <li class="nav-item">
                            <a id="home-active" class="nav-link" aria-current="page" href="<?php echo PATH_SYSTEM; ?>"><?php echo $_LANG['home']; ?></a>
                        </li>

                        <?php if (statusModule('publish', 'podcasts') == 1) { ?>
                            <li class="nav-item">
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>podcasts"><?php echo $_LANG['podcasts']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if (statusModule('publish', 'news') == 1) { ?>
                            <li class="nav-item">
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>news"><?php echo $_LANG['news']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if (statusModule('publish', 'albums') == 1) { ?>
                            <li>
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>photos"><?php echo $_LANG['photos']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if (statusModule('publish', 'videos') == 1) { ?>
                            <li class="nav-item">
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>videos"><?php echo $_LANG['videos']; ?></a>
                            </li class="nav-item">
                        <?php } ?>

                        <?php if (statusModule('publish', 'timetable') == 1) { ?>
                            <li class="nav-item">
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>timetable"><?php echo $_LANG['timetable2']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if (statusModule('publish', 'events') == 1) { ?>
                            <li class="nav-item">
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>events"><?php echo $_LANG['events']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if (statusModule('publish', 'team') == 1) { ?>
                            <li class="nav-item">
                                <a class="nav-link" href="<?php echo PATH_SYSTEM; ?>team"><?php echo $_LANG['team']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if (statusModule('pages') == 1) { ?>
                            <?php if ($LoadPages) { ?>
                                <?php foreach ($LoadPages as $iPage) { ?>
                                    <?php if ($iPage->sub_page == 0) { ?>
                                        <li class="nav-item">
                                            <a class="nav-link" href="<?php echo PATH_SYSTEM . $iPage->url; ?>"><?php echo $iPage->title; ?></a>
                                        </li>
                                    <?php } ?>
                                <?php } ?>

                                <li class="nav-item dropdown">
                                    <a id="dropdown-toggle" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" data-bs-auto-close="true" aria-expanded="false"><?php echo $_LANG['more']; ?></a>
                                    <ul class="dropdown-menu">
                                        <?php foreach ($LoadPages as $iPage) { ?>
                                            <?php if ($iPage->sub_page == 1) { ?>
                                                <li>
                                                    <a class="dropdown-item" href="<?php echo PATH_SYSTEM . $iPage->url; ?>"><?php echo $iPage->title; ?></a>
                                                </li>
                                            <?php } ?>
                                        <?php } ?>
                                    </ul>
                                </li>
                            <?php } ?>
                        <?php } ?>
                    </ul>

                    <div class="d-none d-lg-block">
                        <?php if (statusModule('users', 'clients') == 1) {
                            if ($clientId) { ?>
                                <div class="dropdown">
                                    <a href="#" class="text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                        <img src="<?php echo PATH_SYSTEM; ?>public/avatar/<?php echo $client->avatar; ?>" alt="<?php echo $client->full_name; ?>" width="32" height="32" class="rounded-circle avatar-user">
                                    </a>
                                    <ul class="dropdown-menu dropdown-menu-end">
                                        <li><a class="dropdown-item" href="<?php echo PATH_SYSTEM; ?>profile"><?php echo $_LANG['profile']; ?></a></li>
                                        <?php if ($client->level > 0) { ?>
                                            <li>
                                                <hr class="dropdown-divider">
                                            </li>
                                            <li><a class="dropdown-item" href="#" onclick="window.open('<?php echo PATH_SYSTEM; ?>admin','_blank')"><?php echo $_LANG['panel-admin']; ?></a></li>
                                        <?php } ?>
                                        <li>
                                            <hr class="dropdown-divider">
                                        </li>
                                        <li><a id="logout-md" class="dropdown-item" href="<?php echo PATH_SYSTEM; ?>logout"><?php echo $_LANG['logout']; ?></a></li>
                                    </ul>
                                </div>
                            <?php } else { ?>
                                <button class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#modalLogin"><span class="fas fa-user"></span> <?php echo $_LANG['login'] ?></button>
                        <?php }
                        } ?>
                    </div>

                </div>
            </div>
        </div>
    </nav>
</header>


<div class="container">
    <div class="row">
        <?php
        $widgetPos = 1;
        include PATH_VIEW . '/layout/widget.tpl';
        ?>
    </div>
</div>
