mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
BIG-32: fix close drawer when delete sale receipt.
This commit is contained in:
@@ -2,13 +2,13 @@ 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 { queryCache } from 'react-query';
|
|
||||||
|
|
||||||
import { useDeleteReceipt } from 'hooks/query';
|
import { useDeleteReceipt } from 'hooks/query';
|
||||||
import { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
|
|
||||||
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,12 +24,11 @@ function NameDeleteAlert({
|
|||||||
|
|
||||||
// #withAlertActions
|
// #withAlertActions
|
||||||
closeAlert,
|
closeAlert,
|
||||||
}) {
|
|
||||||
|
|
||||||
const {
|
// #withDrawerActions
|
||||||
mutateAsync: deleteReceiptMutate,
|
closeDrawer,
|
||||||
isLoading
|
}) {
|
||||||
} = useDeleteReceipt();
|
const { mutateAsync: deleteReceiptMutate, isLoading } = useDeleteReceipt();
|
||||||
|
|
||||||
// Handle cancel delete alert.
|
// Handle cancel delete alert.
|
||||||
const handleCancelDeleteAlert = () => {
|
const handleCancelDeleteAlert = () => {
|
||||||
@@ -44,6 +43,7 @@ function NameDeleteAlert({
|
|||||||
message: intl.get('the_receipt_has_been_deleted_successfully'),
|
message: intl.get('the_receipt_has_been_deleted_successfully'),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
closeDrawer('receipt-detail-drawer');
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@@ -74,4 +74,5 @@ function NameDeleteAlert({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
|
withDrawerActions
|
||||||
)(NameDeleteAlert);
|
)(NameDeleteAlert);
|
||||||
|
|||||||
@@ -34,18 +34,13 @@ function ReceiptDetailActionBar({
|
|||||||
|
|
||||||
// Handle edit sale receipt.
|
// Handle edit sale receipt.
|
||||||
const onEditReceipt = () => {
|
const onEditReceipt = () => {
|
||||||
return receiptId
|
history.push(`/receipts/${receiptId}/edit`);
|
||||||
? (history.push(`/receipts/${receiptId}/edit`),
|
closeDrawer('receipt-detail-drawer');
|
||||||
closeDrawer('receipt-detail-drawer'))
|
|
||||||
: null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle delete sale receipt.
|
// Handle delete sale receipt.
|
||||||
const onDeleteReceipt = () => {
|
const onDeleteReceipt = () => {
|
||||||
return receiptId
|
openAlert('receipt-delete', { receiptId });
|
||||||
? (openAlert('receipt-delete', { receiptId }),
|
|
||||||
closeDrawer('receipt-detail-drawer'))
|
|
||||||
: null;
|
|
||||||
};
|
};
|
||||||
// Handle print receipt.
|
// Handle print receipt.
|
||||||
const onPrintReceipt = () => {
|
const onPrintReceipt = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user