<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dashboard - Ticket Management App</title>
    <%- include('partials/bootstrapcss') %> <%- include('partials/bootstrapcss')
    %>

    <style>
      .dashboard-container {
        display: flex;
        padding: 0;
        min-height: 100vh;
      }

      .dashboard-nav {
        background-color: #333;
        /* color: #fff; */
        padding: 20px;
        flex: 0 0 250px;
      }

      .dashboard-content {
        flex: 1;
        padding: 50px;
        background-color: #f5f5f5;
      }

      .dashboard-nav ul {
        list-style: none;
        padding: 0;
      }

      .dashboard-nav li {
        margin-bottom: 15px;
      }

      .dashboard-nav a {
        text-decoration: none;
        color: #fff;
        font-size: 18px;
      }

      .dashboard-btn {
        padding: 10px 20px;
        background-color: #333;
        color: #fff;
        border: none;
        cursor: pointer;
      }

      /*form */
      .create-ticket-container {
        max-width: 600px;
        margin: 0 auto;
        padding: 50px;
        background-color: #f5f5f5;
      }

      .create-ticket-form label {
        display: block;
        margin-bottom: 10px;
      }
      .description {
        width: 100%;
      }
      .create-ticket-form select,
      .create-ticket-form input {
        width: 100%;
        padding: 10px;
        margin-bottom: 15px;
        border: 1px solid #ccc;
      }

      .create-ticket-btn {
        padding: 10px 20px;
        background-color: #333;
        color: #fff;
        border: none;
        cursor: pointer;
      }
      @media (max-width: 767px) {
        .dashboard-content {
          padding: 1rem;
        }
        .dashboard-container {
          display: flex;
          flex-direction: column;
        }
        .dashboard-nav {
          background-color: #333;
          padding: 20px;
          flex: 0 0 0;
        }
      }
    </style>
  </head>
  <body>
    <%- include('partials/dashboardnavbar') %>

    <div class="container-fluid dashboard-container">
      <nav class="dashboard-nav">
        <ul>
          <li>
            <a
              type="button"
              class="btn btn-primary"
              data-bs-toggle="modal"
              data-bs-target="#staticBackdrop"
              href="#"
              >Create New Ticket</a
            >
          </li>
          <!-- Button trigger modal -->

          <!-- Modal -->
          <div
            class="modal fade"
            id="staticBackdrop"
            data-bs-backdrop="static"
            data-bs-keyboard="false"
            tabindex="-1"
            aria-labelledby="staticBackdropLabel"
            aria-hidden="true"
          >
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h1 class="modal-title fs-5" id="staticBackdropLabel">
                    Create new Ticket
                  </h1>
                  <button
                    type="button"
                    class="btn-close"
                    data-bs-dismiss="modal"
                    aria-label="Close"
                  ></button>
                </div>
                <div class="modal-body">
                  <form
                    action="/ticket/create"
                    method="post"
                    class="create-ticket-form"
                  >
                    <label for="title">Title</label>
                    <input type="text" id="title" name="title" required />

                    <label for="description">Description</label>
                    <textarea
                      id="description"
                      class="description"
                      name="description"
                      rows="4"
                      required
                    ></textarea>

                    <label for="priority">Priority Level</label>
                    <select id="priority" name="priority" required>
                      <option value="low">Low</option>
                      <option value="medium">Medium</option>
                      <option value="high">High</option>
                    </select>

                    <button class="create-ticket-btn">Create Ticket</button>
                  </form>
                </div>
                <div class="modal-footer">
                  <button
                    type="button"
                    class="btn btn-secondary"
                    data-bs-dismiss="modal"
                  >
                    Close
                  </button>
                </div>
              </div>
            </div>
          </div>
          <li><a href="/ticket/user">My Tickets</a></li>
        </ul>
      </nav>
      <section class="dashboard-content">
        <% if (typeof username!=='undefined') { %>
        <h2>Welcome <%= username %></h2>
        <% } else{ %>
        <h2>Welcome</h2>
        <%}%>
        <!-- <h2>Welcome to Your Dashboard</h2> -->
        <p>Explore your tickets and manage your tasks efficiently.</p>
      </section>
    </div>
    <%- include('partials/footer') %> <%- include('partials/bootstrapjs') %>
  </body>
</html>