import React, { useCallback, useMemo } from 'react'; import { Button, Popover, Menu, Intent, MenuItem, MenuDivider, Position, } from '@blueprintjs/core'; import { FormattedMessage as T, useIntl } from 'react-intl'; import moment from 'moment'; import classNames from 'classnames'; import { DataTable, If, Money, Choose, Icon, LoadingIndicator, } from 'components'; import { CLASSES } from 'common/classes'; import { useIsValuePassed } from 'hooks'; import withDialogActions from 'containers/Dialog/withDialogActions'; // withInventoryAdjustments // withInventoryAdjustmentsActions import { compose, saveInvoke } from 'utils'; import { withRouter } from 'react-router-dom'; function InventoryAdjustmentDataTable({ // #ownProps onDeleteInventoryAdjustment, onSelectedRowsChange, }) { const { formatMessage } = useIntl(); const handleDeleteInventoryAdjustment = useCallback( (_inventory) => { saveInvoke(onDeleteInventoryAdjustment, _inventory); }, [onDeleteInventoryAdjustment], ); const actionMenuList = useCallback( (adjustment) => (
), [handleDeleteInventoryAdjustment, formatMessage], ); const onRowContextMenu = useCallback( (cell) => actionMenuList(cell.row.original), [actionMenuList], ); const columns = useMemo( () => [ { id: 'date', Header: formatMessage({ id: 'date' }), accessor: (r) => moment(r.date).format('YYYY MMM DD'), width: 115, className: 'date', }, { id: 'type', Header: formatMessage({ id: 'type' }), accessor: 'type', className: 'type', width: 100, }, { id: 'reason', Header: formatMessage({ id: 'reason' }), // accessor: (r) => ( //