<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  layout:decorate="~{layout/layout}">
<head>
  <meta charset="UTF-8" th:remove="tag" />
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <link th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" rel="stylesheet" />
</head>
<body>

  <!-- サイドバーの表示 -->
  <div layout:fragment="sidebar" th:replace="~{fragments/sidebar :: sidebar}">
  </div>


  <!-- コンテンツの表示 -->
  <div layout:fragment="content">
    <main class="offcanvas-outside bg-light">
      <div class="container-fluid">

        <!-- トグルボタン -->
        <div th:replace="~{fragments/sidebar :: toggler}">
        </div>

        <div class="row">
          <div class="col">

            <div class="card shadow">
              <div class="card-header">
                <h6 class="text-navy my-2" th:text="${command}"></h6>
              </div>
              <div class="card-body" th:object="${task}">

                <table class="table table-bordered">
                  <thead>
                    <tr>
                      <th>item</th>
                      <th>value</th>
                      <th>comment</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>currentId</td>
                      <td th:text="*{currentId}"></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td>preId</td>
                      <td th:text="*{preId}"></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td th:text="#{citycode}"></td>
                      <td th:text="${citycode}"></td>
                      <td th:text="${cityname}"></td>
                    </tr>
                    <tr>
                      <td th:text="#{meshcode}"></td>
                      <td th:text="*{meshcode}"></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td th:text="#{editor}"></td>
                      <td><a th:text="*{username}" th:href="@{https://www.openstreetmap.org/user/{user}(user=*{username})}"></a></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td th:text="#{changeSet}"></td>
                      <td th:text="*{changeSet}"></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td th:text="#{status}"></td>
                      <td><img th:alt="*{status}" th:src="@{/img/{status}.png(status=*{status})}"></img></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td th:text="#{operation}"></td>
                      <td th:text="*{operation}"></td>
                      <td></td>
                    </tr>
                  </tbody>
                </table>
              
                <hr>

                <form th:action="@{/task/process}" method="post" novalidate>
                  <input type="hidden" id="task" th:value="${task}" />
                  <input type="hidden" th:field="*{currentId}" th:value="*{currentId}" />
                  <input type="hidden" th:field="*{preId}" th:value="*{preId}" />
                  <input type="hidden" th:field="*{citycode}" th:value="*{citycode}" />
                  <input type="hidden" th:field="*{meshcode}" th:value="*{meshcode}" />
                  <input type="hidden" th:field="*{status}" th:value="*{status}" />
                  <input type="hidden" th:field="*{operation}" th:value="*{operation}" />
                  <input type="hidden" th:field="*{changeSet}" th:value="*{changeSet}" />

                  <div class="mb-3">
                    <label for="username" class="form-label">
                      <span class="badge bg-danger">必須</span>
                      編集者
                    </label>
                    <input class="form-control" type="text" th:errorclass="is-invalid" th:field="*{username}" th:value="*{username}" />
                    <div class="invalid-feedback" th:errors="*{username}">
                    </div>
                  </div>
                  
                  <div class="mb-3">
                    <label for="username" class="form-label">
                      コメント
                    </label>
                    <textarea class="form-control" rows="4" th:errorclass="is-invalid" th:field="*{comment}">
                    </textarea>
                    <div class="invalid-feedback" th:errors="*{comment}">
                    </div>
                  </div>

                  <p class="error_red" th:text="${error}"></p>
                  <p class="error_red" th:text="${message}"></p>

                  <a th:text="#{return}" th:href="@{/tasks?citycode={citycode}&meshcode={meshcode}(citycode=*{citycode},meshcode=*{meshcode})}" class="btn btn-navy">
                  </a>
            
                  <button class="btn btn-navy col-4">
                    <i class="bi bi-pencil-square" th:text="${command}"></i>
                  </button>

                </form>
              </div>
            </div>

          </div>
        </div>
      </div>
    </main>
  </div>
</body>
</html>
