<!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}, ~{}, ~{})">
  <meta charset="UTF-8">
  <title>Add Location</title>
</head>
<body>

<div th:block sec:authorize="isAuthenticated()" th:replace="fragments/loggedInNav :: nav(~{::navbar})"></div>
<div th:block sec:authorize="isAnonymous()" th:replace="fragments/loggedOutNav :: 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">Add Location Form</span>
        </div>
      </div>
    </div>
  </div>
</header>

<div class="container w-50">
  <h2>Add Location</h2>
  <form th:action="@{/admin/saveLocation}" th:object="${location}" method="post">
    <input type="text" th:field="*{locationName}" placeholder="Enter name" class="form-control col-4 mb-4"/>
    <input type="text" th:field="*{address}" placeholder="Enter address" class="form-control col-4 mb-4"/>
    <input type="text" th:field="*{city}" placeholder="Enter city" class="form-control col-4 mb-4"/>
    <input type="text" th:field="*{province}" placeholder="Enter province" class="form-control col-4 mb-4"/>
    <input type="text" th:field="*{postalCode}" placeholder="Enter postal code" class="form-control col-4 mb-4"/>
    <button class="btn btn-primary" type="submit">Save</button>
    <input type="hidden" th:field="*{id}" />
  </form>
  <hr/>
  <a th:href="@{/admin/list/locations}">Back to List</a>
</div>
</body>
</html>