<%--
/**
 * 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" %>

<%
portletDisplay.setShowStagingIcon(false);
%>

<clay:navigation-bar
	navigationItems="<%= layoutsAdminDisplayContext.getNavigationItems() %>"
/>

<c:choose>
	<c:when test='<%= Objects.equals(layoutsAdminDisplayContext.getTabs1(), "utility-pages") %>'>
		<liferay-util:include page="/view_layout_utility_page_entries.jsp" servletContext="<%= application %>" />
	</c:when>
	<c:otherwise>
		<liferay-ui:success key='<%= portletDisplay.getId() + "requestProcessed" %>' message="your-request-completed-successfully" />

		<liferay-ui:success key='<%= portletDisplay.getPortletName() + "layoutUpdated" %>' message='<%= LanguageUtil.get(resourceBundle, "the-page-was-updated-successfully") %>' />

		<liferay-ui:success key="layoutPublished" message="the-page-was-published-successfully" />

		<liferay-ui:error embed="<%= false %>" exception="<%= GroupInheritContentException.class %>" message="this-page-cannot-be-deleted-and-cannot-have-child-pages-because-it-is-associated-with-a-site-template" />

		<clay:management-toolbar
			managementToolbarDisplayContext="<%= new LayoutsAdminManagementToolbarDisplayContext(request, liferayPortletRequest, liferayPortletResponse, layoutsAdminDisplayContext) %>"
			propsTransformer="js/LayoutsManagementToolbarPropsTransformer"
		/>

		<liferay-ui:error exception="<%= LayoutTypeException.class %>">

			<%
			LayoutTypeException lte = (LayoutTypeException)errorException;
			%>

			<c:if test="<%= lte.getType() == LayoutTypeException.FIRST_LAYOUT %>">
				<liferay-ui:message arguments='<%= "layout.types." + lte.getLayoutType() %>' key="the-first-page-cannot-be-of-type-x" />
			</c:if>
		</liferay-ui:error>

		<liferay-ui:error exception="<%= RequiredSegmentsExperienceException.MustNotDeleteSegmentsExperienceReferencedBySegmentsExperiments.class %>" message="this-page-cannot-be-deleted-because-it-has-ab-tests-in-progress" />

		<aui:form cssClass="container-fluid container-fluid-max-xl" name="fm">
			<c:choose>
				<c:when test="<%= layoutsAdminDisplayContext.hasLayouts() %>">
					<c:choose>
						<c:when test="<%= layoutsAdminDisplayContext.isSearch() %>">
							<liferay-util:include page="/flattened_view.jsp" servletContext="<%= application %>" />
						</c:when>
						<c:otherwise>

							<%
							MillerColumnsDisplayContext millerColumnsDisplayContext = (MillerColumnsDisplayContext)request.getAttribute(LayoutAdminWebKeys.MILLER_COLUMNS_DISPLAY_CONTEXT);
							%>

							<div>
								<react:component
									module="js/layout/Layout"
									props="<%= millerColumnsDisplayContext.getLayoutData() %>"
								/>
							</div>
						</c:otherwise>
					</c:choose>
				</c:when>
				<c:otherwise>
					<liferay-frontend:empty-result-message
						actionDropdownItems="<%= layoutsAdminDisplayContext.isShowAddRootLayoutButton() ? layoutsAdminDisplayContext.getAddLayoutDropdownItems() : null %>"
						buttonCssClass="secondary"
						description='<%= LanguageUtil.get(request, "fortunately-it-is-very-easy-to-add-new-ones") %>'
						elementType='<%= LanguageUtil.get(request, "pages") %>'
					/>
				</c:otherwise>
			</c:choose>
		</aui:form>
	</c:otherwise>
</c:choose>