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

<%
CPPublisherConfigurationDisplayContext cpPublisherConfigurationDisplayContext = (CPPublisherConfigurationDisplayContext)request.getAttribute(WebKeys.PORTLET_DISPLAY_CONTEXT);
%>

<aui:fieldset label="displayed-assets-must-match-these-rules" markupView="lexicon">

	<%
	DuplicateQueryRuleException dqre = null;
	%>

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

		<%
		dqre = (DuplicateQueryRuleException)errorException;

		String name = dqre.getName();
		%>

		<liferay-util:buffer
			var="messageArgument"
		>
			<em>(<liferay-ui:message key='<%= dqre.isContains() ? "contains" : "does-not-contain" %>' /> - <liferay-ui:message key='<%= dqre.isAndOperator() ? "all" : "any" %>' /> - <liferay-ui:message key='<%= name.equals("assetTags") ? "tags" : "categories" %>' />)</em>
		</liferay-util:buffer>

		<liferay-ui:message arguments="<%= messageArgument %>" key="only-one-rule-with-the-combination-x-is-supported" translateArguments="<%= false %>" />
	</liferay-ui:error>
</aui:fieldset>

<div id="<portlet:namespace />ConditionForm"></div>

<soy:template-renderer
	context='<%=
		HashMapBuilder.<String, Object>put(
			"categorySelectorURL", cpPublisherConfigurationDisplayContext.getCategorySelectorURL()
		).put(
			"groupIds", String.valueOf(company.getGroupId())
		).put(
			"id", "autofield"
		).put(
			"namespace", liferayPortletResponse.getNamespace()
		).put(
			"pathThemeImages", themeDisplay.getPathThemeImages()
		).put(
			"rules", cpPublisherConfigurationDisplayContext.getAutoFieldRulesJSONArray()
		).put(
			"tagSelectorURL", cpPublisherConfigurationDisplayContext.getTagSelectorURL()
		).put(
			"vocabularyIds", cpPublisherConfigurationDisplayContext.getVocabularyIds()
		).build()
	%>'
	module="js/AutoField.es"
	templateNamespace="com.liferay.commerce.product.content.web.AutoField.render"
/>