<!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 | Request</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" >
  <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>
          <p class="mb-5">
            Request # <span class="subheading" th:text="${request.id}"></span>
          </p>
        </div>
      </div>
    </div>
  </div>
</header>

<main>
  <div class="container px-4 px-lg-5">
    <div class="card p-3 mb-5" sec:authorize="isAuthenticated()">
      <div class="card-header">
        <h3  th:text="${request.title}"></h3>
        <p>
          Submitted by: <span class="subheading text-info" th:text="${request.employee.firstName}"></span>
        </p>
        <p>
          Request Type: <span class="subheading text-info" th:text="${request.requestType}"></span>
        </p>
        <p>
          Request Status:
          <span class="subheading text-info fw-bold text-warning"  th:if="${request.status == request.status.PENDING} ">Pending</span>
          <span class="subheading text-info fw-bold text-success" th:if="${request.status == request.status.APPROVED}">Approved</span>
          <span class="subheading text-info fw-bold text-danger" th:if="${request.status == request.status.DENIED}">Denied</span>
        </p>
      </div>
      <div class="card-body">
        <p th:text="${request.body}"></p>
      </div>
      <hr class="my-4" />
      <p class="post-meta text-end">
        Posted on: <span th:text="${request.creationTS}"></span>
      </p>
    </div>
  </div>
</main>

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


</body>
</html>