<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="p-3">
  <input type="hidden" id="detailViewContentSeq" th:value="${content.contentSeq}">
  <input type="hidden" id="contentStatus" th:value="${content.status}">
  <div class="row justify-content-between">
    <div class="col-auto">
      <h5 class="fw-bold">
        <th:block th:if="${content.status =='M'}">
          (메인)
        </th:block>
        <span th:text="${content.title}"></span>
      </h5>
    </div>
    <div class="col-auto" th:text="|조회수: ${content.viewCnt}|"></div>
  </div>
  <div class="row justify-content-between border-bottom pb-3">
    <div class="col-auto" th:text="${#temporals.format(content.createDate, 'yyyy-MM-dd HH:mm:ss')}"></div>
    <div class="col-auto" th:text="${content.createId}"></div>
  </div>
  <th:block th:if="${content.status!='D'}">
    <div class="row border-bottom py-3">
      <div th:class="|col-${content.childFileList.size()>1?8:12}|">
        <table class="table">
          <thead>
          <tr>
            <th><input type="checkbox" id="fileCheckAll"></th>
            <th>파일명</th>
            <th>사이즈</th>
          </tr>
          </thead>
          <tbody>
          <th:block th:each="fileInfo:${content.childFileList}">
            <tr class="fileInfoTr">
              <td><input type="checkbox" class="fileCheckBox" th:data-fileseq="${fileInfo.fileSeq}"></td>
              <td><a href="#" class="fileDownLink" th:data-fileseq="${fileInfo.fileSeq}" th:text="|${fileInfo.originalName}.${fileInfo.extention}|"></a></td>
              <td th:text="${fileInfo.fileSize}"></td>
            </tr>
          </th:block>
          </tbody>
        </table>
      </div>
      <div class="col-4 m-auto" th:if="${content.childFileList.size()>1}">
        <button type="button" class="btn btn-info m-1" id="zipDownBtn"><i class="bi bi-file-zip"></i> 선택된 파일<br>압축 다운로드</button>
      </div>
    </div>
    <div class="row border-bottom py-3">
      <div class="col-12" th:utext="${content.description}"></div>
    </div>
    <div class="row py-3">
      <th:block th:each="hashTag:${content.hashTagList}">
        <div class="col-auto" th:text="'#'+${hashTag.tagName}"></div>
      </th:block>
    </div>
    <th:block th:if="${content.createId == loginUser.userId || loginUser.userRole.contains('ADMIN')}">
      <div class="row justify-content-between py-3">
        <div class="col-auto">
          <button class="btn btn-danger" id="deleteBtn" th:data-contentseq="${content.contentSeq}"><i class="bi bi-trash"></i> 삭제</button>
        </div>
        <div class="col-auto">
          <button class="btn btn-warning" id="modifyBtn" th:data-contentseq="${content.contentSeq}"><i class="bi bi-pencil-square"></i> 수정</button>
        </div>
      </div>
    </th:block>
  </th:block>
</div>