mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
BIG-30: fix close drawer when delete sale invoice.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
|
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
|
||||||
import { Intent, Alert } from '@blueprintjs/core';
|
import { Intent, Alert } from '@blueprintjs/core';
|
||||||
import { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
import { useDeleteInvoice } from 'hooks/query';
|
import { useDeleteInvoice } from 'hooks/query';
|
||||||
@@ -9,6 +9,7 @@ import { handleDeleteErrors } from 'containers/Sales/Invoices/InvoicesLanding/co
|
|||||||
|
|
||||||
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
|
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
|
||||||
import withAlertActions from 'containers/Alert/withAlertActions';
|
import withAlertActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -24,8 +25,10 @@ function InvoiceDeleteAlert({
|
|||||||
|
|
||||||
// #withAlertActions
|
// #withAlertActions
|
||||||
closeAlert,
|
closeAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const { mutateAsync: deleteInvoiceMutate, isLoading } = useDeleteInvoice();
|
const { mutateAsync: deleteInvoiceMutate, isLoading } = useDeleteInvoice();
|
||||||
|
|
||||||
// handle cancel delete invoice alert.
|
// handle cancel delete invoice alert.
|
||||||
@@ -41,10 +44,17 @@ function InvoiceDeleteAlert({
|
|||||||
message: intl.get('the_invoice_has_been_deleted_successfully'),
|
message: intl.get('the_invoice_has_been_deleted_successfully'),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
closeDrawer('invoice-detail-drawer');
|
||||||
})
|
})
|
||||||
.catch(({ response: { data: { errors } } }) => {
|
.catch(
|
||||||
handleDeleteErrors(errors);
|
({
|
||||||
})
|
response: {
|
||||||
|
data: { errors },
|
||||||
|
},
|
||||||
|
}) => {
|
||||||
|
handleDeleteErrors(errors);
|
||||||
|
},
|
||||||
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
closeAlert(name);
|
closeAlert(name);
|
||||||
});
|
});
|
||||||
@@ -73,4 +83,5 @@ function InvoiceDeleteAlert({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
|
withDrawerActions,
|
||||||
)(InvoiceDeleteAlert);
|
)(InvoiceDeleteAlert);
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ function InvoiceDetailActionsBar({
|
|||||||
// Handle delete sale invoice.
|
// Handle delete sale invoice.
|
||||||
const handleDeleteInvoice = () => {
|
const handleDeleteInvoice = () => {
|
||||||
openAlert('invoice-delete', { invoiceId });
|
openAlert('invoice-delete', { invoiceId });
|
||||||
closeDrawer('invoice-detail-drawer');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle print invoices.
|
// Handle print invoices.
|
||||||
|
|||||||
Reference in New Issue
Block a user