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 PaymentPaperTemplate from 'containers/Drawers/PaymentPaperTemplate';
import PaymentPaperTemplate from 'containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate';
import withDrawers from 'containers/Drawer/withDrawers';
import withDrawerActions from 'containers/Drawer/withDrawerActions';

View File

@@ -11,6 +11,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
import withPaymentReceives from './withPaymentReceives';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withSettings from 'containers/Settings/withSettings';
import { usePaymentReceivesColumns, ActionsMenu } from './components';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
@@ -27,6 +28,9 @@ function PaymentReceivesDataTable({
// #withAlertsActions
openAlert,
// #withDrawerActions
openDrawer,
}) {
const history = useHistory();
@@ -53,6 +57,11 @@ function PaymentReceivesDataTable({
openAlert('payment-receive-delete', { paymentReceiveId: id });
};
// Handle drawer payment receive.
const handleDrawerPaymentReceive = () => {
openDrawer('payment-receive-drawer', {});
};
// Handle datatable fetch once the table's state changing.
const handleDataTableFetchData = useCallback(
({ pageIndex, pageSize, sortBy }) => {
@@ -93,6 +102,7 @@ function PaymentReceivesDataTable({
payload={{
onDelete: handleDeletePaymentReceive,
onEdit: handleEditPaymentReceive,
onDrawer: handleDrawerPaymentReceive,
}}
/>
);
@@ -101,6 +111,7 @@ function PaymentReceivesDataTable({
export default compose(
withPaymentReceivesActions,
withAlertsActions,
withDrawerActions,
withPaymentReceives(({ paymentReceivesTableState }) => ({
paymentReceivesTableState,
})),

View File

@@ -18,7 +18,7 @@ import { safeCallback } from 'utils';
*/
export function ActionsMenu({
row: { original: paymentReceive },
payload: { onEdit, onDelete },
payload: { onEdit, onDelete, onDrawer },
}) {
const { formatMessage } = useIntl();
@@ -34,6 +34,10 @@ export function ActionsMenu({
text={formatMessage({ id: 'edit_payment_receive' })}
onClick={safeCallback(onEdit, paymentReceive)}
/>
<MenuItem
text={formatMessage({ id: 'payment_receive_paper' })}
onClick={() => onDrawer()}
/>
<MenuItem
text={formatMessage({ id: 'delete_payment_receive' })}
intent={Intent.DANGER}