<%@page import="com.dbs.mplus.MPlusConstants"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<div class="navbar-fixed-top mp-page-header">
	<div class="top-header">
		<button class="btn btn-icon" id="prevBtn"
			onclick="historyBack()">이전페이지</button>
		<h3 id="headerTitle"></h3>
		<button class="btn btn-icon cl" id="menuToggle">메뉴</button>
		<!-- 사이드 전체 메뉴 -->
		<div id="sidebarMenu">
			<span id="closeBtn">닫기</span>
			<div class="sidebar-menu-inner">
				<div class="userinfo clearfix">
					<div style="display: inline;">
						<span class="member-name" id="panelUserName"></span>
						<span class="member-dept" style="font-size: 14px;" id="panelUserDept"></span> 
					</div>
					<div style="display: inline; position: absolute; right: 10px; top: 8px; font-size: 22px;">
						<a href="#" id="btnLogout">
							<i class="fa fa-sign-out"></i><span class="hidden">로그아웃</span>
						</a>
						<a href="#" id="btnMoveSetting">
							<i class="fa fa-gear"></i><span class="hidden">설정</span>
						</a>
					</div>
				</div>
				<ul class="side-menu-list">
				</ul>
			</div>
		</div>
	</div>
</div>

	<div class="btnwrap text-center">
		<button class="btn" id="openToggle" style="display: none">
			<i class="fa fa-chevron-up"></i><span class="hidden">열기</span>
		</button>
	</div>
	<div id="overlay">
		<div class="menu-wrap treatment-menu" id="treatmentPop" style="display: none">
			<div class="fcontent" id="inOutContent">
				<!-- <div class="popHeaderContent text-center mb10">
				    <button type="button" class="btn btn-primary btn-block" id="btnEmrMove">영상EMR</button>
				</div> -->
				<div class="pop-content">
					<ul>
						<li style="display: none"><div class="name"><strong>&middot; ID</strong></div>
							<div class="txt" id="divId"></div></li>
						<li><div class="name"><strong>&middot; 주진단</strong></div>
							<div class="txt" id="divDiagName"></div></li>
						<li><div class="name"><strong>&middot; 수술명</strong></div>
							<div class="txt" id="divOpName"></div></li>
						<li><div class="name"><strong>&middot; 수술일</strong></div>
							<div class="txt" id="divOpDate"></div></li>
						<li><div class="name"><strong>&middot; 진료일</strong></div>
							<div class="txt" id="divTreatDate"></div></li>
						<li><div class="name"><strong>&middot; 주치의</strong></div>
							<div class="txt" id="divDoctorName"></div></li>
					</ul>
				</div>
				<div class="popFootContent">
					<div class="btn-group btn-group-justified" role="group" aria-label="...">
					  <div class="btn-group" role="group">
					    <button type="button" class="btn btn-style-1" name="btnMoveDetail">기본</button>
					  </div>
					  <div class="btn-group" role="group">
					    <button type="button" class="btn btn-style-1" name="btnMovePrescription">처방</button>
					  </div>
					  <div class="btn-group" role="group">
					    <button type="button" class="btn btn-style-1" name="btnMoveExamine">검사</button>
					  </div>
					</div>
				</div>
			</div>
		</div>
		
		<div class="menu-wrap operation-menu" id="operationPop" style="display: none">
			<div class="fcontent">
				<div class="pop-content">
					<ul>
						<li style="display: none"><div class="name"><strong>&middot; ID</strong></div>
							<div class="txt" id="divId"></div></li>
						<li><div class="name"><strong>&middot; 환자명</strong></div>
							<div class="txt" id="divOpPatientName"></div>
						</li>
						<li class="trDisplayNone"><div class="name"><strong>&middot; 수술의</strong></div>
							<div class="txt" id="divOpDoctorName"></div>
						</li>
						<li class="trDisplayOnly"><div class="name"><strong>&middot; 시술의</strong></div>
							<div class="txt" id="divTrDoctorName"></div>
						</li>
						<li class="opDisplayOnly"><div class="name"><strong>&middot; 진단명</strong></div>
							<div class="txt" id="divDiagnosisNm"></div>
						</li>
						<li class="anDisplayOnly"><div class="name"><strong>&middot; 마취명</strong></div>
							<div class="txt" id="divAnesthesiaNm"></div>
						</li>
						<li class="anDisplayOnly"><div class="name"><strong>&middot; 마취의</strong></div>
							<div class="txt" id="divAnesthesiaDrNm"></div>
						</li>
						<li class="trDisplayNone"><div class="name"><strong>&middot; 수술실</strong></div>
							<div class="txt" id="divOperatingCntr"></div>
						</li>
						<li class="trDisplayOnly"><div class="name"><strong>&middot; 시술실</strong></div>
							<div class="txt" id="divTreatmentCntr"></div>
						</li>
						<li class="opDisplayOnly"><div class="name"><strong>&middot; 수술명</strong></div>
							<div class="txt" id="divOpName1"></div>
						</li>
						<li class="trDisplayOnly"><div class="name"><strong>&middot; 시술명</strong></div>
							<div class="txt" id="divTrName1"></div>
						</li>
						<li class="opDisplayOnly"><div class="name"><strong>&middot; 수술시간</strong></div>
							<div class="txt" id="divOpTime"></div>
						</li>
						<li class="trDisplayOnly"><div class="name"><strong>&middot; 시술시간</strong></div>
							<div class="txt" id="divTrTime"></div>
						</li>
						<li class="anDisplayOnly"><div class="name"><strong>&middot; 마취시간</strong></div>
							<div class="txt" id="divAnTime"></div>
						</li>
						<li class="trDisplayNone"><div class="name"><strong>&middot; 마취방법</strong></div>
							<div class="txt" id="divAnesMethod"></div></li>
						<li class="trDisplayNone"><div class="name"><strong>&middot; 특이사항</strong></div>
						<div class="txt" id="divOperatingSticksOut"></div></li>
					</ul>
				</div>
			</div>
		</div>
		<!-- #menu-wrap종료 -->
	</div>

