import React from 'react'; import { Menu, MenuDivider, MenuItem, Intent, Tag, Position, Button, Popover, } from '@blueprintjs/core'; import intl from 'react-intl-universal'; import { isNumber } from 'lodash'; import { FormattedMessage as T, Icon, Money, If, Can } from 'components'; import { isBlank, safeCallback } from 'utils'; import { AbilitySubject, Item_Abilities, Inventory_Adjustment_Abilities, } from '../../common/abilityOption'; /** * Publish accessor */ export const PublishAccessor = (r) => { return r.is_published ? ( ) : ( ); }; export const TypeAccessor = (row) => { return row.type ? ( {intl.get(row.type)} ) : ( '' ); }; export const ItemCodeAccessor = (row) => row.type ? ( {intl.get(row.type)} ) : ( '' ); export const QuantityOnHandCell = ({ cell: { value } }) => { return isNumber(value) ? ( {value} ) : null; }; export const CostPriceCell = ({ cell: { value } }) => { return !isBlank(value) ? : null; }; export const SellPriceCell = ({ cell: { value } }) => { return !isBlank(value) ? : null; }; export const ItemTypeAccessor = (row) => { return row.type ? ( {intl.get(row.type)} ) : null; }; export function ItemsActionMenuList({ row: { original }, payload: { onEditItem, onInactivateItem, onActivateItem, onMakeAdjustment, onDeleteItem, onDuplicate, onViewDetails, }, }) { return ( } text={} onClick={safeCallback(onViewDetails, original)} /> } text={intl.get('edit_item')} onClick={safeCallback(onEditItem, original)} /> } text={intl.get('duplicate')} onClick={safeCallback(onDuplicate, original)} /> } onClick={safeCallback(onInactivateItem, original)} /> } onClick={safeCallback(onActivateItem, original)} /> } onClick={safeCallback(onMakeAdjustment, original)} /> } onClick={safeCallback(onDeleteItem, original)} intent={Intent.DANGER} /> ); } export const ItemsActionsTableCell = (props) => { return ( } >