<!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/cellPhone.js}"></script>
</th:block>
<div layout:fragment="content">
  <main class="pt-3">
    <h4>업무용 휴대전화 현황</h4>
    <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 id="searchFm" method="get" th:action="@{/equip/cellPhoneList}">
          	<input type="hidden" name="excel">
            <input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
            <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">
                  <div class="col-auto">
                    <input type="text" class="form-control form-control-sm">
                  </div>
                  <input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색">
                </div>
              </div>
            </div>
          </form>
          <button data-bs-toggle="modal" data-bs-target="#webexModal" >웹엑스 접속방법</button>
          <button id="goExcel">엑셀다운</button>
          <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> <input type="checkbox" id="chk-all" class="equInfoCheckBox"></th>
                        <th>연번</th>
                        <th>소속</th>
                        <th>전화번호</th>
                        <th>사용자(관리자)</th>
                        <th>등록 외부메일</th>
                        <th>웹엑스 미팅번호</th>
                        <th>카카오톡 ID</th>
                      </tr>
                      </thead>
                      <tbody>
                      <tr class="cellPhoneTr" th:each="cp:${cellPhoneList}">
                      	<td class="cpChk">
                      		<input type="checkbox" name="cpChk" class="cellPhoneCheckBox">
                      		<input type="hidden" class="phoneKey" th:value="${cp.phoneKey}">
                      	</td>
                      	<td th:text="${cp.phoneKey}"></td>
                      	<td th:text="${cp.sosok}"></td>  
                      	<td th:text="${cp.telNo}"></td>
                      	<td th:text="${cp.userNm}"></td>
                      	<td th:text="${cp.extMail}"></td>
                      	<td th:text="${cp.webexNo}"></td>
                      	<td th:text="${cp.katalkId}"></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 class="col-auto">
                  	<button type="button" class="btn btn-danger"id="deleteCellPhone" th:if="${accessAuth eq 'ACC003'}">삭제</button>
                    <button type="button" class="btn btn-success"id="addCellPhone" th:unless="${accessAuth eq 'ACC001'}">등록</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </main>

	<div class="modal fade" id="cellPhoneEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="userEditModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-scrollable">
      <div class="modal-content" id="cellPhoneEditModalContent">
        <div class="modal-header">
        </div>
        <div class="modal-body">
          <div class="tab-content border border-top-0" id="configCellPhone">
          </div>
        </div>
      </div>
    </div>
  </div>

	<div class="modal fade" id="webexModal" data-bs-backdrop="static"
		data-bs-keyboard="false" tabindex="-1"
		aria-labelledby="userInsertModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content ">
				<div class="modal-header">
					<h5 class="modal-title" id="translatorInsertModalLabel">웹엑스 접속방법</h5>
					<button type="button" class="btn-close" data-bs-dismiss="modal"
						aria-label="Close"></button>
				</div>
				<div class="col-auto">
				<div class="text-center">
					<h6>Cisco WebEx Meeting 설치 > 회원가입 > 미팅에 참여 클릭 > 미팅번호 입력</h6>
				</div>
				</div>
			</div>
		</div>
	</div>

</div>
</html>