<%--
/**
 * 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">
						<liferay-ui:message key="<%= curOrganization.getType() %>" />
					</h6>
				</liferay-ui:search-container-column-text>

				<liferay-ui:search-container-column-text>
					<clay:dropdown-actions
						aria-label='<%= LanguageUtil.get(request, "show-actions") %>'
						dropdownItems="<%= organizationActionDropdownItems.getActionDropdownItems() %>"
						propsTransformer="js/OrganizationDropdownDefaultPropsTransformer"
					/>
				</liferay-ui:search-container-column-text>
			</c:when>
			<c:when test='<%= displayStyle.equals("icon") %>'>
				<liferay-ui:search-container-column-text>
					<clay:vertical-card
						propsTransformer="js/OrganizationDropdownDefaultPropsTransformer"
						verticalCard="<%= new OrganizationVerticalCard(organizationActionDropdownItems.getActionDropdownItems(), curOrganization, renderRequest, organizationUserSearchContainer.getRowChecker(), 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-text>
					<clay:dropdown-actions
						aria-label='<%= LanguageUtil.get(request, "show-actions") %>'
						dropdownItems="<%= organizationActionDropdownItems.getActionDropdownItems() %>"
						propsTransformer="js/OrganizationDropdownDefaultPropsTransformer"
					/>
				</liferay-ui:search-container-column-text>
			</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">
						<liferay-ui:message key="user" />
					</h6>

					<h6 class="text-default">
						<liferay-ui:message key="<%= userStatus %>" />
					</h6>
				</liferay-ui:search-container-column-text>

				<%
				UserActionDropdownItems userActionDropdownItems = new UserActionDropdownItems(renderRequest, renderResponse, user2);
				%>

				<liferay-ui:search-container-column-text>
					<clay:dropdown-actions
						aria-label='<%= LanguageUtil.get(request, "show-actions") %>'
						dropdownItems="<%= userActionDropdownItems.getActionDropdownItems() %>"
						propsTransformer="js/UserDropdownDefaultPropsTransformer"
					/>
				</liferay-ui:search-container-column-text>
			</c:when>
			<c:when test='<%= displayStyle.equals("icon") %>'>
				<liferay-ui:search-container-column-text>
					<clay:user-card
						propsTransformer="js/UserDropdownDefaultPropsTransformer"
						userCard="<%= new UserVerticalCard(renderRequest, renderResponse, organizationUserSearchContainer.getRowChecker(), true, user2) %>"
					/>
				</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) %>"
				/>

				<%
				UserActionDropdownItems userActionDropdownItems = new UserActionDropdownItems(renderRequest, renderResponse, user2);
				%>

				<liferay-ui:search-container-column-text>
					<clay:dropdown-actions
						aria-label='<%= LanguageUtil.get(request, "show-actions") %>'
						dropdownItems="<%= userActionDropdownItems.getActionDropdownItems() %>"
						propsTransformer="js/UserDropdownDefaultPropsTransformer"
					/>
				</liferay-ui:search-container-column-text>
			</c:otherwise>
		</c:choose>
	</c:otherwise>
</c:choose>