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

<%
ObjectDefinition objectDefinition = (ObjectDefinition)request.getAttribute(ObjectWebKeys.OBJECT_DEFINITION);
ObjectDefinitionsDetailsDisplayContext objectDefinitionsDetailsDisplayContext = (ObjectDefinitionsDetailsDisplayContext)request.getAttribute(WebKeys.PORTLET_DISPLAY_CONTEXT);
%>

<div class="lfr-object__edit-object-definition">
	<c:choose>
		<c:when test='<%= Objects.equals(ParamUtil.getString(request, "screenNavigationCategoryKey"), "details") %>'>
			<div style="margin-bottom: 4rem;"></div>
		</c:when>
		<c:otherwise>
			<div>
				<react:component
					module="js/components/ObjectManagementToolbar"
					props='<%=
						HashMapBuilder.<String, Object>put(
							"backURL", ParamUtil.getString(request, "backURL", String.valueOf(renderResponse.createRenderURL()))
						).put(
							"externalReferenceCode", objectDefinition.getExternalReferenceCode()
						).put(
							"hasPublishObjectPermission", objectDefinitionsDetailsDisplayContext.hasPublishObjectPermission()
						).put(
							"hasUpdateObjectDefinitionPermission", objectDefinitionsDetailsDisplayContext.hasUpdateObjectDefinitionPermission()
						).put(
							"isApproved", objectDefinition.isApproved()
						).put(
							"label", objectDefinition.getLabel(locale, true)
						).put(
							"objectDefinitionId", objectDefinition.getObjectDefinitionId()
						).put(
							"portletNamespace", liferayPortletResponse.getNamespace()
						).put(
							"screenNavigationCategoryKey", ParamUtil.getString(request, "screenNavigationCategoryKey")
						).put(
							"system", objectDefinition.isSystem()
						).build()
					%>'
				/>
			</div>
		</c:otherwise>
	</c:choose>

	<liferay-frontend:screen-navigation
		context="<%= objectDefinition %>"
		key="<%= ObjectDefinitionsScreenNavigationEntryConstants.SCREEN_NAVIGATION_KEY_OBJECT_DEFINITION %>"
		portletURL='<%=
			PortletURLBuilder.createRenderURL(
				renderResponse
			).setMVCRenderCommandName(
				"/object_definitions/edit_object_definition"
			).setParameter(
				"objectDefinitionId", objectDefinition.getObjectDefinitionId()
			).build()
		%>'
	/>
</div>