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

<liferay-ui:search-container
	id="workflowInstances"
	searchContainer="<%= workflowInstanceViewDisplayContext.getSearchContainer() %>"
>
	<liferay-ui:search-container-row
		className="com.liferay.portal.kernel.workflow.WorkflowInstance"
		cssClass="entry-display-style"
		modelVar="workflowInstance"
		stringKey="<%= true %>"
	>
		<liferay-ui:search-container-row-parameter
			name="workflowInstance"
			value="<%= workflowInstance %>"
		/>

		<portlet:renderURL var="rowURL">
			<portlet:param name="mvcPath" value="/instance/edit_workflow_instance.jsp" />
			<portlet:param name="redirect" value="<%= currentURL %>" />
			<portlet:param name="workflowInstanceId" value="<%= String.valueOf(workflowInstance.getWorkflowInstanceId()) %>" />
		</portlet:renderURL>

		<c:choose>
			<c:when test='<%= displayStyle.equals("descriptive") %>'>
				<liferay-ui:search-container-column-icon
					cssClass="asset-icon"
					icon="<%= workflowInstanceViewDisplayContext.getAssetIconCssClass(workflowInstance) %>"
				/>

				<liferay-ui:search-container-column-text
					colspan="<%= 2 %>"
				>
					<h5 class="text-default">

						<%
						dateSearchEntry.setDate(workflowInstanceViewDisplayContext.getLastActivityDate(workflowInstance));
						%>

						<liferay-ui:message key="last-activity-date" />, <%= dateSearchEntry.getName(request) %>
					</h5>

					<h4>
						<aui:a href="<%= rowURL %>">
							<%= workflowInstanceViewDisplayContext.getAssetTitle(workflowInstance) %>
						</aui:a>
					</h4>

					<h5 class="text-default">
						<span class="asset-type">
							<liferay-ui:message key="<%= workflowInstanceViewDisplayContext.getAssetType(workflowInstance) %>" />
						</span>
						<span class="status">
							<liferay-ui:message key="<%= workflowInstanceViewDisplayContext.getStatus(workflowInstance) %>" />
						</span>
						<span class="definition">
							<liferay-ui:message key="<%= workflowInstanceViewDisplayContext.getDefinition(workflowInstance) %>" />
						</span>

						<c:if test="<%= workflowInstanceViewDisplayContext.getEndDate(workflowInstance) != null %>">

							<%
							dateSearchEntry.setDate(workflowInstanceViewDisplayContext.getEndDate(workflowInstance));
							%>

							<span class="end-date">
								<liferay-ui:message key="end-date" />: <%= dateSearchEntry.getName(request) %>
							</span>
						</c:if>
					</h5>
				</liferay-ui:search-container-column-text>

				<c:choose>
					<c:when test="<%= !workflowInstance.isComplete() %>">
						<liferay-ui:search-container-column-jsp
							align="right"
							path="/instance/workflow_instance_action.jsp"
						/>
					</c:when>
					<c:otherwise>
						<liferay-ui:search-container-column-text
							value="<%= StringPool.BLANK %>"
						/>
					</c:otherwise>
				</c:choose>
			</c:when>
			<c:otherwise>
				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand table-cell-minw-200 table-title"
					href="<%= rowURL %>"
					name="asset-title"
					value="<%= workflowInstanceViewDisplayContext.getAssetTitle(workflowInstance) %>"
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand-smaller table-cell-minw-150"
					href="<%= rowURL %>"
					name="asset-type"
					value="<%= workflowInstanceViewDisplayContext.getAssetType(workflowInstance) %>"
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand-smallest"
					href="<%= rowURL %>"
					name="status"
					value="<%= workflowInstanceViewDisplayContext.getStatus(workflowInstance) %>"
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand-smaller table-cell-minw-150"
					href="<%= rowURL %>"
					name="definition"
					value="<%= workflowInstanceViewDisplayContext.getDefinition(workflowInstance) %>"
				/>

				<liferay-ui:search-container-column-date
					cssClass="table-cell-ws-nowrap"
					href="<%= rowURL %>"
					name="last-activity-date"
					value="<%= workflowInstanceViewDisplayContext.getLastActivityDate(workflowInstance) %>"
				/>

				<liferay-ui:search-container-column-date
					cssClass="table-cell-ws-nowrap"
					href="<%= rowURL %>"
					name="end-date"
					value="<%= workflowInstanceViewDisplayContext.getEndDate(workflowInstance) %>"
				/>

				<c:choose>
					<c:when test="<%= !workflowInstance.isComplete() %>">
						<liferay-ui:search-container-column-jsp
							path="/instance/workflow_instance_action.jsp"
						/>
					</c:when>
					<c:otherwise>
						<liferay-ui:search-container-column-text
							value="<%= StringPool.BLANK %>"
						/>
					</c:otherwise>
				</c:choose>
			</c:otherwise>
		</c:choose>
	</liferay-ui:search-container-row>

	<liferay-ui:search-iterator
		displayStyle="<%= displayStyle %>"
		markupView="lexicon"
		resultRowSplitter="<%= new WorkflowInstanceResultRowSplitter() %>"
		searchContainer="<%= workflowInstanceViewDisplayContext.getSearchContainer() %>"
	/>
</liferay-ui:search-container>