<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
  <th:block layout:fragment="header">
    <ul class="navbar-nav mb-2 mb-lg-0">
      <li class="nav-item"><a th:href="@{/}" class="btn btn-secondary btn-icon-silent">Hauptseite</a></li>
    </ul>
    <ul class="navbar-nav mb-2 mb-lg-0">
      <li class="nav-item"><a th:href="@{/confirmation}" class="btn btn-secondary btn-icon-silent">Anmeldungen</a></li>
    </ul>
  </th:block>
  <th:block layout:fragment="content">
    <div class="mainpage">
      <div class="container" style="max-width: 100%" sec:authorize="hasRole('registrator')">
        <form action="#" th:action="@{/confirmation/person/update}" th:object="${person}" method="post" th:if="${person != null}">
          <div class="row mb-2">
            <label for="outputPk" class="col-sm-2 col-form-label">ID</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{pk}" class="outputPk form-control locked"></span>
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputForename" class="col-sm-2 col-form-label">Vorname</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{forename}" class="inputForename form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputSurname" class="col-sm-2 col-form-label">Nachname</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{surname}" class="inputSurname form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputStreet" class="col-sm-2 col-form-label">Straße</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{street}" class="inputStreet form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputZip" class="col-sm-2 col-form-label">PLZ</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{zip}" class="inputZip form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputCity" class="col-sm-2 col-form-label">Ort</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{city}" class="inputCity form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputBirthdate" class="col-sm-2 col-form-label">Geburtstag (TODO)</label>
            <div class="col-sm-10">
              <input type="date" th:field="*{birthdate}" class="inputBirthdate form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputSex" class="col-sm-2 col-form-label">Geschlecht</label>
            <div class="col-sm-10">
              <select class="form-select" th:field="*{sex}">
                <option value="male">männlich</option>
                <option value="female">weiblich</option>
              </select>
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputPhone" class="col-sm-2 col-form-label">Telefon</label>
            <div class="col-sm-10">
              <input type="text" th:field="*{phone}" class="inputPhone form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputEmail" class="col-sm-2 col-form-label">E-Mail</label>
            <div class="col-sm-10">
              <input type="email" th:field="*{email}" class="inputEmail form-control" />
            </div>
          </div>
          <div class="row mb-2">
            <label for="outputCamp" class="col-sm-2 col-form-label">Freizeit</label>
            <div class="col-sm-10">
              <select class="form-select locked" th:field="*{fkCamp}" disabled="disabled">
                <option th:each="c : ${camps}" th:value="${c.pk}" th:text="${c.name} + ' ' + ${#temporals.format(c.arrive, 'yyyy')} + ' in ' + ${c.location}"></option>
              </select>
            </div>
          </div>
          <div class="row mb-2">
            <label for="outputCamprole" class="col-sm-2 col-form-label">Rolle</label>
            <div class="col-sm-10">
              <select class="outputCamprole form-select" th:field="*{camprole}">
                <option value="student">Teilnehmer</option>
                <option value="teacher">Mitarbeiter</option>
                <option value="director">Leiter</option>
                <option value="feeder">Küchenteam</option>
              </select>
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputComment" class="col-sm-2 col-form-label">Kommentar</label>
            <div class="col-sm-10">
              <textarea th:field="*{comment}" class="inputComment form-control"></textarea>
            </div>
          </div>
          <div class="row mb-2">
            <label for="outputAnno" class="col-sm-2 col-form-label">Anmerkungen</label>
            <div class="col-sm-10">
              <pre class="form-control locked" th:text="${annotations}"></pre>
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputAccept" class="col-sm-2 col-form-label">Status</label>
            <div class="col-sm-10">
              <div class="form-group">
                <input type="radio" class="btn-check" id="accept1" name="accept1" value="" th:field="*{accept}" /> <label class="btn btn-outline-primary" for="accept1"><i
                  class="fas fa-question"></i>&nbsp;offen</label> <input type="radio" class="btn-check" id="accept2" name="accept2" value="true" th:field="*{accept}" /> <label class="btn btn-outline-success"
                  for="accept2"><i class="fas fa-check"></i>&nbsp;bestätigt</label> <input type="radio" class="btn-check" id="accept3" name="accept3" value="false" th:field="*{accept}" /> <label
                  class="btn btn-outline-danger" for="accept3"><i class="fas fa-ban"></i>&nbsp;abgelehnt</label>
              </div>
            </div>
          </div>
          <div class="row mb-2">
            <label for="inputAccept" class="col-sm-2 col-form-label"></label>
            <div class="col-sm-10">
              <button type="submit" class="btn btn-primary" onclick="progress.start()">Ok</button>
              <a th:href="@{/confirmation/}" class="btn btn-secondary">Abbrechen</a>
            </div>
          </div>
        </form>
        <div th:if="${person == null}" class="error">In der Datenbank wurde keine Person mit entsprechender ID gefunden.</div>
      </div>
    </div>
  </th:block>
</body>
</html>
