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

META-INF.resources.js.components.Form.js Maven / Gradle / Ivy

There is a newer version: 1.0.97
Show 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
 */

import ClayForm, {ClayInput} from '@clayui/form';
import {AutocompleteComponent} from 'commerce-frontend-js';
import React from 'react';

export function LinkedToCatalogProductFormGroup({updateValue, value}) {
	const initialValue = value ? {...value} : null;

	if (initialValue && initialValue.skuId) {
		initialValue.productId = initialValue.skuId;
	}

	return (
		
			

			 {
					if (
						(!productId && initialValue) ||
						(!initialValue && productId) ||
						(initialValue && productId !== initialValue.productId)
					) {
						updateValue(skuProduct);
					}
				}}
				pageSize={10}
			/>
		
	);
}

export function LinkedToDiagramFormGroup({updateValue, value}) {
	const initialValue = value ? {...value} : null;

	if (initialValue && !initialValue.name) {
		initialValue.name = initialValue.productName;
	}

	return (
		
			

			 {
					if (
						(!productId && initialValue) ||
						(!initialValue && productId) ||
						(initialValue && productId !== initialValue.productId)
					) {
						updateValue(product);
					}
				}}
				pageSize={10}
			/>
		
	);
}

export function LinkedToExternalProductFormGroup({updateValue, value}) {
	return (
		
			

			 updateValue({sku: event.target.value})}
				value={value?.sku || ''}
			/>
		
	);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy