<!DOCTYPE html>
<html lang="ko"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<header th:fragment="headerFragment" class="border-bottom w-100 row justify-content-between py-1 px-3">
  <div class="col-auto row justify-content-start">
    <div class="col-auto">
      <div class="navbar-header">
        <a href="/" class="navbar-brand">
          <img id="logo" th:src="@{/img/logo2.png}" alt="logo" title="logo">
        </a>
      </div>
    </div>
    <div class="col-auto my-auto">
      <ul class="nav nav-pills navbar-brand" sec:authorize="isAuthenticated()">
        <li class="nav-item dropdown" sec:authorize="hasRole('ROLE_SUB_ADMIN')">
          <a href="#" class="nav-link dropdown-toggle text-black" data-bs-toggle="dropdown" aria-expanded="false">
            <span class="d-lg-inline d-md-none">관리기능</span>
            <b class="caret ms-1"></b>
          </a>
          <ul class="dropdown-menu">
            <th:block sec:authorize="hasRole('ROLE_ADMIN')">
              <li><a href="/codeMgt/codeMgtPage" class="dropdown-item">코드관리</a></li>
              <li><a href="/organMgt/organMgtPage" class="dropdown-item">관서설정</a></li>
              <li><a href="/menuMgt/menuMgtPage" class="dropdown-item">메뉴관리</a></li>
              <li><hr class="dropdown-divider"></li>
            </th:block>
            <th:block sec:authorize="hasRole('ROLE_SUB_ADMIN')">
              <li><a href="/userMgt/userMgtPage" class="dropdown-item">외사경찰관리</a></li>
              <li><a href="/authMgt/authMgtPage" class="dropdown-item">권한설정</a></li>
              <li><a href="/userMgt/userLog/requestLog" class="dropdown-item">사용자로그</a></li>
              <li><a href="#" class="dropdown-item">접속설정</a></li>
            </th:block>
          </ul>
        </li>
        <li class="nav-item">
          <a href="/publicBoard/noticePage" class="nav-link link-dark">공지사항</a>
        </li>
        <li class="nav-item">
          <a href="/publicBoard/boardPage" class="nav-link link-dark">게시판</a>
        </li>
        <li class="nav-item">
          <a href="/publicBoard/referencePage?tabStatus=RPC001" class="nav-link link-dark">자료실</a>
        </li>
        <li class="nav-item">
          <a href="/publicBoard/qnaPage" class="nav-link link-dark">Q&A</a>
        </li>
      </ul>
    </div>
  </div>
  <div class="col-auto my-auto">
    <ul class="nav nav-pills" sec:authorize="isAuthenticated()">
      <li class="nav-item"><a href="#" class="nav-link" th:classappend="${#lists.isEmpty(alarmList)?'link-dark':'link-danger'}"><i class="bi bi-bell-fill"></i></a></li>
      <li class="nav-item dropdown">
        <a href="#" class="nav-link dropdown-toggle text-black" data-bs-toggle="dropdown" aria-expanded="false">
          <th:block th:each="commonCode:${session.commonCode.get('JT')}">
            <th:block th:if="${commonCode.itemCd eq #authentication.principal.titleCd}">
              <span class="d-lg-inline d-md-none" th:text="|${commonCode.itemValue} ${#authentication.principal.userNm}|">관리기능</span>
            </th:block>
          </th:block>
          <b class="caret ms-1"></b>
        </a>
        <ul class="dropdown-menu">
          <li><a href="/myInfo/myInfoPage" class="dropdown-item">마이페이지</a></li>
          <li><a href="/logout" class="dropdown-item">로그아웃</a></li>
        </ul>
      </li>
    </ul>
  </div>
</header>
</html>