import React from 'react'; import { useHistory } from 'react-router-dom'; import { Button, NavbarGroup, Classes, NavbarDivider, Intent, } from '@blueprintjs/core'; import { useBillDrawerContext } from './BillDrawerProvider'; import withDialogActions from 'containers/Dialog/withDialogActions'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { Can, If, Icon, DrawerActionsBar, FormattedMessage as T, } from 'components'; import { BillAction, PaymentMadeAction, AbilitySubject, } from '../../../common/abilityOption'; import { BillMenuItem } from './utils'; import { safeCallback, compose } from 'utils'; function BillDetailActionsBar({ // #withDialogActions openDialog, // #withAlertsActions openAlert, // #withDrawerActions closeDrawer, }) { const history = useHistory(); const { billId, bill } = useBillDrawerContext(); // Handle edit bill. const onEditBill = () => { history.push(`/bills/${billId}/edit`); closeDrawer('bill-drawer'); }; // Handle convert to vendor credit. const handleConvertToVendorCredit = () => { history.push(`/vendor-credits/new?from_bill_id=${billId}`, { billId: billId, }); closeDrawer('bill-drawer'); }; // Handle delete bill. const onDeleteBill = () => { openAlert('bill-delete', { billId }); }; // Handle quick bill payment . const handleQuickBillPayment = () => { openDialog('quick-payment-made', { billId }); }; // Handle allocate landed cost button click. const handleAllocateCostClick = () => { openDialog('allocate-landed-cost', { billId }); }; return (