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

<aui:fieldset label="displayed-assets-must-match-these-rules" markupView="lexicon">
	<liferay-asset:asset-tags-error />

	<%
	DuplicateQueryRuleException dqre = null;
	%>

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

		<%
		dqre = (DuplicateQueryRuleException)errorException;

		String name = "categories";

		if (Objects.equals(dqre.getName(), "assetTags")) {
			name = "tags";
		}
		else if (Objects.equals(dqre.getName(), "keywords")) {
			name = "keywords";
		}
		%>

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

<div>
	<react:component
		module="auto_field/index"
		props='<%=
			HashMapBuilder.<String, Object>put(
				"categorySelectorURL", assetPublisherDisplayContext.getCategorySelectorURL()
			).put(
				"groupIds", ListUtil.toList(assetPublisherDisplayContext.getReferencedModelsGroupIds())
			).put(
				"id", "autofield"
			).put(
				"namespace", liferayPortletResponse.getNamespace()
			).put(
				"pathThemeImages", themeDisplay.getPathThemeImages()
			).put(
				"rules", assetPublisherDisplayContext.getAutoFieldRulesJSONArray()
			).put(
				"tagSelectorURL", assetPublisherDisplayContext.getTagSelectorURL()
			).put(
				"vocabularyIds", assetPublisherDisplayContext.getVocabularyIds()
			).build()
		%>'
	/>
</div>