<script type="text/javascript">
var headerTitle = $('#headerTitle'); 
$('#panelUserName').text(loginUserName);
$('#panelUserDept').text(selectDeptName);

var sideMenuList = new Array();	
var ulSideMenuList = $('.side-menu-list');

<c:forEach var="menu" items="${mainMenu}" varStatus="status">
sideMenuList.push({
	"menuType" : '${menu.menuType}',
	"accessUriAddr" : '${menu.accessUriAddr }',
	"menuId" : '${menu.menuId }',
	"imageUriAddr" : '${pageContext.request.contextPath}${menu.imageUriAddr }',
	"menuName" : '${menu.menuName }',
	"menuOrder" : '${menu.menuOrder }'
});
</c:forEach>
for( var i = 0; i < sideMenuList.length; i++ ){
	// 설정은 상단 아이콘으로 처리하기 때문에 SKIP
	if( sideMenuList[i].menuId == 'setting') {
		continue;
	}
	
	var menu = $('<li></li>');
	var menuLink = $('<a></a>').attr('href', contextPath + sideMenuList[i].accessUriAddr+'?menuId='+sideMenuList[i].menuId)
							.text(sideMenuList[i].menuName).append('<i class="fa fa-chevron-circle-right"></i>');
	ulSideMenuList.append(menu.append(menuLink));
}

//잠금설정 메뉴 추가
	var lockScreenMenu = $('<li></li>');
	var lockScreenMenuLink = $('<a></a>').attr('onclick', 'javascript:lockscreen()').text('화면 잠금 설정').append('<i class="fa fa-chevron-circle-right"></i>');
	ulSideMenuList.append(lockScreenMenu.append(lockScreenMenuLink));

// 종료 메뉴 추가
	var exitMenu = $('<li></li>');
	var exitMenuLink = $('<a></a>').attr('onclick', 'javascript:exitApp()').text('종료').append('<i class="fa fa-chevron-circle-right"></i>');
	ulSideMenuList.append(exitMenu.append(exitMenuLink));

/* var accessMenu = JSON.parse(localStorage.user).accessMenu;
if(accessMenu.indexOf('1') < 0){
	$('#liTreatment').css('display', 'none');
};
if(accessMenu.indexOf('2') < 0){
	$('#liConsult').css('display', 'none');
};
if(accessMenu.indexOf('3') < 0){
	$('#liOperation').css('display', 'none');
};
if(accessMenu.indexOf('4') < 0){
	$('#liSchedule').css('display', 'none');
}; */



if(location.href.indexOf('/clinic.page')>0){
	$('.treatment-menu').css('display', 'block');
	$('.operation-menu').css('display', 'none');
	$('#openToggle').css('display', 'block');	
}else if(location.href.indexOf('/consult.page')>0){
	$('.treatment-menu').css('display', 'none');
	$('.operation-menu').css('display', 'none');
	$('#overlay').css('display', 'none');
	$('#openToggle').css('display', 'none');
}else if(location.href.indexOf('/operation.page')>0){
	$('.treatment-menu').css('display', 'none');
	$('.operation-menu').css('display', 'block');
	$('#openToggle').css('display', 'block');
}else{
	$('.treatment-menu').css('display', 'none');
	$('.operation-menu').css('display', 'none');
	$('#overlay').css('display', 'none');
	$('#openToggle').css('display', 'none');
};

</script>