<?php

require_once __DIR__ . '/../config/app.php';

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

?>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary shadow">

    <div class="container">

        <a class="navbar-brand" href="<?= BASE_URL ?>/dashboard.php">

            <i class="fa-solid fa-school"></i>

            Survey System

        </a>

        <button
            class="navbar-toggler"
            type="button"
            data-bs-toggle="collapse"
            data-bs-target="#menu">

            <span class="navbar-toggler-icon"></span>

        </button>

        <div class="collapse navbar-collapse" id="menu">

            <ul class="navbar-nav me-auto">

                <li class="nav-item">
                    <a class="nav-link"
                       href="<?= BASE_URL ?>/dashboard.php">
                        Dashboard
                    </a>
                </li>

                <li class="nav-item">
                    <a class="nav-link"
                       href="<?= BASE_URL ?>/survey/add_survey.php">
                        New Survey
                    </a>
                </li>

                <li class="nav-item">
                    <a class="nav-link"
                       href="<?= BASE_URL ?>/survey/view_surveys.php?id=1">
                        Surveys
                    </a>
                </li>

                <?php if(isset($_SESSION['role']) && $_SESSION['role'] == 'zonal_director'){ ?>

                    <li class="nav-item">
                        <a class="nav-link" href="<?= BASE_URL ?>/admin/export_options.php">
                            Reports
                        </a>
                    </li>

                <?php } ?>

                <?php if(isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){ ?>

                <li class="nav-item">
                    <a class="nav-link"
                       href="<?= BASE_URL ?>/admin/manage_schools.php">
                        Schools
                    </a>
                </li>

                <li class="nav-item">
                    <a class="nav-link"
                       href="<?= BASE_URL ?>/admin/admin_update.php">
                        Update
                    </a>
                </li>

                <?php } ?>

            </ul>

            <ul class="navbar-nav">

                <?php if(isset($_SESSION['fullname'])) { ?>

                <li class="nav-item">
                    <span class="nav-link text-warning">
                        Welcome, <?= htmlspecialchars($_SESSION['fullname']) ?>
                    </span>
                </li>

                <?php } ?>

                <li class="nav-item">
                    <a class="nav-link"
                       href="<?= BASE_URL ?>/logout.php">
                        Logout
                    </a>
                </li>

            </ul>

        </div>

    </div>

</nav>