<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" id="affairListModalLabel">견문목록</h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="affairListBody">
  <table class="table table-hover">
    <thead>
    <tr>
      <th><input type="checkbox" class="allChk"></th>
      <th>분야1</th>
      <th>분야2</th>
      <th>분야3</th>
      <th>분야4</th>
      <th>제목</th>
      <th>작성일</th>
      <th>첨부파일</th>
      <th>상태</th>
      <th>평가</th>
      <th>상보</th>
    </tr>
    </thead>
    <tbody>
    <tr class="affairTr" th:each="affair:${affairList}">
      <td><input type="checkbox" class="rowChkBox" th:value="${affair.affairKey}"></td>
      <th:block th:each="commonCode:${session.commonCode.get('DC01')}">
        <td th:if="${affair.affairType1 eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
      </th:block>
      <th:block th:each="commonCode:${session.commonCode.get('DC02')}">
        <td th:if="${affair.affairType2 eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
      </th:block>
      <th:block th:each="commonCode:${session.commonCode.get('DC03')}">
        <td th:if="${affair.affairType3 eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
      </th:block>
      <th:block th:each="commonCode:${session.commonCode.get('DC04')}">
        <td th:if="${affair.affairType4 eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
      </th:block>
      <td class="title" th:text="${affair.title}"></td>
      <td class="wrtDt" th:text="${#temporals.format(affair.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
      <td th:text="${affair.fileCnt eq null?'파일 없음':#strings.concat(affair.fileCnt,' 건')}"></td>
      <th:block th:each="commonCode:${session.commonCode.get('DST')}">
        <td th:if="${affair.affairStatus eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
      </th:block>
      <th:block th:if="${affair.affairStatus eq 'DST006'}">
        <th:block th:each="ratingCode:${session.commonCode.get('AAR')}">
          <td class="affairRate" th:if="${ratingCode.itemCd eq affair.affairRate}" th:text="${ratingCode.itemValue}"></td>
        </th:block>
        <td class="organUp" th:text="${affair.organUp eq 'T'?'O':'X'}"></td>
      </th:block>
      <th:block th:unless="${affair.affairStatus eq 'DST006'}">
        <td></td>
        <td></td>
      </th:block>
    </tr>
    </tbody>
  </table>
</div>
<div class="modal-footer">
  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
  <button type="button" class="btn btn-primary" id="getAffairBtn">불러오기</button>
</div>