<?php
// Pārbaudi, vai sesija jau ir aktīva
if (session_status() === PHP_SESSION_NONE) {
    session_start(); // Sāk sesiju tikai, ja tā nav jau aktīva
}

// Pārbaudi, vai sesija satur 'name' un 'email' informāciju
if (!isset($_SESSION['name'])) {
    $_SESSION['name'] = 'Gari Poter'; // Noklusējuma vārds, ja nav iestatīts
}
if (!isset($_SESSION['email'])) {
    $_SESSION['email'] = 'GarryPotter@hotmail.ru'; // Noklusējuma epasts, ja nav iestatīts
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TaskPro</title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Roboto', sans-serif;
            background-color: #f4f4f9;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .logo {
            font-size: 24px;
            font-weight: 700;
            color: #222;
            display: flex;
            align-items: center;
        }

        .menu-icon {
            margin-right: 10px;
        }

        .button-group {
            display: flex;
            gap: 10px;
        }

        .button-group button,
        .button-group a {
            padding: 10px 20px;
            background-color: #0000ff;
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            font-weight: 500;
            text-decoration: none; /* Remove underline from links */
            display: inline-block; /* To make the link look like a button */
        }

        .button-group a.button {
            padding: 10px 20px;
            background-color: #0000ff;
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            font-weight: 500;
            text-decoration: none; /* No underline */
            display: inline-block; /* Link looks like a button */
        }

        .button-group a:hover,
        .button-group button:hover,
        .button-group a.button:hover {
            background-color: #0056b3; /* Darker blue for hover effect */
        }

        .profile {
            display: flex;
            align-items: center;
        }

        .profile img {
            border-radius: 50%;
            width: 50px;
            height: 50px;
            margin-left: 10px;
        }

        .profile p {
            margin-right: 10px;
            color: #666;
            font-size: 14px;
        }

        .task-overview {
            margin: 20px 0;
        }

        h2 {
            font-size: 24px;
            margin-bottom: 20px;
        }

        .task-columns {
            display: flex;
            gap: 20px;
        }

        .column {
            flex: 1;
            background-color: #e0e0e0;
            padding: 20px;
            border-radius: 8px;
        }

        .column h3 {
            font-size: 18px;
            margin-bottom: 15px;
        }

        .task-item {
            background-color: white;
            padding: 10px;
            border-radius: 4px;
            margin-bottom: 10px;
        }

        .task-item:last-child {
            margin-bottom: 0;
        }

        .task-controls {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }

        .task-controls button {
            background-color: white;
            color: #222;
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius: 20px;
            cursor: pointer;
        }
    </style>
</head>
<body>

    <div class="container">
        <header>
            <div class="logo">
                <span class="menu-icon">☰</span>
                <span>TaskPro</span>
            </div>
            <div class="button-group">
                <!-- Link to the new assign_task.php page -->
                <a href="assign_task.php" class="button">Assign Task</a>
                <button onclick="window.location.href='track_task.php'">Track Task</button>
                <a href="report.php" target="_blank" class="back-button">Reports</a>
                <button onclick="window.location.href='settings.php'">Settings</button>
                <a href="/logout" class="button">Logout</a> <!-- Logout link is now styled as a button -->
            </div>

            <div class="profile">
                <p><?php echo $_SESSION['name']; ?> <br> <?php echo $_SESSION['email']; ?></p>
                <img src="https://shorturl.at/44zLJ" alt="Profile">
            </div>
        </header>

        <div class="task-controls">
            <button>Filter</button>
            <button>Sort</button>
        </div>

        <div class="task-overview">
            <h2>Task Overview</h2>
            <div class="task-columns">
                <div class="column">
                    <h3>New Tasks</h3>
                    <div class="task-item">Update website content</div>
                    <div class="task-item">Team meeting preparation</div>
                    <div class="task-item">Client feedback review</div>
                </div>

                <div class="column">
                    <h3>In Progress</h3>
                    <div class="task-item">Design new feature</div>
                    <div class="task-item">Bug fixing</div>
                </div>

                <div class="column">
                    <h3>Completed</h3>
                    <div class="task-item">Project documentation</div>
                    <div class="task-item">Code review</div>
                    <div class="task-item">Deploy to production</div>
                </div>
            </div>
        </div>
    </div>

</body>
</html>
