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 { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider'; import { VendorCreditMenuItem } from './utils'; import { VendorCreditAction, AbilitySubject, } from '../../../common/abilityOption'; import withDialogActions from 'containers/Dialog/withDialogActions'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { If, Icon, FormattedMessage as T, Can } from 'components'; import { compose } from 'utils'; /** * Vendor credit detail actions bar. */ function VendorCreditDetailActionsBar({ // #withDialogActions openDialog, // #withAlertsActions openAlert, // #withDrawerActions closeDrawer, }) { const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext(); const history = useHistory(); // Handle edit credit note. const handleEditVendorCredit = () => { history.push(`/vendor-credits/${vendorCreditId}/edit`); closeDrawer('vendor-credit-detail-drawer'); }; // Handle delete credit note. const handleDeleteVendorCredit = () => { openAlert('vendor-credit-delete', { vendorCreditId }); }; const handleRefundVendorCredit = () => { openDialog('refund-vendor-credit', { vendorCreditId }); }; const handleReconcileVendorCredit = () => { openDialog('reconcile-vendor-credit', { vendorCreditId }); }; return (