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

<c:choose>
	<c:when test="<%= Validator.isNotNull(curOrganization) %>">
		<liferay-portlet:renderURL varImpl="rowURL">
			<portlet:param name="mvcRenderCommandName" value="/users_admin/view" />
			<portlet:param name="toolbarItem" value="<%= toolbarItem %>" />
			<portlet:param name="usersListView" value="<%= UserConstants.LIST_VIEW_TREE %>" />
			<portlet:param name="organizationId" value="<%= String.valueOf(curOrganization.getOrganizationId()) %>" />
		</liferay-portlet:renderURL>

		<%
		if (!OrganizationPermissionUtil.contains(permissionChecker, curOrganization, ActionKeys.VIEW)) {
			rowURL = null;
		}

		row.setPrimaryKey(HtmlUtil.escape(String.valueOf(curOrganization.getOrganizationId())));
		%>

		<c:choose>
			<c:when test='<%= displayStyle.equals("descriptive") %>'>
				<liferay-ui:search-container-column-icon
					icon="organizations"
					toggleRowChecker="<%= true %>"
				/>

				<liferay-ui:search-container-column-text
					colspan="<%= 2 %>"
				>
					<h5>
						<aui:a href="<%= String.valueOf(rowURL) %>"><%= HtmlUtil.escape(curOrganization.getName()) %></aui:a>
					</h5>

					<h6 class="text-default">
						<%= LanguageUtil.get(request, curOrganization.getType()) %>
					</h6>
				</liferay-ui:search-container-column-text>

				<liferay-ui:search-container-column-jsp
					cssClass="entry-action-column"
					path="/organization_action.jsp"
				/>
			</c:when>
			<c:when test='<%= displayStyle.equals("icon") %>'>

				<%
				row.setCssClass("entry-card lfr-asset-item");
				%>

				<liferay-ui:search-container-column-text>
					<liferay-frontend:icon-vertical-card
						actionJsp="/organization_action.jsp"
						actionJspServletContext="<%= application %>"
						cssClass="entry-display-style"
						icon="organizations"
						resultRow="<%= row %>"
						rowChecker="<%= organizationUserSearchContainer.getRowChecker() %>"
						subtitle="<%= LanguageUtil.get(request, curOrganization.getType()) %>"
						title="<%= curOrganization.getName() %>"
						url="<%= String.valueOf(rowURL) %>"
					/>
				</liferay-ui:search-container-column-text>
			</c:when>
			<c:otherwise>
				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand table-cell-minw-200 table-title"
					href="<%= rowURL %>"
					name="name"
					value="<%= HtmlUtil.escape(curOrganization.getName()) %>"
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand table-cell-minw-100 table-cell-ws-nowrap"
					href="<%= rowURL %>"
					name="type"
					value="<%= LanguageUtil.get(request, curOrganization.getType()) %>"
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand-smaller table-cell-minw-100 table-cell-ws-nowrap"
					href="<%= rowURL %>"
					name="status"
					value=""
				/>

				<liferay-ui:search-container-column-jsp
					path="/organization_action.jsp"
				/>
			</c:otherwise>
		</c:choose>
	</c:when>
	<c:otherwise>
		<liferay-portlet:renderURL varImpl="rowURL">
			<portlet:param name="p_u_i_d" value="<%= String.valueOf(user2.getUserId()) %>" />
			<portlet:param name="mvcRenderCommandName" value="/users_admin/edit_user" />
			<portlet:param name="backURL" value="<%= currentURL %>" />
		</liferay-portlet:renderURL>

		<%
		if (!UserPermissionUtil.contains(permissionChecker, user2.getUserId(), ActionKeys.UPDATE)) {
			rowURL = null;
		}

		row.setPrimaryKey(HtmlUtil.escape(String.valueOf(user2.getUserId())));

		String userStatus = (user2.getStatus() == WorkflowConstants.STATUS_APPROVED) ? "active" : "inactive";
		%>

		<c:choose>
			<c:when test='<%= displayStyle.equals("descriptive") %>'>
				<liferay-ui:search-container-column-text>
					<liferay-ui:user-portrait
						userId="<%= user2.getUserId() %>"
					/>
				</liferay-ui:search-container-column-text>

				<liferay-ui:search-container-column-text
					colspan="<%= 2 %>"
				>
					<h5>
						<aui:a href="<%= String.valueOf(rowURL) %>"><%= HtmlUtil.escape(user2.getFullName()) %></aui:a>
					</h5>

					<h6 class="text-default">
						<%= LanguageUtil.get(request, "user") %>
					</h6>

					<h6 class="text-default">
						<%= LanguageUtil.get(request, userStatus) %>
					</h6>
				</liferay-ui:search-container-column-text>

				<liferay-ui:search-container-column-jsp
					cssClass="entry-action-column"
					path="/user_action.jsp"
				/>
			</c:when>
			<c:when test='<%= displayStyle.equals("icon") %>'>

				<%
				row.setCssClass("entry-card lfr-asset-item");
				%>

				<liferay-ui:search-container-column-text>
					<liferay-frontend:user-vertical-card
						actionJsp="/user_action.jsp"
						actionJspServletContext="<%= application %>"
						cssClass="entry-display-style"
						resultRow="<%= row %>"
						rowChecker="<%= organizationUserSearchContainer.getRowChecker() %>"
						subtitle='<%= LanguageUtil.get(request, "user") %>'
						title="<%= user2.getFullName() %>"
						url="<%= String.valueOf(rowURL) %>"
						userId="<%= user2.getUserId() %>"
					/>
				</liferay-ui:search-container-column-text>
			</c:when>
			<c:otherwise>
				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand table-cell-minw-200 table-title"
					href="<%= rowURL %>"
					name="name"
					orderable="<%= true %>"
					value="<%= HtmlUtil.escape(user2.getFullName()) %>"
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand table-cell-minw-100 table-cell-ws-nowrap"
					href="<%= rowURL %>"
					name="type"
					value='<%= LanguageUtil.get(request, "user") %>'
				/>

				<liferay-ui:search-container-column-text
					cssClass="table-cell-expand-smaller table-cell-minw-100 table-cell-ws-nowrap"
					href="<%= rowURL %>"
					name="status"
					value="<%= LanguageUtil.get(request, userStatus) %>"
				/>

				<liferay-ui:search-container-column-jsp
					cssClass="entry-action-column"
					path="/user_action.jsp"
				/>
			</c:otherwise>
		</c:choose>
	</c:otherwise>
</c:choose>