<!DOCTYPE html>
<html lang="ko"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5" xmlns="http://www.w3.org/1999/html">
  <div class="mx-3 pt-3" th:fragment="leftMenuFragment">
    <div sec:authorize="hasRole('ROLE_ADMIN')">
      <div class="list-group py-2">
        <a href="/admin/categoryMgt" class="list-group-item list-group-item-action">게시판 분류 관리</a>
        <a href="/admin/userMgt" class="list-group-item list-group-item-action">사용자 관리</a>
        <a href="/info/modifyRequestList" class="list-group-item list-group-item-action">수정 요청</a>
        <a href="#" class="list-group-item list-group-item-action disabled">통계</a>
        <a href="/admin/codeMgt" class="list-group-item list-group-item-action">코드관리</a>
      </div>
    </div>
    <div class="d-grid gap-2">
      <a class="btn btn-primary" href="/board/contentSearch"><i class="bi bi-search"></i> 통합 검색</a>
    </div>
    <div class="d-grid gap-2 pt-1">
      <a class="btn btn-success" href="/board/contentWrite"><i class="bi bi-file-earmark-plus "></i> 자료 등록</a>
    </div>
    <div sec:authorize="isAuthenticated()">
      <div class="flex-shrink-0 pe-3 py-3 bg-transparent">
        <ul class="list-unstyled ps-0">
        <th:block th:each="depth1:${session.categoryList}">
          <li class="mb-1">
            <button class="btn btn-toggle align-items-center rounded collapsed"
                   data-bs-toggle="collapse" aria-expanded="false" th:data-bs-target="'#collapse'+${depth1.categorySeq}"
                   th:text="${depth1.categoryName}">
            </button>
            <div class="collapse ps-3" th:id="|collapse${depth1.categorySeq}|">
              <ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
                <th:block th:each="depth2:${depth1.childCategoryList}">
                  <li>
                    <ul class="list-unstyled ps-0">
                      <li class="mb-1">
                        <button class="btn btn-toggle align-items-center rounded collapsed"
                               data-bs-toggle="collapse" aria-expanded="false"
                               th:data-bs-target="'#collapse'+${depth2.categorySeq}" th:text="${depth2.categoryName}">
                        </button>
                        <div class="collapse ps-3" th:id="|collapse${depth2.categorySeq}|">
                          <ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
                            <th:block th:each="depth3:${depth2.childCategoryList}">
                            <li>
                              <ul class="list-unstyled ps-0">
                                <li class="mb-1">
                                  <button class="btn btn-toggle align-items-center rounded collapsed"
                                         data-bs-toggle="collapse" aria-expanded="false"
                                         th:data-bs-target="'#collapse'+${depth3.categorySeq}" th:text="${depth3.categoryName}">
                                  </button>
                                  <div class="collapse ps-3" th:id="|collapse${depth3.categorySeq}|">
                                    <ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
                                      <th:block th:each="depth4:${depth3.childCategoryList}">
                                        <li><a th:href="|@{/board/contentList}?categorySeq=${depth4.categorySeq}|" class="bi bi-dash link-dark rounded ps-3 text-decoration-none" th:text="${depth4.categoryName}"></a></li>
                                      </th:block>
                                      <th:block th:if="${depth3.childCategoryList.size==0}">
                                        <li>등록된 소분류가 없습니다.</li>
                                      </th:block>
                                    </ul>
                                  </div>
                                </li>
                              </ul>
                            </li>
                            </th:block>
                            <th:block th:if="${depth2.childCategoryList.size==0}">
                              <li>등록된 중분류가 없습니다.</li>
                            </th:block>
                          </ul>
                        </div>
                      </li>
                    </ul>
                  </li>
                </th:block>
                <th:block th:if="${depth1.childCategoryList.size==0}">
                  <li>등록된 연도가 없습니다.</li>
                </th:block>
                <!--<li><a href="#" class="link-dark rounded">Shipped</a></li>
                <li><a href="#" class="link-dark rounded">Returned</a></li>-->
              </ul>
            </div>
          </li>
        </th:block>
        </ul>
      </div>
    </div>
  </div>
</html>