import React from 'react'; import { Menu, MenuDivider, MenuItem, Intent, Tag, Position, Button, Popover, } from '@blueprintjs/core'; import intl from 'react-intl-universal'; import moment from 'moment'; import { FormattedMessage as T } from 'components'; import { isNumber } from 'lodash'; import { Icon, Money, If } from 'components'; import { isBlank, safeCallback } from 'utils'; /** * Publish accessor */ export const PublishAccessor = (r) => { return r.is_published ? ( ) : ( ); }; /** * Type column accessor. */ export const TypeAccessor = (row) => { return row.type ? ( {intl.get(row.type)} ) : ( '' ); }; /** * Item type accessor. */ export const ItemCodeAccessor = (row) => row.type ? ( {intl.get(row.type)} ) : ( '' ); /** * Quantity on hand cell. */ export const QuantityOnHandCell = ({ cell: { value } }) => { return isNumber(value) ? ( {value} ) : null; }; /** * Cost price cell. */ export const CostPriceCell = ({ cell: { value } }) => { return !isBlank(value) ? : null; }; /** * Sell price cell. */ export const SellPriceCell = ({ cell: { value } }) => { return !isBlank(value) ? : null; }; /** * Item type accessor. */ export const ItemTypeAccessor = (row) => { return row.type ? ( {intl.get(row.type)} ) : null; }; export const ActionsMenu = ({ row: { original }, payload: { onDelete, onPublish, onViewDetails }, }) => { return ( } text={intl.get('view_details')} onClick={safeCallback(onViewDetails, original)} /> } text={intl.get('publish_adjustment')} onClick={safeCallback(onPublish, original)} /> } /> ); }; export const ActionsCell = (props) => { return ( } position={Position.RIGHT_BOTTOM} >