feat: content & item detail.

This commit is contained in:
elforjani3
2021-08-23 19:31:02 +02:00
parent f5fd2aa324
commit 1150cb48da
25 changed files with 535 additions and 36 deletions

View File

@@ -12,6 +12,7 @@ import withItems from 'containers/Items/withItems';
import withItemsActions from 'containers/Items/withItemsActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useItemsListContext } from './ItemsListProvider';
import { useItemsTableColumns, ItemsActionMenuList } from './components';
@@ -30,6 +31,9 @@ function ItemsDataTable({
// #withAlertsActions
openAlert,
// #withDrawerActions
openDrawer,
// #withItems
itemsTableState,
@@ -93,6 +97,11 @@ function ItemsDataTable({
history.push(`/items/new?duplicate=${id}`, { action: id });
};
// Handle view detail item.
const handleViewDetailItem = ({ id }) => {
openDrawer('item-detail-drawer', { itemId: id });
};
// Cannot continue in case the items has empty status.
if (isEmptyStatus) {
return <ItemsEmptyStatus />;
@@ -129,6 +138,7 @@ function ItemsDataTable({
onActivateItem: handleActivateItem,
onMakeAdjustment: handleMakeAdjustment,
onDuplicate: handleDuplicate,
onViewDetails: handleViewDetailItem,
}}
noResults={<T id={'there_is_no_items_in_the_table_yet'} />}
{...tableProps}
@@ -139,6 +149,7 @@ function ItemsDataTable({
export default compose(
withItemsActions,
withAlertsActions,
withDrawerActions,
withDialogActions,
withItems(({ itemsTableState }) => ({ itemsTableState })),
)(ItemsDataTable);

View File

@@ -10,7 +10,7 @@ import {
Popover,
} from '@blueprintjs/core';
import intl from 'react-intl-universal';
import { FormattedMessage as T } from 'components';
import { FormattedMessage as T } from 'components';
import { isNumber } from 'lodash';
import { Icon, Money, If } from 'components';
import { isBlank, safeCallback } from 'utils';
@@ -80,14 +80,15 @@ export function ItemsActionMenuList({
onMakeAdjustment,
onDeleteItem,
onDuplicate,
onViewDetails,
},
}) {
return (
<Menu>
<MenuItem
icon={<Icon icon="reader-18" />}
text={<T id={'view_details'} />}
onClick={safeCallback(onViewDetails, original)}
/>
<MenuDivider />
<MenuItem