All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.components.ObjectRelationship.ModalDeleteObjectRelationship.tsx Maven / Gradle / Ivy

The newest version!
/**
 * SPDX-FileCopyrightText: (c) 2023 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import {ClayModalProvider, useModal} from '@clayui/modal';
import {sub} from 'frontend-js-web';
import React from 'react';

import DangerModal from '../DangerModal';
import {deleteRelationship} from '../ViewObjectDefinitions/objectDefinitionUtil';
import WarningModal from '../WarningModal';

interface ModalDeleteObjectRelationshipProps {
	handleOnClose: () => void;
	objectRelationship: ObjectRelationship;
	onAfterSubmit?: () => void;
	reload?: boolean;
	setObjectRelationship?: (value: ObjectRelationship | null) => void;
}

export function ModalDeleteObjectRelationship({
	handleOnClose,
	objectRelationship,
	onAfterSubmit,
	reload = true,
	setObjectRelationship,
}: ModalDeleteObjectRelationshipProps) {
	const {observer, onClose} = useModal({
		onClose: () => {
			if (setObjectRelationship) {
				setObjectRelationship(null);
			}
			handleOnClose();
		},
	});

	return (
		
			{objectRelationship.reverse ? (
				
					
{Liferay.Language.get( 'you-do-not-have-permission-to-delete-this-relationship' )}
{Liferay.Language.get( 'you-cannot-delete-a-relationship-from-here' )}
) : ( { deleteRelationship(objectRelationship.id); onClose(); if (reload) { setTimeout(() => window.location.reload(), 1500); } if (onAfterSubmit) { setTimeout(() => onAfterSubmit(), 200); } }} placeholder={Liferay.Language.get( 'confirm-relationship-name' )} title={Liferay.Language.get('delete-relationship')} token={objectRelationship.name} >

{Liferay.Language.get( 'this-action-cannot-be-undone-and-will-permanently-delete-all-related-fields-from-this-relationship' )}

{Liferay.Language.get('it-may-affect-many-records')}

${objectRelationship.name}` ), }} /> )} ); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy