<%@ page import="kr.co.jinwoosi.clfd.framework.util.SessionHelper" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/include/tags.jspf" %>
<!-- Nav container -->
<script src="/clfd/js/front/clfd_header.js" defer></script>
<nav class="navbar">
    <!-- Logo with text -->
    <div class="navbar__logo">
        <a href="/clfd/main.do"><img src="/clfd/img/clfd_logo80.png" alt="error"></a>
    </div>
    <div class="navbar__logo__m" style="align-self: center;">
        <a href="/clfd/main.do"><img src="/clfd/img/clfd_logo80.png" style="width: 200px;" alt="error"></a>
    </div>

    <!-- Menu -->
    <ul class="navbar__menu">
        <li><a id="surveyAnchor" href="#">피부테스트</a></li>
        <li><a id="surveyResultAnchor" href="#">테스트결과</a></li>
        <li><a href="/clfd/prod/list.do">화장품</a></li>
        <li id="last__li">
            <a class="dropdown__cs" href="/clfd/bod/notice/list.do">공지사항</a>
        </li>
        <!-- Icons -->
        <ul class="navbar__icons">
            <li>
                <a class="dropdown__icon" href="#">
                    <i class="fas fa-user" style="font-size: 22px;"></i>
                </a>
                <div class="dropbox__icon">
                    <c:if test="${isLogin == true}">
                        <a class="dropbox" href="/logout.mng">로그아웃</a>
                        <a class="dropbox" href="/clfd/pr/myPage.do">마이페이지</a>
                        <c:if test="${userRole != 'ROLE_USER'}">
                            <a class="dropbox" href="/system/main.mng">관리자화면</a>
                        </c:if>
                    </c:if>
                    <c:if test="${isLogin != true}">
                        <a class="dropbox" href="/login/loginForm.mng">로그인</a>
                        <a class="dropbox" href="/clfd/user/join.do">회원가입</a>
                    </c:if>
                </div>
            </li>
        </ul>
    </ul>
    <!-- Toggle button -->
    <a href="#" class="navbar__toggleBtn">
        <i class="fas fa-bars"></i>
    </a>
</nav>

<script>
    $('#surveyResultAnchor').click(function () {
        <%
        if (SessionHelper.getUser() != null) {
        %>
        location.href = "/clfd/dgns/list.do"
        <%
        } else {
        %>
        if (confirm("회원만 이용가능한 서비스입니다. 로그인하시겠습니까?")) {
            location.href = "/login/loginForm.mng?path=" + '/clfd/dgns/list.do';
        }
        <%
        }
        %>
    });

    $('#surveyAnchor').click(function () {
        <%
        if (SessionHelper.getUser() != null) {
        %>
        location.href = "/clfd/dgns/survey.do"
        <%
        } else {
        %>
        if (confirm("회원만 이용가능한 서비스입니다. 로그인하시겠습니까?")) {
            location.href = "/login/loginForm.mng?path=" + '/clfd/dgns/survey.do';
        }
        <%
        }
        %>
    });
</script>