<%@ page contentType="text/html; charset=UTF-8"%><%@ include file="/WEB-INF/jspf/include/taglibs.jsp"%>
<fmt:setLocale value="ru_RU" scope="session"/>

<!doctype html>
<%-- иконки https://icon-icons.com/ru/pack/UI-&-Office/3106&page=1 --%>
<html lang="ru">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
		<link href="${pageContext.request.contextPath}/css/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
		<link href="${pageContext.request.contextPath}/style.css" rel="stylesheet" type="text/css"/>
		<!-- специальный пустой css файл для пользовательский стилей, не перетирается при обновлениях -->
		<link href="${pageContext.request.contextPath}/custom.css" rel="stylesheet" type="text/css"/>

		<script src="${pageContext.request.contextPath}/js/jquery-min.js"></script>
		<script src="${pageContext.request.contextPath}/js/jquery.form.js"></script>
		<script src="${pageContext.request.contextPath}/js/jquery-ui.min.js"></script>
		<script src="${pageContext.request.contextPath}/js/common.js"></script>
		<script src="${pageContext.request.contextPath}/js/bgbilling.js"></script>
		<script src="${pageContext.request.contextPath}/js/jquery.bg.widgets.js"></script>
		<!-- специальный пустой js файл для пользовательский функций, не перетирается при обновлениях -->
		<script src="${pageContext.request.contextPath}/js/custom.js"></script>
		<title>BGBilling || 
		<c:set var="pageTitleFromMenu"><c:forEach var="menuItem" items="${menuItemList}"><c:if test="${module eq menuItem.module && mid == menuItem.moduleId && action eq menuItem.action}">${menuItem.title}</c:if></c:forEach></c:set>
	  	<c:choose>
	  		<c:when test="${not empty pageTitleFromMenu}">${pageTitleFromMenu}</c:when>
	  		<c:otherwise>${pageTitle}</c:otherwise>
<%-- 
	  		<c:when test="${action eq 'DistributeBalance'}">РАСПРЕДЕЛЕНИЕ СРЕДСТВ</c:when>
	  		<c:when test="${action eq 'Subscription'}">ПОДПИСКА НА РАССЫЛКИ</c:when>
	  		<c:when test="${action eq 'DispatchBalance'}">РАССЫЛКА БАЛАНСА</c:when>
