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

META-INF.resources.js.DiagramTable.MappedProductRow.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 ClayButton, {ClayButtonWithIcon} from '@clayui/button';
import {ClayCheckbox} from '@clayui/form';
import ClayTable from '@clayui/table';
import {QuantitySelectorComponent} from 'commerce-frontend-js';
import {sub} from 'frontend-js-web';
import React from 'react';

import Price from '../components/Price';
import {formatLabel} from '../utilities/index';

export default function MappedProductRow({
	handleMouseEnter,
	handleMouseLeave,
	handleTitleClicked,
	isAdmin,
	onDelete,
	product,
	quantity,
	setMappedProducts,
	setNewQuantity,
}) {
	function updateSelected(selected) {
		setMappedProducts((mappedProducts) =>
			mappedProducts.map((mappedProduct) =>
				mappedProduct.skuId === product.skuId
					? {
							...mappedProduct,
							selected,
						}
					: mappedProduct
			)
		);
	}

	return (
		 handleMouseEnter(product)}
			onMouseLeave={() => handleMouseLeave(product)}
		>
			{!isAdmin && (
				
					 {
							updateSelected(event.target.checked);
						}}
					/>
				
			)}

			{formatLabel(product.sequence)}

			
				
handleTitleClicked(product)} > {product.type === 'diagram' ? product.productName[ Liferay.ThemeDisplay.getLanguageId() ] : product.sku} {product.type === 'sku' && (

{ product.productName[ Liferay.ThemeDisplay.getLanguageId() ] }

)}
{isAdmin && product.type !== 'diagram' && product.quantity} {!isAdmin && product.productConfiguration && product.type === 'sku' && ( { setNewQuantity(value); if (errors.length) { updateSelected(false); } }} quantity={quantity} size="sm" step={ product.productConfiguration .multipleOrderQuantity } /> )} {!isAdmin && product.type === 'external' && product.quantity} {isAdmin ? ( onDelete(product.id)} small symbol="trash" /> ) : ( {product.price && } )}
); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy