<%--
/**
 * 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="/management_bar_sort/init.jsp" %>

<%
boolean disabled = GetterUtil.getBoolean(request.getAttribute("liferay-frontend:management-bar-sort:disabled"));
String orderByCol = (String)request.getAttribute("liferay-frontend:management-bar-sort:orderByCol");
String orderByType = (String)request.getAttribute("liferay-frontend:management-bar-sort:orderByType");
PortletURL portletURL = (PortletURL)request.getAttribute("liferay-frontend:management-bar-sort:portletURL");
%>

<liferay-frontend:management-bar-filter
	disabled="<%= disabled %>"
	label="order-by"
	managementBarFilterItems='<%= (List<ManagementBarFilterItem>)request.getAttribute("liferay-frontend:management-bar-sort:managementBarFilterItems") %>'
	value='<%= (String)request.getAttribute("liferay-frontend:management-bar-sort:orderByColLabel") %>'
/>

<%
PortletURL orderByColAscURL = PortletURLUtil.clone(portletURL, liferayPortletResponse);

orderByColAscURL.setParameter("orderByCol", orderByCol);
orderByColAscURL.setParameter("orderByType", "asc");
%>

<li>
	<liferay-frontend:management-bar-button
		active='<%= Validator.isNotNull(orderByType) && orderByType.equals("asc") %>'
		cssClass="d-none d-sm-block"
		disabled="<%= disabled %>"
		href="<%= orderByColAscURL.toString() %>"
		icon="caret-top"
		label="ascending"
	/>
</li>

<%
PortletURL orderByColDescURL = PortletURLUtil.clone(portletURL, liferayPortletResponse);

orderByColDescURL.setParameter("orderByCol", orderByCol);
orderByColDescURL.setParameter("orderByType", "desc");
%>

<li>
	<liferay-frontend:management-bar-button
		active='<%= Validator.isNotNull(orderByType) && orderByType.equals("desc") %>'
		cssClass="d-none d-sm-block"
		disabled="<%= disabled %>"
		href="<%= orderByColDescURL.toString() %>"
		icon="caret-bottom"
		label="descending"
	/>
</li>