feat: add convert to credit note in drawer.

This commit is contained in:
elforjani13
2021-12-26 16:34:05 +02:00
parent 80d86b01de
commit 2a9c1a9833
2 changed files with 23 additions and 2 deletions

View File

@@ -14,7 +14,13 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { If, Can, Icon, DrawerActionsBar, FormattedMessage as T } from 'components';
import {
If,
Can,
Icon,
DrawerActionsBar,
FormattedMessage as T,
} from 'components';
import {
SaleInvoiceAction,
PaymentReceiveAction,
@@ -48,6 +54,14 @@ function InvoiceDetailActionsBar({
closeDrawer('invoice-detail-drawer');
};
// Handle convert to invoice.
const handleConvertToCreitNote = () => {
history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, {
invoiceId: invoiceId,
});
closeDrawer('invoice-detail-drawer');
};
// Handle delete sale invoice.
const handleDeleteInvoice = () => {
openAlert('invoice-delete', { invoiceId });
@@ -124,6 +138,7 @@ function InvoiceDetailActionsBar({
onBadDebt: handleBadDebtInvoice,
onCancelBadDebt: handleCancelBadDebtInvoice,
onNotifyViaSMS: handleNotifyViaSMS,
onConvert: handleConvertToCreitNote,
}}
/>
</Can>