<nav class="navbar navbar-expand-lg bg-body-tertiary">
    <div class="container-fluid">
        <a class="navbar-brand" href="/home" hx-push-url="/home" hx-get="/home" hx-target="#main">
            <img src="/imgs/dogstats-50.png" alt="Logo" width="50" height="50" class="d-inline-block align-text-top">
            Dogstats
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav ms-auto mb-2 mb-lg-0">


                <?php foreach(getMenu() as $item) : ?>
                <li <?php if (count($item['submenu'])) : ?>

                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle <?= $item['menu_classes'] ?>" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                        <i class="<?= $item['image'] ?>"></i>
                        <?= $item['text']?>
                    </a>
                    <ul class="dropdown-menu">
                        <?php foreach($item['submenu'] as $sub) : ?>
                        <?php if($sub['text']=='divider') : ?>
                            <li><hr class="dropdown-divider"></li>
                        <?php else : ?>
                            <li>
                                <a href="<?= $sub['action'] ?>" hx-push-url="<?= $sub['action'] ?>" hx-get="<?= $sub['action'] ?>" hx-target="#main" class="dropdown-item <?= $sub['classes']?:'' ?>">
                                    <?php if($sub['icon']) : ?>
                                    <i class="<?= $sub['icon'] ?>"></i>
                                    <?php endif; ?>

                                    <?= $sub['text'] ?>
                                </a>
                            </li>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </ul>
                </li>
                <?php else : ?>
                <li class="nav-item">
                    <a class="nav-link <?= $item['menu_classes'] ?>" aria-current="page" href="/<?= $item['url'] ?>" hx-push-url="/<?= $item['url'] ?>" hx-get="/<?= $item['url'] ?>" hx-target="#main">
                        <i class="<?= $item['image'] ?>"></i>
                        <?= $item['text'] ?>
                    </a>
                </li>

                <?php endif; ?>
                </li>

                <?php endforeach; ?>

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