<!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/translator/translator.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="@{/translator/info}">
            <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">
                    <select class="form-select form-select-sm" name="dmlYn">
	               	   <option value="">-해촉 선택-</option>
	                   <option value="O" th:selected="${'O' eq searchParams.dmlYn}">O</option>
	                   <option value="X" th:selected="${'X' eq searchParams.dmlYn}">X</option>
	                </select>
                  </div>
                  <div class="col-auto">
                    <select class="form-select form-select-sm" name="ogdp1">
                      <option value="">관서 선택</option>
                      <th:block th:each="commonCode:${session.commonCode.get('OG')}">
                          <th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
                            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.ogdp1}"></option>
                          </th:block>
                        </th:block>
                      </select>
                  </div>
                  <div class="col-auto">
                     <select class="form-select form-select-sm" name="trLang">
		                  <option value="">언어 선택</option>
		                  <th:block th:each="commonCode:${session.commonCode.get('LGG')}">
		                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.trLang}"></option>
		                  </th:block>
		               </select>
                  </div>
                  <div class="col-auto">
                    <input type="text" class="form-control form-control-sm" name="trName" th:value="${searchParams.trName}" placeholder="성명">
                  </div>
                  <input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색">
                </div>
              </div> 
            </div>
            <div class="row justify-content-between py-1">          
            <div class="col-auto">
             <div class="row justify-content-end">
              <div class="col-auto">
                <select class="form-select form-select-sm" id="trVisa" name="trVisa">
                  <option value="">비자 선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('VISA')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.trVisa}"></option>
                  </th:block>
               </select>
              </div>
               <div class="col-auto">
                <select class="form-select form-select-sm" id="trNny" name="trNny">
                  <option value="">국적선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('NNY')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.trNny}"></option>
                  </th:block>
               </select>
              </div>
               <div class="col-auto">
                <input type="text" class="form-control" id="aptDt" name="aptDt" th:value="${searchParams.aptDt}" placeholder="위촉일">
               </div>
             </div>           
            </div>
            </div>
          </form> 
          <div class="row justify-content-start">
            <div class="col-12">
              <div class="card">
                <div class="card-body">
                  <div class="row">
                  <input type="hidden" id="selectedKey">
                  <input type="hidden" id="selectedVerNo">
                    <table class="table table-striped">
                      <thead>
                      <tr>
                        <th>연번</th>
                        <th>관서명</th>
                        <th>언어</th>
                        <th>경력</th>
                        <th>성명</th>
                        <th>성별</th>
                        <th>나이</th>
                        <th>국적</th>
                        <th>학력</th>
                        <th>자격증</th>
                        <th>비자</th>
                        <th>해촉</th>
                        <th>위촉일</th>
                        <th>연락처</th>
                      </tr>
                      </thead>
                      <tbody>
                      <tr class="userInfoTr" data-bs-toggle="dropdown" aria-expanded="false" th:each="trInfo:${translatorList}">
                      <th:block>
                      <input type="hidden" class="trKey" th:value="${trInfo.translatorKey}">
                      <input type="hidden" class="verNo" th:value="${trInfo.versionNo}">
                      </th:block>
                       <td>
                       	<p class="m-0" th:text="${trInfo.translatorKey}"></p>
	                     <ul class="dropdown-menu">
						   <li><a class="dropdown-item careerInfo" href="#">경력관리</a></li>
						   <li><a class="dropdown-item translatorInfo" href="#">인적사항</a></li>
						 </ul>
					   </td>
                       <td th:text="${trInfo.ogdp1}"></td>
                       <td th:text="${trInfo.trLang}"></td>
                       <td th:text="${trInfo.trCareer}"></td>
                       <td th:text="${trInfo.trName}"></td>
                       <td th:text="${trInfo.trAge}"></td>
                       <td th:text="${trInfo.trSex}"></td>
                       <td th:text="${trInfo.trNny}"></td>
                       <td th:text="${trInfo.trEdu}"></td>
                       <td th:text="${trInfo.trCft}"></td>
                       <td th:text="${trInfo.trVisa}"></td>
                       <td th:if="${trInfo.dmlYn == 'O'}">●</td>
                       <td th:unless="${trInfo.dmlYn == 'O'}"></td>
                       <td th:text="${trInfo.aptDt}"></td>
                       <td th:text="${trInfo.trPhone}"></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 class="col-auto">
			          <button data-bs-toggle="modal" data-bs-target="#translatorInsertModal" th:unless="${accessAuth eq 'ACC001'}">등록</button>
			          <button id="goExcel">엑셀다운</button>
			        </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </main>
  
  <div class="modal fade" id="translatorInsertModal" 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>
        <form id="translatorInsert" action="#" method="post">
        <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
   		<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
          <div class="mb-3 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">관서</label>
            <div class="col-sm-2">
               <select class="form-select form-select-sm" id="ogdp1" name="ogdp1" th:disabled="${accessAuth ne 'ACC003'}">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('OG')}">
                    <th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
                      <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq userOrgan}"></option>
                    </th:block>
                  </th:block>
                </select>
            </div>
            <label for="ofcCd" class="col-sm-1 col-form-label text-center">언어</label>
            <div class="col-sm-2">
              <select class="form-select form-select-sm" id="lang" name="trLang">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('LGG')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                  </th:block>
               </select>
            </div>
           <label for="ofcCd" class="col-sm-1 col-form-label text-center">경력</label>
            <div class="col-sm-4">
              <input type="text" class="form-control" id="trCareer" name="trCareer">
            </div> 
          </div>
          <div class="mb-3 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">성명</label>
            <div class="col-sm-2">
              <input type="text" class="form-control" id="trName" name="trName">
            </div>
            <label for="ofcCd" class="col-sm-1 col-form-label text-center">성별</label>
            <div class="col-sm-2">
              <select class="form-select form-select-sm" name="trSex">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('SEX')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                  </th:block>
               </select>
            </div>
           <label for="ofcCd" class="col-sm-1 col-form-label text-center">연락처</label>
            <div class="col-sm-4">
              <input type="text" class="form-control" id="trPhone" name="trPhone">
            </div> 
          </div>
          <div class="mb-3 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">국적</label>
            <div class="col-sm-2">
               <select class="form-select form-select-sm" id="trNny" name="trNny">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('NNY')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                  </th:block>
               </select>
            </div>
            <label for="ofcCd" class="col-sm-1 col-form-label text-center">나이</label>
            <div class="col-sm-2">
              <input type="text" class="form-control" id="trAge" name="trAge">
            </div>
           <label for="ofcCd" class="col-sm-1 col-form-label text-center">학력</label>
            <div class="col-sm-4">
              <select class="form-select form-select-sm" name="trEdu">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('EDU')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                  </th:block>
               </select>
            </div> 
          </div>
          <div class="mb-3 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">자격증</label>
            <div class="col-sm-2">
              <input type="text" class="form-control" id="trCft" name="trCft">
            </div>
            <label for="ofcCd" class="col-sm-1 col-form-label text-center">비자</label>
            <div class="col-sm-2">
              <select class="form-select form-select-sm" id="trVisa" name="trVisa">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('VISA')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                  </th:block>
               </select>
            </div>
           <label for="ofcCd" class="col-sm-1 col-form-label text-center">위촉일</label>
            <div class="col-sm-4">
               <input type="text" class="form-control" id="aptDt" name="aptDt">
            </div> 
          </div>
          <div class="mb-3 row">
          <label for="ogCd" class="col-sm-2 col-form-label text-center">해촉</label>
            <div class="col-sm-2">
               <select class="form-select form-select-sm" id="dmlYn" name="dmlYn">
               	  <option value="">선택</option>
                  <option value="O">O</option>
                  <option value="X">X</option>
               </select>
            </div>
		  </div>
            <div class="mb-3 row">
              <label for="tel" class="col-sm-2 col-form-label text-center">비고</label>
              <div class="col-sm-4">
                <textarea  class="form-control" id="remark" name="remark"></textarea>
              </div>              
            </div>
            </form>      
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="closeModalBtn">닫기</button>
            <button type="button" class="btn btn-primary" id="saveBtn">등록</button>
          </div>         
        </div>
      </div>
    </div>  


  <div class="modal fade" id="translatorEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="authEditModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-xl modal-dialog-scrollable">
      <div class="modal-content" id="authEditModalContent">
        <div class="modal-header">
          <h5 class="modal-title" id="menuEditModalLabel">통역인 정보</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div id="KeyValue">
          </div>
        <div class="modal-body">
          <ul class="nav nav-tabs" id="userTab" role="tablist">
            <li class="nav-item" role="presentation">
              <button class="nav-link active" id="accessTab" data-bs-toggle="tab" data-bs-target="#accessTabPanel" type="button" role="tab" aria-controls="accessTabPanel" aria-selected="true">인적사항</button>
            </li>
            <li class="nav-item" role="presentation">
              <button class="nav-link" id="approvalTab" data-bs-toggle="tab" data-bs-target="#approvalTabPanel" type="button" role="tab" aria-controls="approvalTabPanel" aria-selected="false">수정이력</button>
            </li>
          </ul>
          <div class="tab-content border border-top-0" id="configInfo">
          </div>
        </div>
      </div>
    </div>
  </div>
  
  
  <div class="modal fade" id="translatorCareerModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="authEditModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-xl modal-dialog-scrollable">
      <div class="modal-content" id="authEditModalContent">
        <div class="modal-header">
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <div class="tab-content border border-top-0" id="careerView">
          </div>
        </div>
      </div>
    </div>
  </div>


</div>
</html>