<!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 Job Opening</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 Job Opening</span>
        </div>
      </div>
    </div>
  </div>
</header>

<div class="container w-50">
  <h2>Add Job Opening</h2>
  <form th:action="@{/admin/saveJob}" th:object="${job}" method="post">
    <input type="text" th:field="*{title}" placeholder="Enter title" class="form-control col-4 mb-4"/>
    <lable>Job Description</lable>
    <textarea th:field="*{body}" style="width:100%; height:600px">Enter Job Description</textarea>
    <script>
      tinymce.init({
        selector: '#body',
        plugins: 'link lists media code',
        toolbar: 'alignleft aligncenter alignright alignjustify | formatselect | bullist numlist | outdent indent | link code',
        toolbar_mode: 'floating'
      });
    </script>
    <br/>
    <label for="floatingType">Job Status</label>
      <select th:field="*{status}" placeholder="Enter job status" id="floatingType" class="form-control form-control-sm col-2 mb-4">
        <option value="OPEN">Open</option>
        <option value="FILLED">Filled</option>
      </select>

    <button class="btn btn-primary" type="submit">Save</button>
    <input type="hidden" th:field="*{id}" />
    <input type="hidden" th:field="${job.creationTS}" />
  </form>
  <hr/>
  <a th:href="@{/admin/list/job}">Back to List</a>
</div>

</body>
</html>