<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<c:set var="thisURL" value="${requestScope['javax.servlet.forward.request_uri']}"/>

<form id="logout" action="/j_spring_security_logout" method="POST">
    <input name="${_csrf.parameterName}" type="hidden" value="${_csrf.token}"/>
</form>

<sec:authorize access="hasRole('ROLE_USER')">
    <header class="header">
        <div class="header_title">
            <a href="/map/request">모바일센터 관리시스템</a>
        </div>
        <div class="header_info">
            <a href="<c:url value="/logout"/>">
                <span class="glyphicon glyphicon-log-out" style="color:#fff"></span> 로그아웃
            </a>
        </div>
    </header>

    <nav class="common_nav">
        <div class="header_menu">
            <ul>

                <li
                        <c:if test="${thisURL eq '/map/request'}">class="thisOn"</c:if>
                        onclick="location.href='/map/request'">지도사용 요청
                </li>
                <li
                        <c:if test="${thisURL eq '/map/userInfo'}">class="thisOn"</c:if>
                        onclick="location.href='/map/userInfo'">회원정보수정
                </li>
            </ul>
        </div>
    </nav>
</sec:authorize>

<sec:authorize access="hasRole('ROLE_ADMIN')">
    <header class="header">
        <div class="header_title">
            <a href="/admin/request">모바일센터 관리시스템</a>
        </div>
        <div class="header_info">
            <a href="<c:url value="/logout"/>">
                <span class="glyphicon glyphicon-log-out" style="color:#fff"></span> 로그아웃
            </a>
        </div>
    </header>
    <nav class="common_nav">
        <div class="header_menu">
            <ul>
                <li
                        <c:if test="${fn:contains(thisURL, '/dashBoard')}">class="thisOn"</c:if>
                        onclick="location.href='/admin/dashBoard'">
                    <img src="/images/icon/icon_analysis.png" width="30" height="30" alt=""> &nbsp;대시보드
                </li>
                <li
                        <c:if test="${fn:contains(thisURL, '/request')}">class="thisOn"</c:if>
                        onclick="location.href='/admin/request'">
                    <img src="/images/icon/icon_map.png" width="30" height="30" alt=""> &nbsp;지도사용 요청
                </li>
                <li
                        <c:if test="${fn:contains(thisURL, '/history')}">class="thisOn"</c:if>
                        onclick="location.href='/admin/history'">
                    <img src="/images/icon/icon_log_on.png" width="30" height="30" alt=""> &nbsp;지도사용 이력
                </li>
                <li
                        <c:if test="${fn:contains(thisURL, '/fieldData')}">class="thisOn"</c:if>
                        onclick="location.href='/admin/fieldData'">
                    <img src="/images/icon/icon_eq_on.png" width="30" height="30" alt=""> &nbsp;현장수집 데이터
                </li>
                <li
                        <c:if test="${fn:contains(thisURL, '/userInfo')}">class="thisOn"</c:if>
                        onclick="location.href='/admin/userInfo?auth=99'">
                    <img src="/images/icon/icon_supervisor_on.png" width="30" height="30" alt=""> &nbsp;회원 관리
                </li>
            </ul>
        </div>
    </nav>
</sec:authorize>








