<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" id="faRptViewModalLabel">SRI 열람</h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="faSriViewBody">
  <div class="row">
    <div class="col-8">
      <div class="mb-3 row">
        <label for="wrtUserNm" class="col-sm-2 col-form-label col-form-label-sm text-center">작성자</label>
        <div class="col-sm-4">
          <input type="hidden" id="faSriKey" th:value="${FaSri.faSriKey}">
          <input type="hidden" id="wrtUserSeq" th:value="${FaSri.wrtUserSeq}">
          <input type="hidden" id="wrtOrgan" th:value="${FaSri.wrtOrgan}">
          <input type="hidden" id="wrtPart" th:value="${FaSri.wrtPart}">
          <input type="hidden" id="wrtTitle" th:value="${FaSri.wrtTitle}">
          <input type="text" class="form-control form-control-sm border-0" id="wrtUserNm" name="wrtUserNm" th:value="${FaSri.wrtUserNm}" readonly>
        </div>
        <label for="wrtDt" class="col-sm-2 col-form-label col-form-label-sm text-center">작성일시</label>
        <div class="col-sm-4">
          <input type="text" class="form-control form-control-sm border-0" id="wrtDt" name="wrtDt" th:value="${#temporals.format(FaSri.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
        </div>
      </div>
      <div class="mb-3 row">
        <label for="faRptType" class="col-sm-2 col-form-label col-form-label-sm text-center">분류</label>
        <div class="col-sm-4">
          <th:block th:each="code:${session.commonCode.get('SRI')}">
            <th:block th:if="${code.itemCd eq FaSri.faSriType}">
              <input type="text" class="form-control form-control-sm border-0" id="faSriType" th:value="${code.itemValue}" readonly>
            </th:block>
          </th:block>
        </div>
        <label for="status" class="col-sm-2 col-form-label col-form-label-sm text-center">상태</label>
        <div class="col-sm-4">
          <th:block th:each="code:${session.commonCode.get('DST')}">
            <th:block th:if="${code.itemCd eq FaSri.status}">
              <input type="text" class="form-control form-control-sm border-0" id="status" th:value="${code.itemValue}" readonly>
            </th:block>
          </th:block>
        </div>
      </div>
      <div class="mb-3 row">
        <label for="title" class="col-sm-2 col-form-label col-form-label-sm text-center">제출기한</label>
        <div class="col-sm-10">
          <input type="text" class="form-control form-control-sm border-0" id="faSriEdate" name="faSriEdate" th:value="${FaSri.faSriEdate}" readonly>
        </div>
      </div>
      <div class="mb-3 row">
        <label for="title" class="col-sm-2 col-form-label col-form-label-sm text-center">제목</label>
        <div class="col-sm-10">
          <input type="text" class="form-control form-control-sm border-0" id="title" name="title" th:value="${FaSri.title}" readonly>
        </div>
      </div>
      <div class="mb-3 row justify-content-center">
        <label for="content" class="col-sm-2 col-form-label col-form-label-sm text-center">내용</label>
        <div class="col-sm-10" id="content" th:utext="${FaSri.content}">
        </div>
      </div>
      <div class="row mb-3">
        <label for="fileTable" class="col-sm-2 col-form-label col-form-label-sm text-center">업로드 자료</label>
        <div class="col-sm-10">
          <table class="table" id="fileTable">
            <thead>
            <tr>
              <th>파일명</th>
              <th>사이즈</th>
            </tr>
            </thead>
            <tbody>
            <th:block th:if="${#lists.isEmpty(FaSri.fileList)}">
              <tr>
                <td colspan="2">파일이 없습니다.</td>
              </tr>
            </th:block>
            <th:block th:unless="${#lists.isEmpty(FaSri.fileList)}">
              <th:block th:each="file:${FaSri.fileList}">
                <tr class="fileInfoTr">
                  <td><a href="#" class="fileDownLink" data-board="sri"
                         th:data-parentkey="${file.faSriKey}" th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn}|"></a></td>
                  <td th:text="${file.fileSize}"></td>
                </tr>
              </th:block>
            </th:block>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="col-4">
      <div class="row">
        <div class="col-12 pb-2">
          <div class="row justify-content-start">
            <div class="col-auto">■ 수신자</div>
          </div>
        </div>
        <div class="col-1">no</div>
        <div class="col-9">수신자</div>
        <div class="col-2">열람</div>
      </div>
      <hr class="my-1">
      <div class="row">
        <div class="col-12">
          <th:block th:each="readUser, idx:${FaSri.readUserList}">
            <div class="row my-1">
              <div class="col-1" th:text="${idx.index+1}"></div>
              <div class="col-9">
                <th:block th:each="commonCode:${session.commonCode.get('OG')}">
                  <th:block th:if="${commonCode.itemCd eq readUser.ogCd}" th:text="${commonCode.itemValue}"></th:block>
                </th:block>
                <th:block th:each="commonCode:${session.commonCode.get('OFC')}">
                  <th:block th:if="${commonCode.itemCd eq readUser.ofcCd}" th:text="${commonCode.itemValue}"></th:block>
                </th:block>
                <!--<th:block th:each="commonCode:${session.commonCode.get('JT')}">
                  <th:block th:if="${commonCode.itemCd eq readUser.titleCd}" th:text="|${commonCode.itemValue} ${readUser.userNm}|"></th:block>
                </th:block>-->
                <th:block th:text="${readUser.userNm}"></th:block>
              </div>
              <div class="col-2">
                <th:block th:text="${readUser.readYn eq 'T'?'O':'X'}"></th:block>
              </div>
            </div>
          </th:block>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="modal-footer justify-content-between">
<div class="col-auto">
	<th:block th:unless="${FaSri.status eq 'DST008'}">
	<button type="button" class="btn btn-danger" id="deleteSri" th:if="${userSeq eq FaSri.wrtUserSeq} and ${accessAuth eq 'ACC003'}" th:data-fasrikey="${FaSri.faSriKey}">삭제</button>
	</th:block>
</div>
<div class="col-auto">
  <th:block th:if="${userSeq eq FaSri.wrtUserSeq}">
    <button type="button" class="btn btn-warning" id="editFaSriBtn" th:data-fasrikey="${FaSri.faSriKey}">수정</button>
  </th:block>
  <th:block th:if="${userSeq ne FaSri.wrtUserSeq}">
  <th:block th:unless="${FaSri.faSriEdate eq null}">
    <button type="button" class="btn btn-success" id="reSendBtn" th:if="${FaSri.faSriEdate} >= ${#temporals.createToday()}" th:data-fasrikey="${FaSri.faSriKey}">회신</button>
  </th:block>
  </th:block>
  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
  </div>
</div>