<%--
/**
 * 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 backURL = ParamUtil.getString(request, "backURL", String.valueOf(renderResponse.createRenderURL()));

ViewNotificationTemplatesDisplayContext viewNotificationTemplatesDisplayContext = (ViewNotificationTemplatesDisplayContext)request.getAttribute(WebKeys.PORTLET_DISPLAY_CONTEXT);

NotificationTemplate notificationTemplate = viewNotificationTemplatesDisplayContext.getNotificationTemplate();

String externalReferenceCode = StringPool.BLANK;
long notificationTemplateId = 0;

if (notificationTemplate != null) {
	externalReferenceCode = notificationTemplate.getExternalReferenceCode();
	notificationTemplateId = notificationTemplate.getNotificationTemplateId();
}

portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(backURL);

renderResponse.setTitle(LanguageUtil.get(request, "notification-template"));
%>

<liferay-portlet:resourceURL copyCurrentRenderParameters="<%= false %>" var="baseResourceURL" />

<react:component
	module="js/components/EditNotificationTemplate"
	props='<%=
		HashMapBuilder.<String, Object>put(
			"backURL", ParamUtil.getString(request, "backURL", String.valueOf(renderResponse.createRenderURL()))
		).put(
			"baseResourceURL", String.valueOf(baseResourceURL)
		).put(
			"editorConfig", viewNotificationTemplatesDisplayContext.getEditorConfig()
		).put(
			"externalReferenceCode", externalReferenceCode
		).put(
			"notificationTemplateId", notificationTemplateId
		).put(
			"notificationTemplateType", viewNotificationTemplatesDisplayContext.getNotificationTemplateType()
		).put(
			"portletNamespace", liferayPortletResponse.getNamespace()
		).build()
	%>'
/>