This commit is contained in:
a.bouhuolia
2021-02-23 10:52:40 +02:00
21 changed files with 335 additions and 239 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import DrawerTemplate from 'containers/Drawers/DrawerTemplate';
import PaperTemplate from 'containers/Drawers/PaperTemplate';
import PaperTemplate from 'containers/Drawers/PaperTemplate/PaperTemplate';
import withDrawers from 'containers/Drawer/withDrawers';
import withDrawerActions from 'containers/Drawer/withDrawerActions';

View File

@@ -9,6 +9,7 @@ import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withReceipts from './withReceipts';
import withReceiptsActions from './withReceiptsActions';
import withSettings from 'containers/Settings/withSettings';
@@ -31,6 +32,9 @@ function ReceiptsDataTable({
// #withAlertsActions
openAlert,
// #withDrawerActions
openDrawer,
}) {
const history = useHistory();
@@ -61,6 +65,11 @@ function ReceiptsDataTable({
openAlert('receipt-close', { receiptId: receipt.id });
};
// Handle drawer receipts.
const handleDrawerReceipt = () => {
openDrawer('receipt-drawer', {});
};
// Handles the datable fetch data once the state changing.
const handleDataTableFetchData = useCallback(
({ sortBy, pageIndex, pageSize }) => {
@@ -102,6 +111,7 @@ function ReceiptsDataTable({
onEdit: handleEditReceipt,
onDelete: handleDeleteReceipt,
onClose: handleCloseReceipt,
onDrawer:handleDrawerReceipt,
baseCurrency,
}}
/>
@@ -111,6 +121,7 @@ function ReceiptsDataTable({
export default compose(
withAlertsActions,
withReceiptsActions,
withDrawerActions,
withReceipts(({ receiptTableState }) => ({
receiptTableState,
})),

View File

@@ -15,7 +15,7 @@ import { Choose, Money, Icon, If } from 'components';
import moment from 'moment';
export function ActionsMenu({
payload: { onEdit, onDelete, onClose },
payload: { onEdit, onDelete, onClose ,onDrawer },
row: { original: receipt },
}) {
const { formatMessage } = useIntl();
@@ -38,6 +38,10 @@ export function ActionsMenu({
onClick={safeCallback(onClose, receipt)}
/>
</If>
<MenuItem
text={formatMessage({ id: 'receipt_paper' })}
onClick={() => onDrawer()}
/>
<MenuItem
text={formatMessage({ id: 'delete_receipt' })}
intent={Intent.DANGER}