import React from 'react'; import { useHistory } from 'react-router-dom'; import { Button, NavbarGroup, Classes, NavbarDivider, Intent, PopoverInteractionKind, Position, MenuItem, Menu, Popover, } from '@blueprintjs/core'; import clsx from 'classnames'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import { useVendorDetailsDrawerContext } from './VendorDetailsDrawerProvider'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { Icon, FormattedMessage as T } from 'components'; import { safeCallback, compose } from 'utils'; /** * Vendor details actions bar. */ function VendorDetailsActionsBar({ // #withAlertsActions openAlert, // #withDrawerActions closeDrawer, }) { const { vendor, vendorId } = useVendorDetailsDrawerContext(); const history = useHistory(); // Handle edit vendor. const onEditContact = () => { history.push(`/vendors/${vendorId}/edit`); closeDrawer('vendor-details-drawer'); }; // Handle delete vendor. const onDeleteContact = () => { openAlert(`'vendor-delete`, { vendorId }); closeDrawer('vendor-details-drawer'); }; const handleNewInvoiceClick = () => { history.push('bills/new'); closeDrawer('vendor-details-drawer'); }; const handleNewPaymentClick = () => { history.push('payment-mades/new'); closeDrawer('vendor-details-drawer'); }; return ( } onClick={handleNewInvoiceClick} /> } onClick={handleNewPaymentClick} /> } minimal={true} interactionKind={PopoverInteractionKind.CLICK} position={Position.BOTTOM_LEFT} >