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

<aui:select label='<%= typePrefix + "-workflow" %>' name='<%= typePrefix + "WorkflowDefinition" %>'>
	<aui:option label="no-workflow" value="" />

	<%
	WorkflowDefinitionLink workflowDefinitionLink = commerceChannelDisplayContext.getWorkflowDefinitionLink(typePK);

	for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
		boolean selected = false;

		if ((workflowDefinitionLink != null) && Objects.equals(workflowDefinitionLink.getWorkflowDefinitionName(), workflowDefinition.getName()) && (workflowDefinitionLink.getWorkflowDefinitionVersion() == workflowDefinition.getVersion())) {
			selected = true;
		}
	%>

		<aui:option label='<%= HtmlUtil.escapeAttribute(workflowDefinition.getTitle(themeDisplay.getLanguageId())) + " (" + LanguageUtil.format(locale, "version-x", workflowDefinition.getVersion(), false) + StringPool.CLOSE_PARENTHESIS %>' selected="<%= selected %>" value="<%= HtmlUtil.escapeAttribute(workflowDefinition.getName()) + StringPool.AT + workflowDefinition.getVersion() %>" />

	<%
	}
	%>

</aui:select>