<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" th:text="|${userInfo.ogCd} ${userInfo.ofcCd eq null?'':userInfo.ofcCd} ${userInfo.titleCd eq null?'':userInfo.titleCd} ${userInfo.userNm}|"></h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
  <input type="hidden" id="mngModelUserSeq" th:value="${userInfo.userSeq}">
  <input type="hidden" id="mngModelDicCode" th:value="${userInfo.dicCode}">
  <div class="card">
    <div class="card-body text-center">
      <ul class="nav nav-tabs" id="userTab" role="tablist">
        <th:block th:each="code, idx:${crcList}">
          <li class="nav-item" role="presentation">
            <button class="nav-link" type="button" role="tab" data-bs-toggle="tab" th:id="|${code.itemCd}Tab|"
                    th:data-bs-target="${#strings.concat('#', code.itemCd, 'TabPanel')}" th:aria-controls="|${code.itemCd}TabPanel|"
                    th:aria-selected="${code.itemCd eq selectedTab?'true':'false'}" th:classappend="${code.itemCd eq selectedTab?'active':''}"
                      th:text="${code.itemValue}"></button>
          </li>
        </th:block>
      </ul>
      <div class="tab-content border border-top-0">
      <th:block th:each="code, idx:${crcList}">
        <div class="tab-pane fade p-2" th:classappend="${code.itemCd eq selectedTab?'show active':''}"
             th:id="|${code.itemCd}TabPanel|" role="tabpanel"
             th:aria-labelledby="|${code.itemCd}Tab|" tabindex="0">
          <table class="table table-hover">
            <thead>
            <tr>
              <th>임용구분</th>
              <th colspan="2">근무지</th>
              <th>직급</th>
              <th>시작일</th>
              <th>종료일</th>
              <th>일수</th>
              <th>개월수</th>
              <th>등록자</th>
              <th>등록일</th>
              <th></th>
            </tr>
            </thead>
            <tbody>
            <th:block th:each="career:${careerList}">
              <th:block th:if="${code.itemCd eq career.careerCd}">
                <tr>
                  <td>
                    <th:block th:each="code:${session.commonCode.get('DSN')}">
                      <th:block th:if="${code.itemCd eq career.designationCd}" th:text="${code.itemValue}"></th:block>
                    </th:block>
                  </td>
                  <th:block th:if="${#strings.isEmpty(career.workPositionStr)}">
                    <th:block th:each="code:${session.commonCode.get('OG')}">
                      <th:block th:if="${code.itemCd eq career.workOrgan}">
                        <td th:text="${code.itemValue}"></td>
                      </th:block>
                    </th:block>
                    <th:block th:each="code:${session.commonCode.get('OFC')}">
                      <th:block th:if="${code.itemCd eq career.workPart}">
                        <td th:text="${code.itemValue}"></td>
                      </th:block>
                    </th:block>
                  </th:block>
                  <th:block th:unless="${#strings.isEmpty(career.workPositionStr)}">
                    <td colspan="2" th:text="${career.workPositionStr}"></td>
                  </th:block>
                  <th:block th:each="code:${session.commonCode.get('JT')}">
                    <th:block th:if="${code.itemCd eq career.workTitle}">
                      <td th:text="${code.itemValue}"></td>
                    </th:block>
                  </th:block>
                  <td th:text="${#temporals.format(career.startDate, 'yyyy-MM-dd')}"></td>
                  <td th:text="${#temporals.format(career.endDate, 'yyyy-MM-dd')}"></td>
                  <td th:text="${career.workDay}"></td>
                  <td th:text="${career.workMonth}"></td>
                  <td>
                    <th:block th:each="code:${session.commonCode.get('OG')}">
                      <th:block th:if="${code.itemCd eq career.wrtOrgan}">
                        <th:block th:text="${code.itemValue}"></th:block>
                      </th:block>
                    </th:block>
                    <th:block th:each="code:${session.commonCode.get('OFC')}">
                      <th:block th:if="${code.itemCd eq career.workPart}">
                        <th:block th:text="${code.itemValue}"></th:block>
                      </th:block>
                    </th:block>
                    <th:block th:text="${career.wrtUserNm}"></th:block>
                  </td>
                  <td th:text="${#temporals.format(career.wrtDt, 'yyyy-MM-dd HH:mm:ss')}"></td>
                  <td>
                    <button type="button" class="btn btn-sm btn-outline-danger deleteCareerBtn"
                            th:data-careerseq="${career.careerSeq}" th:data-tab="${code.itemCd}">
                      <i class="bi bi-trash"></i>
                    </button>
                  </td>
                </tr>
              </th:block>
            </th:block>
            </tbody>
            <tfoot>
            <tr>
              <td colspan="11">
                <div class="row justify-content-center">
                  <div class="col-auto">
                    <button type="button" class="btn btn-sm btn-primary careerAddBtn" th:data-careercd="${code.itemCd}">추가</button>
                  </div>
                  <div class="col-auto">
                    <button type="button" class="btn btn-sm btn-success kwmsCareerBtn" th:classappend="${#strings.isEmpty(userInfo.dicCode)?'disabled':''}">인사시스템 경력정보</button>
                  </div>
                </div>
              </td>
            </tr>
            </tfoot>
          </table>
        </div>
      </th:block>
      </div>
    </div>
  </div>
</div>
<div class="modal-footer">
  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>
</html>