<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <!-- Bootstrap CSS -->
  <link href="/public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Website CSS -->
  <link rel="stylesheet" type="text/css" href="/public/style.css">

  <title>{% block title %}Lab 03 - Advanced Web{% endblock %}</title>
</head>
<body>
  <header class="site-header">
    <div class="container">
      <div id="header-image"></div>
    </div>
    <!-- This is the menu -->
    <nav class="navbar navbar-expand-md navbar-dark">
      <div class="container">
        <a class="navbar-brand mr-4" href="/">Menu</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggle" aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarToggle">
          <div class="navbar-nav mr-auto">
            <a class="nav-item nav-link" href="/">Home</a>
            <a class="nav-item nav-link" href="/second">Second</a>
            {% if session.get('authenticated') %}
            <a class="nav-item nav-link" href="/account-details">Account Details</a>
            {% else %}
            <a class="nav-item nav-link" href="#">About</a>
            {% endif %}
          </div>
          <!-- Navbar Right Side -->
          <div class="navbar-nav">
            {% if session.get('authenticated') %}
            <a class="nav-item nav-link" href="/logout">Logout</a>
            {% else %}
            <a class="nav-item nav-link" href="/login">Login</a>
            {% endif %}
          </div>
        </div>
      </div>
    </nav>
  </header>

  <!-- Main container follows (with main content + right sidebar) -->
  <main role="main" class="container">
    <div class="row">
      <div class="col-md-8">
        <!-- Left-side content -->
        {% block content %}{% endblock %}
      </div>
      <div class="col-md-4">
        <!-- Right side bar -->
        <div class="content-box" id="account">
          <h4>Your Account</h4>
          {% if session.get('authenticated') %}
          <p class="logged-in">Authenticated as: <strong>{{ session.get('username') }}</strong></p>
          <p>
              <a href="/account-details" class="btn btn-sm btn-outline-primary">Account Details</a>
              <a href="/logout" class="btn btn-sm btn-outline-danger">Logout</a>
          </p>
          {% else %}
          <p class="logged-out">Not authenticated!</p>
          <p>Click <a href="/login">here to login</a></p>
          {% endif %}
        </div>
        <div class="content-box">
          <h4>Changelog</h4>
          <p>
            <ul class="list-group list-group-flush">
              <li class="list-group-item list-group-item-light">
                <div class="d-flex w-100 justify-content-between">
                  <div class="news-item mb-1">We just added authentication!</div>
                  <small class="text-muted">&#128197; 2024-03-31</small>
                </div>
              </li>
              <li class="list-group-item list-group-item-light">
                <div class="d-flex w-100 justify-content-between">
                  <div class="news-item mb-1">&#128151; Migrate to Flask server</div>
                  <small class="text-muted">&#128197; 2024-03-30</small>
                </div>
              </li>
              <li class="list-group-item list-group-item-light">
                <div class="d-flex w-100 justify-content-between">
                  <div class="news-item mb-1">First version of the website</div>
                  <small class="text-muted">&#128197; 2024-03-27</small>
                </div>
              </li>
            </ul>
          </p>
        </div>
      </div>
    </div>
  </main>

  <!-- Include Bootstrap script -->
  <script src="/public/bootstrap/js/bootstrap.bundle.min.js"></script>

</body>
</html>
