<%@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" %>

<!-- ======================================================================================================================================= -->
<!-- dialog 공통 -->

	<div class="overlay"></div>
      
<!-- ======================================================================================================================================= -->
<!-- 메인 메뉴	mainMenu -->

	<!-- Sidebar  -->
<%-- 	<div id="divMainMenu">
		<div id="dismiss">
			<i>>></i>
		</div>
	
		<div class="sidebar-header">
			<h3>Main Menu <span id="spanMainMenuTitle"></span></h3>
		</div>
	
		<div align="center">
 			<button type="button" class="btn btn-info" id="btnLogout">로그아웃</button>
			<button type="button" class="btn btn-info" id="btnChangeDept">부서선택</button>
			<button type="button" class="btn btn-info" id="btnDefaultDept">기본부서선택</button>
			<button type="button" class="btn btn-info" id="btnDefaultPage">기본페이지선택</button>
			<button type="button" class="btn btn-info" id="btnRegistFido">FIDO 등록/재등록</button>
			<button type="button" class="btn btn-info" id="btnRemoveFido">FIDO 삭제</button>
			<button type="button" class="btn btn-info" id="btnChangeAppPassword">앱 비밀번호 변경</button>
			<button type="button" class="btn btn-info" id="btnExitApp">앱 종료</button>
			<hr>
			<a href="<%=request.getContextPath()%>/mobile/medical/inpatient.page?menuId=clinic" class="btn btn-info" role="button">입원</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/outpatient.page?menuId=clinic" class="btn btn-info" role="button">외래</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/empatient.page?menuId=clinic" class="btn btn-info" role="button">응급</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/oppatient.page?menuId=clinic" class="btn btn-info" role="button">수술</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/copatient.page?menuId=clinic" class="btn btn-info" role="button">협진</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/trpatient.page?menuId=clinic" class="btn btn-info" role="button">시술</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/barpatient.page?menuId=clinic" class="btn btn-info" role="button">바코드</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/qrpatient.page?menuId=clinic" class="btn btn-info" role="button">QR</a>
			<a href="<%=request.getContextPath()%>/mobile/medical/nfcpatient.page?menuId=clinic" class="btn btn-info" role="button">NFC</a>
			<a href="<%=request.getContextPath()%>/mobile/schedule/doctorworksch.page?menuId=clinic" class="btn btn-info" role="button">의사당직일정</a>
			<a href="<%=request.getContextPath()%>/mobile/schedule/nurseworksch.page?menuId=clinic" class="btn btn-info" role="button">간호사당직일정</a>
			<a href="<%=request.getContextPath()%>/mobile/schedule/outpatientsch.page?menuId=clinic" class="btn btn-info" role="button">외래진료일정</a>
			<hr>
			
		</div>
	
	</div> --%>

<!-- ======================================================================================================================================= -->
<!-- 퀵 메뉴	quickMenu -->

	<!-- Sidebar tool button -->
<%-- <div id="divQuickMenu">
	<div class="sidebar-header">
		<h3>Quick Menu <span id="spanQuickMenuTitle"></span></h3>
	</div>
	<div align="center">
		<hr>
		<div>
			<button type="button" class="btn btn-info" id="btnLogout2">로그아웃</button>
		</div>
		<div>
			<button type="button" class="btn btn-info" id="btnChangeDept2">부서선택</button>
		</div>
		<hr>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/inpatient.page?menuId=clinic" class="btn btn-info" role="button">입원</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/outpatient.page?menuId=clinic" class="btn btn-info" role="button">외래</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/empatient.page?menuId=clinic" class="btn btn-info" role="button">응급</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/oppatient.page?menuId=clinic" class="btn btn-info" role="button">수술</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/copatient.page?menuId=clinic" class="btn btn-info" role="button">협진</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/trpatient.page?menuId=clinic" class="btn btn-info" role="button">시술</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/barpatient.page?menuId=clinic" class="btn btn-info" role="button">바코드</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/qrpatient.page?menuId=clinic" class="btn btn-info" role="button">QR</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/medical/nfcpatient.page?menuId=clinic" class="btn btn-info" role="button">NFC</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/schedule/doctorworksch.page?menuId=clinic" class="btn btn-info" role="button">의사당직일정</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/schedule/nurseworksch.page?menuId=clinic" class="btn btn-info" role="button">간호사당직일정</a>
		</div>
		<div>
			<a href="<%=request.getContextPath()%>/mobile/schedule/outpatientsch.page?menuId=clinic" class="btn btn-info" role="button">외래진료일정</a>
		</div>
	</div>
</div> --%>
<!-- ======================================================================================================================================= -->