--%>
	  	</c:choose>
		</title>
		
		<script type="text/javascript">
			var contextPath = "${pageContext.request.contextPath}";
			var webexecuter = "webexecuter";
			var contractId = ${contract_current.id};
			var dashboardQuery = { action: 'Dashboard', mid: "d" };

			function disableButton( button ) { button.disabled = true; }
		</script>
	</head>
	<body>
		<div class="pageHeader fixed-top">
			<div class="content">
				<div class="logo"><a href="${pageContext.request.contextPath}/webexecuter"></a></div>
				<c:if test="${not empty contract}">
					<div class="contract"><a href="${pageContext.request.contextPath}/webexecuter/b/Contracts"><img src="${pageContext.request.contextPath}/img/user.png" title="договор" height="28" style="vertical-align: text-bottom; padding-right: 5px;"><span>${contract.title}</span></a></div>
				</c:if>
				<div class="buttons bgMenuButtons">
					<div class="bgBalanceInformerWidget balance" style="white-space: nowrap;" jsp="${pageContext.request.contextPath}/widget/contract/headerBalanceInformer.jsp"></div>
					<div style="width: 2rem;">&nbsp;</div>
					<c:if test="${not empty notificationsCount}"><div class=""><a href="${pageContext.request.contextPath}/webexecuter/b/Notification"><img src="${pageContext.request.contextPath}/img/alert.png" title="уведомления" height="28"></a></div></c:if>
					<div class="bgMenu"><img src="${pageContext.request.contextPath}/img/menu.png" title="меню" height="28">
						<ul style="right: -25px; top: 28px;">
							<li><a href="${pageContext.request.contextPath}/webexecuter/b/Parameters">Параметры договора</a></li>
							<li><a href="${pageContext.request.contextPath}/webexecuter/b/Password">Смена пароля</a></li>
							<li><a href="${pageContext.request.contextPath}/webexecuter/b/Notes">Примечания</a></li>
						</ul>
					</div>
					<div><a onClick="return confirm('Покинуть Личный кабинет?');" href="${pageContext.request.contextPath}/webexecuter?action=Exit&mid=contract"><img src="${pageContext.request.contextPath}/img/exit1.png" title="выход" height="28"></a></div>
				</div>
			</div>
			<div class="pageMenu">
				<ul class="nav nav-pills">
					<li class="nav-item"><a class="nav-link" href="${pageContext.request.contextPath}/webexecuter">ГЛАВНАЯ</a></li>
					<c:forEach var="item" items="${dashboardItems}">
						<c:choose>
							<c:when test="${item.itemType eq 'FOLDER' }">
								<li class="nav-item">
									<a class="nav-link dropdown-toggle text-uppercase"data-bs-toggle="dropdown">${item.title}</a>
									<ul class="dropdown-menu">
									<c:forEach var="subItem" items="${item.subItems}">
										<c:choose>
											<c:when test="${ 'contract.basic' eq subItem.module }">
												<li><a class="dropdown-item" href="${pageContext.request.contextPath}/webexecuter/b/${subItem.action}">${subItem.title}</a></li>									
											</c:when>
											<c:when test="${ subItem.module eq 'ru.bitel.bgbilling.plugins.assistant' }">
												<li><a class="dropdown-item" href="${pageContext.request.contextPath}/webexecuter/p${subItem.moduleId}/Assistant?masterId=${subItem.assistantMasterId}">${subItem.title}</a></li>									
											</c:when>
											<c:when test="${ fn:startsWith( subItem.module, 'ru.bitel.bgbilling.plugins' ) }">
												<li><a class="dropdown-item" href="${pageContext.request.contextPath}/webexecuter/p${subItem.moduleId}/${subItem.action}">${subItem.title}</a></li>									
											</c:when>
											<c:when test="${ subItem.moduleId > 0 }">
												<li><a class="dropdown-item" href="${pageContext.request.contextPath}/webexecuter/m${subItem.moduleId}/${subItem.action}">${subItem.title}</a></li>									
											</c:when>
											<c:otherwise>
												<c:set var="dashboardOnClick">showBlock( 'contentRoot', '', { action: '${subItem.action}', mid: '${subItem.moduleId}', module: '${subItem.module}', contractId: '${contract.id}', getBody: true } ); return false;</c:set>
												<li><a class="dropdown-item" href="#" onclick="${dashboardOnClick}">${subItem.title}</a></li>									
											</c:otherwise>
										</c:choose>
									</c:forEach>									 
									</ul>
								</li>
							</c:when>
						</c:choose>
					</c:forEach>
				</ul>
			</div>
		</div>
		<div style="height: 10rem;"></div>
		<div id="all" style="margin: 0rem auto 0rem auto;">
			<!-- content -->
			<div class="content" style="">
	        	<script>
			      <!--
						document.cookie = 'BGBILLING=1; samesite=strict';
						var ccc = document.cookie;
						if ( ccc == undefined || ccc.length == 0 || ccc.indexOf( "BGBILLING" ) == -1 ) { document.write( '<div class="alert alert-danger" role="alert">ВНИМАНИЕ!!! Для корректной работы с данным сайтом необходимо включить поддержку Cookies в браузере. Как это сделать смотрите <a href="#"	onClick="window.open(\'help/cookies.html\', \'mywin2\', \'toolbar=no,status=no,width=600,height=455\'); return false;">здесь</a>.</div>' ); }
			      	--> 
			    </script>
			    
