META-INF.resources.commerce_order.edit_shipping_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 shippingAddress = null;
CommerceOrder commerceOrder = commerceOrderContentDisplayContext.getCommerceOrder();
if ((commerceOrder != null) && Validator.isNull(cmd)) {
shippingAddress = commerceOrder.getShippingAddress();
}
%>
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-shipping-countries',
{
active: true,
companyId: '<%= company.getCompanyId() %>',
shippingAllowed: true,
},
injectCountryPlaceholder
);
},
selectDesc: 'nameCurrentValue',
selectId: 'countryId',
selectNullable: <%= false %>,
selectSort: '<%= true %>',
selectVal:
'<%= BeanParamUtil.getLong(shippingAddress, 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(shippingAddress, request, "regionId") %>',
},
]);