<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
  <script type="text/javascript" th:src="@{/js/equip/equip.js}"></script>
</th:block>
<div layout:fragment="content">
  <main class="pt-3">
    <h4>보안장비현황</h4>
	<ul class="nav nav-tabs" id="boardTab" role="tablist">
      <li class="nav-item" role="presentation">
        <button class="nav-link" th:onclick="|location.href='@{/equip/equipStatus}'|" id="contentTab" data-bs-toggle="tab" data-bs-target="#contentDiv" type="button" role="tab">장비현황</button>
      </li>
      <li class="nav-item" role="presentation">
        <button class="nav-link active" id="logTab" data-bs-toggle="tab" data-bs-target="#logDiv" type="button" role="tab">수정이력</button>    	
      </li>
    </ul>
    <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
    <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
    <div class="row mx-0">
      <div class="col-12 card text-center">
        <div class="card-body">
          <form method="get" th:action="@{/equip/Log}">
            <input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
            <input type="hidden" name="detailType" th:value="${searchParams.detailType}">
            <div class="row justify-content-between pe-3 py-1">
              <div class="col-auto">
                <select class="form-select" name="rowCnt" id="rowCnt">
                  <th:block th:each="num : ${#numbers.sequence(1,5)}">
                    <option th:value="${num*10}" th:text="${num*10}" th:selected="${searchParams.rowCnt==num*10}"></option>
                  </th:block>
                </select>
              </div>
              <div class="col-auto">
                <div class="row justify-content-end">
                  <input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색">
                </div>
              </div>
            </div>
          </form>
          <div class="row justify-content-start">
            <div class="col-12">
              <div class="card">
                <div class="card-body">
                  <div class="row">
                    <table class="table table-striped">
                      <thead>
                      <tr>
                        <th>분류</th>
                        <th>세부분류</th>
                        <th>관서</th>
                        <th>부서</th>
                        <th>수정자</th>
                        <th>수정내용</th>
                        <th>수정일시</th>
                      </tr>
                      </thead>
                      <tbody>
                      <tr th:each="log:${logList}">                     	
                      	<td th:text="${log.equType}"></td>
                      	<td th:text="${log.detailName}" style="color: blue;  cursor:pointer;" th:onclick="|location.href='@{/equip/List(detailType=${log.detailType})}'|"></td>
                      	<td th:text="${log.sosok}"></td>
                      	<td th:text="${log.detailSosok}"></td>
                      	<td th:text="${log.wrtNm}"></td>
                      	<td th:text="${log.elContents}"></td>
                      	<td th:text="${#temporals.format(log.wrtDt, 'yyyy-MM-dd')}"></td>                  	
                      </tr>
                      </tbody>
                    </table>
                  </div>
                   <div class="row justify-content-center">
                    <div class="col-auto">
                      <nav aria-label="Page navigation">
                        <ul class="pagination">
                          <th:block th:if="${searchParams.pageIndex>3}">
                            <li class="page-item" th:data-pageindex="${(searchParams.pageIndex)-3}">
                              <a class="page-link" href="#" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                              </a>
                            </li>
                          </th:block>
                          <th:block th:each="num : ${#numbers.sequence(searchParams.startNum, searchParams.endNum)}">
                            <li class="page-item" th:data-pageindex="${num}" th:classappend="${searchParams.pageIndex==num?'active':''}">
                              <a class="page-link" href="#" th:text="${num}"></a>
                            </li>
                          </th:block>
                          <th:block th:if="${searchParams.maxNum>searchParams.endNum+2}">
                            <li class="page-item" th:data-pageindex="${(searchParams.pageIndex)+3}">
                              <a class="page-link" href="#" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                              </a>
                            </li>
                          </th:block>
                        </ul>
                      </nav>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </main>

</div>
</html>