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

<liferay-frontend:fieldset-group>
	<liferay-frontend:fieldset
		disabled="<%= editAssetListDisplayContext.isLiveGroup() %>"
	>
		<liferay-asset:asset-tags-error />

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

			<%
			DuplicateQueryRuleException 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>

		<p><liferay-ui:message key="displayed-items-must-match-these-rules" /></p>

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

		<div>
			<react:component
				module="auto_field/index"
				props='<%=
					HashMapBuilder.<String, Object>put(
						"categorySelectorURL", editAssetListDisplayContext.getCategorySelectorURL()
					).put(
						"disabled", editAssetListDisplayContext.isLiveGroup()
					).put(
						"groupIds", ListUtil.toList(editAssetListDisplayContext.getReferencedModelsGroupIds())
					).put(
						"namespace", liferayPortletResponse.getNamespace()
					).put(
						"rules", editAssetListDisplayContext.getAutoFieldRulesJSONArray()
					).put(
						"tagSelectorURL", editAssetListDisplayContext.getTagSelectorURL()
					).put(
						"vocabularyIds", editAssetListDisplayContext.getVocabularyIds()
					).build()
				%>'
			/>
		</div>
	</liferay-frontend:fieldset>
</liferay-frontend:fieldset-group>