META-INF.resources.commerce_discounts.details.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.pricing.web
Show all versions of com.liferay.commerce.pricing.web
Liferay Commerce Pricing Web
The newest version!
<%--
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
--%>
<%@ include file="/init.jsp" %>
<%
CommerceDiscountDisplayContext commerceDiscountDisplayContext = (CommerceDiscountDisplayContext)request.getAttribute(WebKeys.PORTLET_DISPLAY_CONTEXT);
CommerceDiscount commerceDiscount = commerceDiscountDisplayContext.getCommerceDiscount();
long commerceDiscountId = commerceDiscountDisplayContext.getCommerceDiscountId();
boolean neverExpire = ParamUtil.getBoolean(request, "neverExpire", true);
if ((commerceDiscount != null) && (commerceDiscount.getExpirationDate() != null)) {
neverExpire = false;
}
boolean usePercentage = ParamUtil.getBoolean(request, "usePercentage");
String target = ParamUtil.getString(request, "target");
if (Validator.isBlank(target)) {
target = commerceDiscount.getTarget();
}
String colCssClass = "col-12 col-md-6";
String amountSuffix = HtmlUtil.escape(commerceDiscountDisplayContext.getDefaultCommerceCurrencyCode());
if (usePercentage) {
colCssClass = "col-12 col-md-4";
amountSuffix = StringPool.PERCENT;
}
boolean hasPermission = commerceDiscountDisplayContext.hasPermission(ActionKeys.UPDATE);
%>
<%
for (String commerceDiscountType : CommerceDiscountConstants.TYPES) {
%>
<%
}
%>
<%
for (CommerceDiscountTarget commerceDiscountTarget : commerceDiscountDisplayContext.getCommerceDiscountTargets()) {
%>
<%
}
%>
<%= CommercePriceConstants.PRICE_VALUE_MIN %>
<%= CommercePriceConstants.PRICE_VALUE_MAX %>
<%= CommercePriceConstants.PRICE_VALUE_MIN %>
<%= CommercePriceConstants.PRICE_VALUE_MAX %>
<%
for (String commerceDiscountLevel : CommerceDiscountConstants.LEVELS) {
%>
<%
}
%>
<%@ include file="/commerce_discounts/coupon_code.jspf" %>
<%@ include file="/commerce_discounts/target/products.jspf" %>
<%@ include file="/commerce_discounts/target/skus.jspf" %>
<%@ include file="/commerce_discounts/target/categories.jspf" %>
<%@ include file="/commerce_discounts/target/pricing_classes.jspf" %>
<%@ include file="/commerce_discounts/rules.jspf" %>
Liferay.provide(window, ' selectType', () => {
const portletURL = Liferay.Util.PortletURL.createPortletURL(
'<%= currentURLObj %>',
{
usePercentage: document.getElementById(
' usePercentage'
).value,
}
);
window.location.replace(portletURL.toString());
});
Liferay.provide(window, ' selectTarget', () => {
const portletURL = Liferay.Util.PortletURL.createPortletURL(
'<%= currentURLObj %>',
{
target: document.getElementById(' target')
.value,
}
);
window.location.replace(portletURL.toString());
});