<!-- ======================================================================================================================================= -->
<!-- publishing designed menu -->
<div class="menu_wrap">
	<div class="side-right">
		<div class="side-right-overlay"></div>
		<div class="side-right-content">
			<div class="inner">
				<div class="nav-right list-group" id="doctor_menu">
					<p class="navbar-text nav-right-title">
						<span>DOCTOR</span> <span>MENU</span>
					</p>
					<a class="list-group-item item-1 menu" href="<%=request.getContextPath()%>/mobile/medical/inpatient.page?menuId=clinic"><i class="icon-hospital"><span>입원</span></i></a> 
					<a class="list-group-item item-2 menu" href="<%=request.getContextPath()%>/mobile/medical/outpatient.page?menuId=clinic"><i class="icon-ambulatory"><span>외래</span></i></a> 
					<a class="list-group-item item-3 menu" href="<%=request.getContextPath()%>/mobile/medical/oppatient.page?menuId=clinic"><i class="icon-surgery"><span>수술</span></i></a>
					<a class="list-group-item item-4 menu" href="<%=request.getContextPath()%>/mobile/medical/trpatient.page?menuId=clinic"><i class="icon-medical"><span>시술</span></i></a>
					<a class="list-group-item item-5 menu" href="<%=request.getContextPath()%>/mobile/medical/empatient.page?menuId=clinic"><i class="icon-emergency"><span>응급</span></i></a>
					<a class="list-group-item item-6 menu" href="<%=request.getContextPath()%>/mobile/medical/copatient.page?menuId=clinic"><i class="icon-cooper"><span>협진</span></i></a>
					<!--
					<p class="nav-right-bar">간편찾기</p>
					<div>
						<a class="list-group-item item-7 py-2 search control-disabled" href="<%=request.getContextPath()%>/mobile/medical/nfcpatient.page?menuId=clinic"><span>NFC</span></a> 
						<a class="list-group-item item-8 py-2 search control-disabled" href="<%=request.getContextPath()%>/mobile/medical/qrpatient.page?menuId=clinic"><span>QR code</span></a>
						<a class="list-group-item item-9 py-2 search control-disabled" href="<%=request.getContextPath()%>/mobile/medical/barpatient.page?menuId=clinic"><span>bar code</span></a>
					</div>
					-->
				</div>
			</div>
		</div>
	</div>
	<!--end::class::side-right-->
	<div class="side-left">
		<div class="side-left-overlay"></div>
		<div class="side-left-content">
			<div class="nav-left">
				<div class="panel panel-default">
					<div id="mainMenu">
						<div class="menu_top">
							<h5>
								<i class="icon-man"></i>
							</h5>
							<div class="name">
								<p id="spanCurrentUserName">홍길동 님</p>
								<span><span id="spanCurrentDeptName"></span> <a href="#" id="btnChangeDept"><i>수정</i></a></span>
							</div>
							<div class="btn">
								<button type="button" name="settingBtn" class="setting" id="btnOpenConfigList">
									<i>설정</i>
								</button>
								<button type="button" name="CloseBtn" class="close">
									<i>닫기</i>
								</button>
							</div>
						</div>
						<div class="menu_item treatment">
							<h5>환자<br>정보</h5>
							<ul id="main_menu_medical">
								<li><a href="<%=request.getContextPath()%>/mobile/medical/inpatient.page?menuId=clinic"><i class="icon-hospital"></i><span>입원</span></a></li>
								<li><a href="<%=request.getContextPath()%>/mobile/medical/outpatient.page?menuId=clinic"><i class="icon-ambulatory"></i><span>외래</span></a></li>
								<li><a href="<%=request.getContextPath()%>/mobile/medical/oppatient.page?menuId=clinic"><i class="icon-surgery"></i><span>수술</span></a></li>
								<li><a href="<%=request.getContextPath()%>/mobile/medical/trpatient.page?menuId=clinic"><i class="icon-medical"></i><span>시술</span></a></li>
								<li><a href="<%=request.getContextPath()%>/mobile/medical/empatient.page?menuId=clinic"><i class="icon-emergency"></i><span>응급</span></a></li>
								<li><a href="<%=request.getContextPath()%>/mobile/medical/copatient.page?menuId=clinic"><i class="icon-cooper"></i><span>협진</span></a></li>
							</ul>
						</div>
                        <div class="menu_item treatment">
                            <h5>환자<br>안전</h5>
                            <ul id="main_menu_medical">
                                <li><a href="<%=request.getContextPath()%>/mobile/safety/injection.page?menuId=clinic"><i class="icon-ambulatory"></i><span>투약</span></a></li>
                                <li><a href="<%=request.getContextPath()%>/mobile/safety/infusion.page?menuId=clinic"><i class="icon-ambulatory"></i><span>IVF</span></a></li>
                                <li><a href="<%=request.getContextPath()%>/mobile/safety/bleeding.page?menuId=clinic"><i class="icon-ambulatory"></i><span>채혈</span></a></li>
                                <li><a href="<%=request.getContextPath()%>/mobile/safety/bloodmanagement.page?menuId=clinic"><i class="icon-ambulatory"></i><span>혈액관리</span></a></li>
                                <li></li>
                                <li></li>
                            </ul>
                        </div>
						<div class="menu_item schedule" id="main_menu_schedule">
							<h5>
								일정<br>관리
							</h5>
							<ul>
								<li class=""><a href="<%=request.getContextPath()%>/mobile/schedule/outpatientsch.page?menuId=clinic"><i class="icon-medi_sch"></i><span>진료일정</span></a></li>
								<li class=""><a href="<%=request.getContextPath()%>/mobile/schedule/doctorworksch.page?menuId=clinic"><i class="icon-calendar"></i><span>의사스케줄</span></a></li>
								<!--
								<li class="control-disabled"><a href="<%=request.getContextPath()%>/mobile/schedule/nurseworksch.page?menuId=clinic"><i class="icon-calendar"></i><span>간호사스케줄</span></a></li>
								-->
								<li></li>
							</ul>
						</div>
						<!--
						<div class="menu_item search">
							<h5>검색</h5>
							<ul>
								<li class="control-disabled"><a href="<%=request.getContextPath()%>/mobile/medical/nfcpatient.page?menuId=clinic" class="nfc"><i></i> <span>NFC</span></a></li>
								<li class="control-disabled"><a href="<%=request.getContextPath()%>/mobile/medical/qrpatient.page?menuId=clinic" class="qr"><i></i><span>QR 코드</span></a></li>
								<li class="control-disabled"><a href="<%=request.getContextPath()%>/mobile/medical/barpatient.page?menuId=clinic" class="bar"><i></i><span>바코드</span></a></li>
							</ul>
						</div>
						-->
					</div>
					<!--end::id::mainMenu-->
					<div class="btn_wrap">
						<!-- <button class="help" type="button">도움말</button> -->
						<button type="button" id="btnExitApp">종료</button>
						<button class="logout" type="button" id="btnLogout">로그아웃</button>
					</div>
				</div>
				<!-- /panel panel-default -->
			</div>
			<!-- /nav-left -->
		</div>
	</div>
	<!--end::class::side-left-->
