META-INF.resources.commerce_order.edit_billing_address.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.order.content.web
Show all versions of com.liferay.commerce.order.content.web
Liferay Commerce Order Content Web
<%--
/**
* 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" %>
<%
String cmd = ParamUtil.getString(request, Constants.CMD);
CommerceAddress billingAddress = null;
CommerceOrder commerceOrder = commerceOrderContentDisplayContext.getCommerceOrder();
if ((commerceOrder != null) && Validator.isNull(cmd)) {
billingAddress = commerceOrder.getBillingAddress();
}
%>
new Liferay.DynamicSelect([
{
select: ' countryId',
selectData: function (callback) {
function injectCountryPlaceholder(list) {
var callbackList = [
{
countryId: '0',
nameCurrentValue:
'- ',
},
];
list.forEach((listElement) => {
callbackList.push(listElement);
});
callback(callbackList);
}
Liferay.Service(
'/commerce.commercecountrymanagerimpl/get-billing-countries',
{
active: true,
billingAllowed: true,
companyId: '<%= company.getCompanyId() %>',
},
injectCountryPlaceholder
);
},
selectDesc: 'nameCurrentValue',
selectId: 'countryId',
selectNullable: <%= false %>,
selectSort: '<%= true %>',
selectVal:
'<%= BeanParamUtil.getLong(billingAddress, request, "countryId") %>',
},
{
select: ' regionId',
selectData: function (callback, selectKey) {
function injectRegionPlaceholder(list) {
var callbackList = [
{
regionId: '0',
name: '- ',
nameCurrentValue:
'- ',
},
];
list.forEach((listElement) => {
callbackList.push(listElement);
});
callback(callbackList);
}
Liferay.Service(
'/region/get-regions',
{
active: true,
countryId: Number(selectKey),
},
injectRegionPlaceholder
);
},
selectDesc: 'name',
selectId: 'regionId',
selectNullable: <%= false %>,
selectVal:
'<%= BeanParamUtil.getLong(billingAddress, request, "regionId") %>',
},
]);