<!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">
    <a href="/" class="d-flex">
      <img id="logo" th:src="@{/img/logo.png}" alt="logo" title="logo">
      <!--<span class="fs-4">해양경찰청 파일관리 시스템</span>-->
    </a>
    <ul class="nav nav-pills flex-column my-3" sec:authorize="isAuthenticated()">
      <li th:each="firstMenu:${session.menuList}">
        <th:block th:each="cat1Code:${session.commonCode.get('CAT1')}">
          <th:block th:if="${cat1Code.itemCd eq firstMenu.cat1Cd}">
            <a href="#" class="nav-link link-dark firstMenuLink" th:text="${cat1Code.itemValue}"></a>
            <div class="menuDiv secondMenu h-100 bg-white" style="display: none">
              <ul class="nav nav-pills flex-column">
                <li th:each="secondMenu:${firstMenu.childList}">
                  <th:block th:each="cat2Code:${session.commonCode.get('CAT2')}">
                    <th:block th:if="${cat2Code.itemCd eq secondMenu.cat2Cd}">
                      <a class="nav-link link-dark secondMenuLink" th:text="${cat2Code.itemValue}" th:href="${#lists.isEmpty(secondMenu.childList)?secondMenu.menuUrl:'#'}"></a>
                      <div class="menuDiv thirdMenu h-100 bg-white" style="display: none" th:if="${#lists.isEmpty(secondMenu.childList) ne true}">
                        <ul class="nav nav-pills flex-column">
                          <li th:each="thirdMenu:${secondMenu.childList}">
                            <th:block th:each="cat3Code:${session.commonCode.get('CAT3')}">
                              <th:block th:if="${cat3Code.itemCd eq thirdMenu.cat3Cd}">
                                <a class="nav-link link-dark" th:text="${cat3Code.itemValue}" th:href="${thirdMenu.menuUrl}"></a>
                              </th:block>
                            </th:block>
                          </li>
                        </ul>
                      </div>
                    </th:block>
                  </th:block>
                </li>
              </ul>
            </div>
          </th:block>
        </th:block>
      </li>
    </ul>
  </div>
</html>