</div>
<!-- ======================================================================================================================================= -->


<!-- Modal Sample dialog -->
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/modalsample.js?version=" /><s:message code="mp.version"/>"></script>

<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/menu.js?version=" /><s:message code="mp.version"/>"></script>

<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/patientinfo.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/medihistory.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/medirecord.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/medirecorddetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/prescription.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/druginfo.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/examlist.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/examrsltty1.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/examrsltty2.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/operationdetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/treatmentdetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/collaborationdetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/vital.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/vitallist.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/medication.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/medicationlist.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/doctorworkschdetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/nurseworkschdetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/internworkschdetail.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/doctorinfo.js?version=" /><s:message code="mp.version"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/mobile/modal/configlist.js?version=" /><s:message code="mp.version"/>"></script>

<script type="text/javascript">

//==== main menu, quick menu, config 설정 { ====
	var mplusModalMenu = new mplus_modal_menu();
	mplusModalMenu.init();

	$('#btnMainMenu').on('click', function() {
		$('#divMainMenu').addClass('active');
		$('.overlay').addClass('active');
	});

	$('#btnQuickMenu').on('click', function() {
		$('#divQuickMenu').addClass('active');
		$('.overlay').addClass('active');
	});

	jQuery(document).on('show.bs.modal', '.modal', function() {
		var maxZ = parseInt(jQuery('.modal-backdrop').css('z-index')) || 1040;

		jQuery('.modal:visible').each(function() {
			maxZ = Math.max(parseInt(jQuery(this).css('z-index')), maxZ);
		});

		jQuery('.modal-backdrop').css('z-index', maxZ);
		jQuery(this).css("z-index", maxZ + 1);
		jQuery('.modal-dialog', this).css("z-index", maxZ + 2);
	});

	jQuery(document).on('hidden.bs.modal', '.modal', function() {
		if (jQuery('.modal:visible').length) {
			jQuery(document.body).addClass('modal-open');

			var maxZ = 1040;

			jQuery('.modal:visible').each(function() {
				maxZ = Math.max(parseInt(jQuery(this).css('z-index')), maxZ);
			});

			jQuery('.modal-backdrop').css('z-index', maxZ - 1);
		}
	});	
	/*
	if((/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()))){		
		var tempTag = "<div class=\"menu_item search\">"
		+ "<h5>다운<br/>로드</h5>"
		+ "<ul>"		
		+ "<li class=\"\"><a href=\"javascript:callDownloadPage()\" class=\"down\"><i></i><span style=\"padding-top:6px\">다운로드</span></a></li></ul>"
		+ "</div>";
		$("#mainMenu").append(tempTag);
	}
	
	var callDownloadPage = function(){
		console.log("callDownloadPage call!");
		var msg = {
			    "type":"command",
			    "functionType":"popup",
			    "value" : {
			        "url" : "https://nps.kuh.ac.kr/mplus-deploy/downview.page?d1=root" ,
			        "method": "GET",  // Default "GET"  ** 2017-10-19 추가
			        "parameters": "-"  // POST 인 경우만, GET 인 경우는 "url" 에 모두 붙여서 전달  ** 2017-10-19 추가
			    }
		};
		var data = JSON.stringify( msg );
		data = "tonative://" + msg.functionType + "?";
		var keys = Object.keys(msg.value);
		for( var i = 0; i < keys.length; i++) {
			data = data + keys[i] + '=' + msg.value[keys[i]];
			if( i < (keys.length - 1)) {data = data + '&'}
		}
		location.href = data;
	};
	*/
	
	// 선택된 사용자와 부서를 메뉴 화면에 표시
	$("#spanCurrentUserName").text( gLoginUserNm + " 님");
	$("#spanCurrentDeptName").text( localStorage.getItem("selectedDeptNm"));
	
	//==== main menu, quick menu, config 설정 } ====
		
	//==== modal dialog object 생성 { ====
	var mplusModalPatientinfo = new mplus_modal_patientinfo();
	var mplusModalMedicalhistory = new mplus_modal_medicalhistory();
	var mplusModalMedicalrecord = new mplus_modal_medicalrecord();
	mplusModalMedicalrecord.setGlobal(mplusModalMedicalrecord); // toNative callback 처리
	var mplusModalMedicalrecorddetail = new mplus_modal_medicalrecorddetail();
	var mplusModalPrescription = new mplus_modal_prescription();
	var mplusModalDruginfo = new mplus_modal_druginfo();
	var	mplusModalExamlist = new mplus_modal_examlist();
	var mplusModalExamrsltty1 = new mplus_modal_examrsltty1();
	var mplusModalExamrsltty2 = new mplus_modal_examrsltty2();
	var mplusModalOperationdetail = new mplus_modal_operationdetail();
	var mplusModalTreatmentdetail = new mplus_modal_treatmentdetail();
	var mplusModalCollaborationdetail = new mplus_modal_collaborationdetail();
	var mplusModalVital = new mplus_modal_vital();
	var mplusModalVitallist = new mplus_modal_vitallist();
	var mplusModalMedication = new mplus_modal_medication();
	var mplusModalMedicationlist = new mplus_modal_medicationlist();
	var mplusModalDoctorworkschdetail = new mplus_modal_doctorworkschdetail();
	var mplusModalNurseworkschdetail = new mplus_modal_nurseworkschdetail();
	var mplusModalInternworkschdetail = new mplus_modal_internworkschdetail();	
	var mplusModalDoctorinfo = new mplus_modal_doctorinfo();
	var mplusModalConfiglist = new mplus_modal_configlist();
	//==== modal dialog object 생성 } ====

	//20190528 dkchoi75 백병원 별 햄버거, 닥터메뉴 미노출 처리
	/*
	if (gClientIp == "14.40.0.113" || gClientIp == "14.40.4.137" || gClientIp == "100.100.251.251" || gClientIp == "10.10.10.36" || gClientIp == "127.0.0.1") {
		$("#doctor_menu").append("<a class=\"list-group-item item-4 menu\" href=\"<%=request.getContextPath()%>/mobile/medical/trpatient.page?menuId=clinic\"><i class=\"icon-medical\"><span>시술</span></i></a>");
		$("#main_menu_medical").append("<li><a href=\"<%=request.getContextPath()%>/mobile/medical/trpatient.page?menuId=clinic\"><i class=\"icon-medical\"></i><span>시술</span></a></li>");

		$("#main_menu_schedule").append("<h5>일정<br>관리</h5>");
		$("#main_menu_schedule").append("<ul><li class=\"\"><a href=\"<%=request.getContextPath()%>/mobile/schedule/outpatientsch.page?menuId=clinic\"><i class=\"icon-medi_sch\"></i><span>진료일정</span></a></li><li class=\"\"><a href=\"<%=request.getContextPath()%>/mobile/schedule/doctorworksch.page?menuId=clinic\"><i class=\"icon-calendar\"></i><span>의사스케줄</span></a></li><li></li></ul>");
	} else {
		$("#main_menu_medical").append("<li></li>");
	}
	*/

</script>