fix: sell_price & cost_price in itemsDateTable.

This commit is contained in:
elforjani3
2020-11-29 18:02:00 +02:00
parent 24b965e0ae
commit c1865c42d1

View File

@@ -19,7 +19,7 @@ import { CLASSES } from 'common/classes';
import withItems from 'containers/Items/withItems'; import withItems from 'containers/Items/withItems';
import withItemsActions from 'containers/Items/withItemsActions'; import withItemsActions from 'containers/Items/withItemsActions';
import { compose, saveInvoke } from 'utils'; import { compose, saveInvoke, isBlank, defaultToTransform } from 'utils';
// Items datatable. // Items datatable.
function ItemsDataTable({ function ItemsDataTable({
@@ -122,7 +122,9 @@ function ItemsDataTable({
<Tag minimal={true} round={true} intent={Intent.NONE}> <Tag minimal={true} round={true} intent={Intent.NONE}>
{formatMessage({ id: row.type })} {formatMessage({ id: row.type })}
</Tag> </Tag>
) : (''), ) : (
''
),
className: 'item_type', className: 'item_type',
width: 120, width: 120,
}, },
@@ -134,13 +136,23 @@ function ItemsDataTable({
}, },
{ {
Header: formatMessage({ id: 'sell_price' }), Header: formatMessage({ id: 'sell_price' }),
accessor: (row) => <Money amount={row.sell_price} currency={'USD'} />, accessor: (row) =>
!isBlank(row.sell_price) ? (
<Money amount={row.sell_price} currency={'USD'} />
) : (
''
),
className: 'sell-price', className: 'sell-price',
width: 150, width: 150,
}, },
{ {
Header: formatMessage({ id: 'cost_price' }), Header: formatMessage({ id: 'cost_price' }),
accessor: (row) => <Money amount={row.cost_price} currency={'USD'} />, accessor: (row) =>
!isBlank(row.sell_price) ? (
<Money amount={row.cost_price} currency={'USD'} />
) : (
''
),
className: 'cost-price', className: 'cost-price',
width: 150, width: 150,
}, },
@@ -230,13 +242,13 @@ export default compose(
itemsTableLoading, itemsTableLoading,
itemsTableQuery, itemsTableQuery,
itemsCurrentViewId, itemsCurrentViewId,
itemsPagination itemsPagination,
}) => ({ }) => ({
itemsCurrentPage, itemsCurrentPage,
itemsTableLoading, itemsTableLoading,
itemsTableQuery, itemsTableQuery,
itemsCurrentViewId, itemsCurrentViewId,
itemsPagination itemsPagination,
}), }),
), ),
withItemsActions, withItemsActions,