<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="row">
  <div class="col-12">
    <form method="get" action="#" id="modalSearchForm">
      <input type="hidden" name="userStatus" id="userStatus" th:value="${searchParams.userStatus}">
      <input type="hidden" name="pageIndex" id="modalPageIndex" th:value="${searchParams.pageIndex}">
      <input type="hidden" name="rowCnt" value="10">
      <div class="row justify-content-end pe-3 py-1">
        <div class="col-auto">
          <div class="row justify-content-end">
            <div class="col-auto">
              <select class="form-select form-select-sm" name="ogCd">
                <option value="">관서 선택</option>
                <th:block th:each="commonCode:${OgList}">
                  <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.ogCd==commonCode.itemCd}"></option>
                </th:block>
              </select>
            </div>
            <div class="col-auto">
              <select class="form-select form-select-sm" name="ofcCd">
                <option value="">부서 선택</option>
                <th:block th:each="commonCode:${OfcList}">
                  <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.ofcCd==commonCode.itemCd}"></option>
                </th:block>
              </select>
            </div>
            <div class="col-auto">
              <input type="text" class="form-control form-control-sm" name="userNm" placeholder="사용자명" th:value="${searchParams.userNm}">
            </div>
            <div class="col-auto">
              <input type="text" class="form-control form-control-sm" name="userId" placeholder="사용자 아이디" th:value="${searchParams.userId}">
            </div>
            <input type="button" class="btn btn-sm btn-primary col-auto" id="searchModalBtn" 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 class="table-secondary">
                  <th><input type="checkbox" class="allChk"></th>
                  <th>소속</th>
                  <th>부서</th>
                  <th>계급</th>
                  <th>성명</th>
                  <th>아이디</th>
                  <th>등록일</th>
                </tr>
                </thead>
                <tbody>
                <tr class="userInfoTr" th:each="userInfo:${userInfoList}">
                  <input type="hidden" class="userSeq" th:value="${userInfo.userSeq}">
                  <input type="hidden" class="ogCd" th:value="${userInfo.ogCd}">
                  <input type="hidden" class="ofcCd" th:value="${userInfo.ofcCd}">
                  <input type="hidden" class="titleCd" th:value="${userInfo.titleCd}">
                  <input type="hidden" class="userNm" th:value="${userInfo.userNm}">
                  <td>
                    <input type="checkbox" name="userChk" class="userInfoCheckBox" th:value="${userInfo.userSeq}">
                  </td>
                  <th:block th:each="commonCode:${session.commonCode.get('OG')}">
                    <th:block th:if="${commonCode.itemCd == userInfo.ogCd}">
                      <td th:text="${commonCode.itemValue}"></td>
                    </th:block>
                  </th:block>
                  <th:block th:each="commonCode:${session.commonCode.get('OFC')}">
                    <th:block th:if="${commonCode.itemCd == userInfo.ofcCd}">
                      <td th:text="${commonCode.itemValue}"></td>
                    </th:block>
                  </th:block>
                  <td></td>
                  <td th:text="${userInfo.userNm}"></td>
                  <td th:text="${userInfo.userId}"></td>
                  <td th:text="${#temporals.format(userInfo.wrtDt, 'yyyy-MM-dd HH:mm:ss')}"></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 modalPage" 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 modalPage" 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 modalPage" 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>
</html>