<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
      lang="en">
<head th:replace="fragments/loggedInNav :: head(~{::title}, ~{}, ~{})">
  <title>ITems | Document</title>
</head>

<body>

<div th:block sec:authorize="!isAuthenticated()" th:replace="fragments/loggedOutNav :: nav(~{::navbar})"></div>
<div th:block sec:authorize="isAuthenticated()" th:replace="fragments/loggedInNav :: nav(~{::navbar})"></div>

<header class="masthead bg-light mb-3 border-bottom" >
  <div class="container">
    <div class="row gx-4 gx-lg-5 justify-content-center text-center">
      <div class="col-md-10 col-lg-8 col-xl-7">
        <div class="site-heading">
          <h1 class="mt-5">ITems</h1>
          <span class="subheading mb-5">Employee Document Submission</span>
        </div>
      </div>
    </div>
  </div>
</header>

<main>
  <div class="container d-flex justify-content-center align-items-center">
    <div class="border rounded-2 p-3 m-5 bg-light card-lg w-50">
        <h3>List of Documents</h3>
        <table>
          <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Download Link</th>
          </tr>
          </thead>
          <tbody>
          <tr th:each="doc:${document}">
            <td th:text="${doc.id}"></td>
            <td th:text="${doc.docName}"></td>
            <td><a href="@{'/downloadfile/'+${doc.id}}">Download</a></td>
          </tr>
          </tbody>
        </table>
      </div>
      <hr>
    </div>
  </div>
</main>

<div th:block th:replace="fragments/loggedOutNav :: footer(~{::footer})"></div>
</body>
</html>