From aa6769c011f0c654b7e4fdb2cd81f2bbb9bffad4 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Tue, 24 Aug 2021 18:47:23 +0200 Subject: [PATCH] feat: bill detail. --- .../BillDrawer/BillDetailActionsBar.js | 77 +++++++++++++++++++ .../Drawers/BillDrawer/BillDetailHeader.js | 46 +++++++++++ .../Drawers/BillDrawer/BillDetailTab.js | 14 ++++ .../Drawers/BillDrawer/BillDetailTable.js | 46 +++++++++++ .../Drawers/BillDrawer/BillDrawerDetails.js | 9 ++- .../Drawers/BillDrawer/BillDrawerProvider.js | 18 ++++- 6 files changed, 203 insertions(+), 7 deletions(-) create mode 100644 client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js create mode 100644 client/src/containers/Drawers/BillDrawer/BillDetailHeader.js create mode 100644 client/src/containers/Drawers/BillDrawer/BillDetailTab.js create mode 100644 client/src/containers/Drawers/BillDrawer/BillDetailTable.js diff --git a/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js new file mode 100644 index 000000000..e67562ccf --- /dev/null +++ b/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.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 { useBillDrawerContext } from './BillDrawerProvider'; + +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 BillDetailActionsBar({ + // #withDialogActions + openDialog, + + // #withAlertsActions + openAlert, + + // #withDrawerActions + closeDrawer, +}) { + const history = useHistory(); + + const { billId } = useBillDrawerContext(); + + // Handle edit bill. + const onEditBill = () => { + return billId + ? (history.push(`/bills/${billId}/edit`), closeDrawer('bill-drawer')) + : null; + }; + + // Handle delete bill. + const onDeleteBill = () => { + return billId + ? (openAlert('bill-delete', { billId }), closeDrawer('bill-drawer')) + : null; + }; + + return ( + + +