mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
75 lines
1.9 KiB
JavaScript
75 lines
1.9 KiB
JavaScript
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 { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
|
|
|
|
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 { compose } from 'utils';
|
|
|
|
/**
|
|
* Payment made - Details panel - actions bar.
|
|
*/
|
|
function PaymentMadeDetailActionsBar({
|
|
// #withAlertsActions
|
|
openAlert,
|
|
|
|
// #withDrawerActions
|
|
closeDrawer,
|
|
}) {
|
|
const history = useHistory();
|
|
|
|
const { paymentMadeId } = usePaymentMadeDetailContext();
|
|
|
|
// Handle edit payment made.
|
|
const handleEditPaymentMade = () => {
|
|
history.push(`/payment-mades/${paymentMadeId}/edit`);
|
|
closeDrawer('payment-made-detail-drawer');
|
|
};
|
|
|
|
// Handle delete payment made.
|
|
const handleDeletePaymentMade = () => {
|
|
openAlert('payment-made-delete', { paymentMadeId });
|
|
};
|
|
|
|
return (
|
|
<DashboardActionsBar>
|
|
<NavbarGroup>
|
|
<Button
|
|
className={Classes.MINIMAL}
|
|
icon={<Icon icon="pen-18" />}
|
|
text={<T id={'edit_payment_made'} />}
|
|
onClick={handleEditPaymentMade}
|
|
/>
|
|
<NavbarDivider />
|
|
<Button
|
|
className={Classes.MINIMAL}
|
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
|
text={<T id={'delete'} />}
|
|
intent={Intent.DANGER}
|
|
onClick={handleDeletePaymentMade}
|
|
/>
|
|
</NavbarGroup>
|
|
</DashboardActionsBar>
|
|
);
|
|
}
|
|
|
|
export default compose(
|
|
withDialogActions,
|
|
withDrawerActions,
|
|
withAlertsActions,
|
|
)(PaymentMadeDetailActionsBar);
|