<?php
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="navbar.css">
    <!-- font-awesome css -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link href="https://cdn.jsdelivr.net/npm/daisyui@latest/dist/full.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com"></script>

</head>
<body>
    <header class="header">
        <div class="logo">
            <a href="index">
            <img src="pic/TEMPHIRE_LOGO.png" alt="TEMPHIRE LOGO">
            </a>
        </div>
        <nav class="nav-links">
            <a href="index">Home</a>
            <a href="aboutus">About us</a>
            <a href="contactus">Contact us</a>

            <?php
            

            if (isset($_SESSION['username'])) {
                $username = $_SESSION['username'];
                $user_type = $_SESSION['user_type'];

               if ($user_type === 'Employer') {
                    // Employer dropdown
                    echo '
                    <div class="dropdown">
                        <a href="#" class="user-icon">
                            <i class="fas fa-user"></i> ' . htmlspecialchars($username) . '
                        </a>
                        <div class="dropdown-menu">
                            <a class="dropdown-item" href="employerprofile">Profile</a>
                            <a class="dropdown-item" href="employerdash">Dashboard</a>
                            <a class="dropdown-item" href="logout">Logout</a>
                        </div>
                    </div>';
                } else {
                    // Jobseeker dropdown
                    echo '
                    <div class="dropdown">
                        <a href="#" class="user-icon">
                            <i class="fas fa-user"></i> ' . htmlspecialchars($username) . '
                        </a>
                        <div class="dropdown-menu">
                            <a class="dropdown-item" href="jobseekerprofile">Profile</a>
                            <a class="dropdown-item" href="jobseekerdash">Dashboard</a>
                            <a class="dropdown-item" href="logout">Logout</a>
                        </div>
                    </div>';
                }
            } else {
                // If not logged in, show login button
                echo '<a href="login">Login</a>';
            }
            ?>
          
        </nav>
    </header>
    
</body>
</html>
