<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/init.jsp" %>

<%
String id = PortalUtil.generateRandomKey(request, "configuration_category_menu.jsp");

ConfigurationEntry configurationEntry = (ConfigurationEntry)request.getAttribute(ConfigurationAdminWebKeys.CONFIGURATION_ENTRY);

ConfigurationCategoryMenuDisplay configurationCategoryMenuDisplay = (ConfigurationCategoryMenuDisplay)request.getAttribute(ConfigurationAdminWebKeys.CONFIGURATION_CATEGORY_MENU_DISPLAY);
%>

<nav class="menubar menubar-transparent menubar-vertical-expand-md">
	<a aria-controls="<%= id %>" aria-expanded="false" class="menubar-toggler" data-toggle="liferay-collapse" href="#<%= id %>" role="button">
		<liferay-ui:message key="<%= configurationEntry.getName() %>" />

		<aui:icon image="caret-bottom" markupView="lexicon" />
	</a>

	<div class="collapse menubar-collapse" id="<%= id %>">
		<ul class="nav nav-nested">

			<%
			for (ConfigurationScopeDisplay configurationScopeDisplay : configurationCategoryMenuDisplay.getConfigurationScopeDisplays()) {
				if (configurationScopeDisplay.isEmpty()) {
					continue;
				}

				List<ConfigurationEntry> configurationEntries = configurationScopeDisplay.getConfigurationEntries();
			%>

				<li class="nav-item">
					<a class="nav-link text-uppercase">
						<liferay-ui:message key='<%= "scope." + configurationScopeDisplay.getScope() %>' />
					</a>

					<div>
						<ul class="nav nav-stacked">

							<%
							for (ConfigurationEntry curConfigurationEntry : configurationEntries) {
							%>

								<li>
									<aui:a cssClass='<%= configurationEntry.equals(curConfigurationEntry) ? "active nav-link" : "nav-link" %>' href="<%= curConfigurationEntry.getEditURL(renderRequest, renderResponse) %>"><%= curConfigurationEntry.getName() %></aui:a>
								</li>

							<%
							}
							%>

						</ul>
					</div>
				</li>

			<%
			}
			%>

		</ul>
	</div>
</nav>