<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
      crossorigin="anonymous"
    />
    <script defer
      src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
      crossorigin="anonymous"
    ></script>

    <link rel="stylesheet" href="..\..\stylesheets\library.css">
    <script src="..\..\scripts\library.js"></script>

    <link rel="stylesheet" href="..\..\stylesheets\index.css">
    <script src="..\..\scripts\index.js"></script>

    <title>Library</title>
</head>
<body>
  <div class="container-fluid" style="height: 100vh;">
    <div class="row h-100">
      <%- include('navbar') %>

      <!-- Content -->
      <div class="col-9 scrollable-column p-5" style="background-color: aqua;">
        <!-- Search Bar -->
        <div class="hfit" style="width: 100%;">
          <div class="row row-cols-4" style="padding: 5px;">
            <div style="width: 80%;"><input class="search-bar w-100 h-100" placeholder="Search..."></div>
            <div class="wfit"><button>Search</button></div>
          </div>
        </div>

        <!-- Filters -->
        <div class="row menu">
          <div class="col"><button>Publishers</button></div>
          <div class="col"><button>Genre</button></div>
          <div class="col"><button>Product Type</button></div>
          <div class="col"><button>Rule System</button></div>
          <div class="col"><button>Languages</button></div>
          <div class="col"><button>Format</button></div>
        </div>

        <!-- Order Items and Page Navigation -->
        <div class="row">
          <div class="col">
            <div class="dropdown show">
              <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Order Items
              </a>
              <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
                <a class="dropdown-item" href="#">Action</a>
                <a class="dropdown-item" href="#">Another action</a>
                <a class="dropdown-item" href="#">Something else here</a>
              </div>
            </div>
          </div>
          <div class="col">
            <nav aria-label="...">
              <ul class="pagination">
                <li class="page-item disabled">
                  <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a>
                </li>
                <li class="page-item"><a class="page-link" href="#">1</a></li>
                <li class="page-item active" aria-current="page">
                  <a class="page-link" href="#">2</a>
                </li>
                <li class="page-item"><a class="page-link" href="#">3</a></li>
                <li class="page-item">
                  <a class="page-link" href="#">Next</a>
                </li>
              </ul>
            </nav>
          </div>
        </div>


        <!-- Items in Library -->
        <% for (product of products) { %>
        <div class="row">
          <div class="card m-2">
            <div class="card-body">
              <div class="row">
                <div class="col-2">
                  <div style="height: 190px; width: 140px; background-color: red;">
                    <img style="height: 100%; width: 100%;" src=<%= "../../images/products/" + product[0].productimage %>>
                  </div>
                </div>
                <div class="col-sm-10 my-auto">
                  <div class="row">
                    <div class="col-4">
                      <a href=<%= "/store/product/" + product[0].productid %>>
                        <h4><%= product[0].productname %></h4>
                      </a>
                      <a href=<%= "/account/publisher/" + product[1].publisherid %>
                        <h6><%= product[1].publishername %></h6>
                      </a>
                    </div>
                    <div class="col-6">
                      <p><%= "Purchase Date: " + product[2].purchaseDate.toDateString() %></p>
                      <p><%= "Download Date: " + product[2].downloadDate.toDateString() %></p>
                    </div>
                    <div class="col-2">
                      <button class="btn btn-primary">Show/Hide</button>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="card m2">
                  <div class="row">
                    <div class="col-8">
                      <a href="">Download 1</a>
                    </div>
                    <div class="col-2">
                      <p>5000000 MB</p>
                    </div>
                    <div class="col-2">
                      <button class="btn btn-secondary">Download</button>
                    </div>
                  </div>
                  <div class="row">
                    <div class="col-8">
                      <a href="">Download 1</a>
                    </div>
                    <div class="col-2">
                      <p>5000000 MB</p>
                    </div>
                    <div class="col-2">
                      <button class="btn btn-secondary">Download</button>
                    </div>
                  </div>
                  <div class="row">
                    <div class="col-8">
                      <a href="">Download 1</a>
                    </div>
                    <div class="col-2">
                      <p>5000000 MB</p>
                    </div>
                    <div class="col-2">
                      <button class="btn btn-secondary">Download</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <% } %>
        
      </div>
    </div>
  </div>
  </div>


  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
    crossorigin="anonymous"></script>
</body>
</html>