From 5eedca7677c0ca19079a1d63a5e487b0570808dc Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Tue, 24 Aug 2021 23:06:16 +0200 Subject: [PATCH 1/2] feat: payment receive detail --- .../PaymentReceiveActionsBar.js | 77 +++++++++++++++++++ .../PaymentReceiveDetail.js | 7 +- .../PaymentReceiveDetailFooter.js | 24 ++++++ .../PaymentReceiveDetailHeader.js | 57 ++++++++++++++ .../PaymentReceiveDetailProvider.js | 11 ++- .../PaymentReceiveDetailTab.js | 23 ++++++ .../PaymentReceiveDetailTable.js | 18 +++++ .../PaymentReceiveDetailDrawer/index.js | 10 ++- .../PaymentReceiveDetailDrawer/utils.js | 35 +++++++++ 9 files changed, 257 insertions(+), 5 deletions(-) create mode 100644 client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js create mode 100644 client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailFooter.js create mode 100644 client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailHeader.js create mode 100644 client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailTab.js create mode 100644 client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailTable.js create mode 100644 client/src/containers/Drawers/PaymentReceiveDetailDrawer/utils.js diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js new file mode 100644 index 000000000..948d082c0 --- /dev/null +++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js @@ -0,0 +1,77 @@ +import React from 'react'; +import { useHistory } from 'react-router-dom'; + +import { + Button, + NavbarGroup, + Classes, + NavbarDivider, + Intent, +} from '@blueprintjs/core'; +import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; + +import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider'; + +import withDialogActions from 'containers/Dialog/withDialogActions'; +import withAlertsActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; + +import { Icon, FormattedMessage as T } from 'components'; + +import { safeCallback, compose } from 'utils'; + +function PaymentReceiveActionsBar({ + // #withAlertsActions + openAlert, + + // #withDrawerActions + closeDrawer, +}) { + const history = useHistory(); + + const { paymentReceiveId } = usePaymentReceiveDetailContext(); + + + // Handle edit payment receive. + const onEditPaymentReceive = () => { + return paymentReceiveId + ? (history.push(`/payment-receives/${paymentReceiveId}/edit`), + closeDrawer('payment-receive-detail-drawer')) + : null; + }; + + // Handle delete payment receive. + const onDeletePaymentReceive = () => { + return paymentReceiveId + ? (openAlert('payment-receive-delete', { paymentReceiveId }), + closeDrawer('payment-receive-detail-drawer')) + : null; + }; + + return ( + + +