META-INF.resources.edit_cp_attachment_file_entry.jspf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.product.definitions.web
Show all versions of com.liferay.commerce.product.definitions.web
Liferay Commerce Product Definitions 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="/attachment_file_entry/image_selector.jspf" %>
<%@ include file="/attachment_file_entry/details.jspf" %>
<%@ include file="/attachment_file_entry/options.jspf" %>
<%@ include file="/attachment_file_entry/schedule.jspf" %>
<%@ include file="/attachment_file_entry/custom_fields.jspf" %>
<%
boolean pending = false;
if (cpAttachmentFileEntry != null) {
pending = cpAttachmentFileEntry.isPending();
}
%>
<%
String saveButtonLabel = "save";
if ((cpAttachmentFileEntry == null) || cpAttachmentFileEntry.isDraft() || cpAttachmentFileEntry.isApproved() || cpAttachmentFileEntry.isExpired() || cpAttachmentFileEntry.isScheduled()) {
saveButtonLabel = "save-as-draft";
}
String publishButtonLabel = "publish";
if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(themeDisplay.getCompanyId(), scopeGroupId, CPAttachmentFileEntry.class.getName())) {
publishButtonLabel = "submit-for-workflow";
}
%>
Liferay.provide(window, ' saveAttachmentFileEntry', () => {
var form = window.document[' fm'];
var optionsContainer = window.document.getElementById(
' optionsContainer'
);
if (!optionsContainer) {
return submitForm(form);
}
var skuContributorInputs = optionsContainer.querySelectorAll(
'[data-sku-contributor=true]'
);
form[' cpInstanceOptions'].value = JSON.stringify(
Array.from(skuContributorInputs).map((skuContributorInput) => {
var name =
skuContributorInput.name ||
skuContributorInput.querySelector('input:checked').name;
var value = skuContributorInput.value
? skuContributorInput.value.split('[$SEPARATOR$]')[1]
: skuContributorInput
.querySelector('input:checked')
.value.split('[$SEPARATOR$]')[1];
return {key: name, value: [value]};
})
);
submitForm(form);
});
var publishButton = A.one('# publishButton');
publishButton.on('click', () => {
var workflowActionInput = A.one('# workflowAction');
if (workflowActionInput) {
workflowActionInput.val('<%= WorkflowConstants.ACTION_PUBLISH %>');
}
});