<%-- 			
			    <div id="dashboardPaths">&nbsp;</div>

				<div class="pageTitle" id="pageTitle">
					<c:choose>
						<c:when test="${not empty pageTitleFromMenu}">${pageTitleFromMenu}</c:when>
						<c:otherwise>${pageTitle}</c:otherwise>
					</c:choose>
				</div>
--%>
				<c:if test="${not empty errorStatus}"><div class="alert alert-danger" role="alert">${errorStatus[1]}</div></c:if>
			
				<div id="contentRoot" class="pageRoot">
				<%@include file="include/error.jsp" %>
				<c:choose>
					<c:when test="${not empty jspPage}"><jsp:include page="${jspPage}"/></c:when>
					<c:otherwise><%@ include file="contract/dashboard.jsp"%></c:otherwise>
				</c:choose>
				</div>
			</div>
			<!-- end content -->

			<jsp:include page="/WEB-INF/jspf/include/footer.jsp"/>
      	</div>
		<div id="requestLimit" class="bgmodal" style="display: none;">
			<div class="bgmodal_dialog">
				<div class="bgmodal-content titleFont2" style="padding: 75px; text-align: center;">Превышен лимит запросов</div>
			</div>
		</div>
		<!-- error popup  -->
		<div id="bgModal2" style="display: none;">
		<div class="bgmodal" aria-hidden="true">
		    <div class="bgmodal_dialog" aria-hidden="true">
				<div class="bgmodal-content">
		      		<div class="bgmodal-header">
		        		<h3 class="bgmodal-title" id="bgModal2-message-title"></h3>
		        		<a href="#" title="Закрыть окно" class="bgmodal-close" onclick="document.getElementById( 'bgModal2' ).style.display = 'none'; return false;">×</a>
		        		<%--
		        		<c:choose>
		        			<c:when test="${message.onClose eq 'close'}"><a href="#" title="Закрыть окно" class="bgmodal-close" onclick="jQuery('#bgModal').parent().html(''); return false;">×</a></c:when>
		        			<c:when test="${message.onClose eq 'redirect'}">
				        		<c:if test="${not empty message.tabClick}"><c:set var="tabClick">jQuery('#${message.tabClick}').trigger('click'); </c:set></c:if>
				        		<c:set var="onclick">
				        		<c:choose>
				        			<c:when test="${not empty message.queryParamList}">${tabClick}; showBlock( '${message.targetId}', '${message.operation}', { ...${message.query}<c:forEach var="item" items="${message.queryParamList}">, ${item.key}: '${item.value}'</c:forEach> } );</c:when>
				        			<c:otherwise>${tabClick}showBlock( '${message.targetId}', '${message.operation}', ${message.query} );</c:otherwise>
				        		</c:choose>
				        		</c:set>
				        		<a href="#" title="Закрыть окно" class="bgmodal-close" onclick="${onclick} return false;">×</a>
				        	</c:when>
		        			<c:when test="${message.onClose eq 'link'}">
				        		<a href="#" title="Закрыть окно" class="bgmodal-close" onclick="window.open('${message.query}'); return false;">×</a>
							</c:when>
		        			<c:when test="${message.onClose eq 'reload'}">
				        		<a href="#" title="Закрыть окно" class="bgmodal-close" onclick="window.location.reload(true); return false;">×</a>
							</c:when>
									        	
		        			<c:otherwise>
		       				</c:otherwise>
			       		</c:choose>
			       		--%>
		      		</div>
		      		<div class="bgmodal-body" id="bgModal2-message-text"></div>
					<div class="text-center my-3"><button class="btn btn-primary" onclick="document.getElementById( 'bgModal2' ).style.display = 'none'; return false;">Закрыть</button></div>
		    	</div>    
		    </div>
		</div>
		</div>		
	<script src="${pageContext.request.contextPath}/js/bootstrap.bundle.min.js"></script>
    </body>
</html>
