mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 00:00:31 +00:00
BIG-33: fix close drawer when delete bill.
This commit is contained in:
@@ -6,6 +6,7 @@ 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 { handleDeleteErrors } from 'containers/Purchases/Bills/BillForm/utils';
|
import { handleDeleteErrors } from 'containers/Purchases/Bills/BillForm/utils';
|
||||||
import { useDeleteBill } from 'hooks/query';
|
import { useDeleteBill } from 'hooks/query';
|
||||||
@@ -23,8 +24,10 @@ function BillDeleteAlert({
|
|||||||
|
|
||||||
// #withAlertActions
|
// #withAlertActions
|
||||||
closeAlert,
|
closeAlert,
|
||||||
}) {
|
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
|
}) {
|
||||||
const { isLoading, mutateAsync: deleteBillMutate } = useDeleteBill();
|
const { isLoading, mutateAsync: deleteBillMutate } = useDeleteBill();
|
||||||
|
|
||||||
// Handle cancel Bill
|
// Handle cancel Bill
|
||||||
@@ -40,6 +43,8 @@ function BillDeleteAlert({
|
|||||||
message: intl.get('the_bill_has_been_deleted_successfully'),
|
message: intl.get('the_bill_has_been_deleted_successfully'),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
closeDrawer('bill-drawer');
|
||||||
})
|
})
|
||||||
.catch(
|
.catch(
|
||||||
({
|
({
|
||||||
@@ -76,4 +81,5 @@ function BillDeleteAlert({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
|
withDrawerActions,
|
||||||
)(BillDeleteAlert);
|
)(BillDeleteAlert);
|
||||||
|
|||||||
@@ -36,16 +36,13 @@ function BillDetailActionsBar({
|
|||||||
|
|
||||||
// Handle edit bill.
|
// Handle edit bill.
|
||||||
const onEditBill = () => {
|
const onEditBill = () => {
|
||||||
return billId
|
history.push(`/bills/${billId}/edit`);
|
||||||
? (history.push(`/bills/${billId}/edit`), closeDrawer('bill-drawer'))
|
closeDrawer('bill-drawer');
|
||||||
: null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle delete bill.
|
// Handle delete bill.
|
||||||
const onDeleteBill = () => {
|
const onDeleteBill = () => {
|
||||||
return billId
|
openAlert('bill-delete', { billId });
|
||||||
? (openAlert('bill-delete', { billId }), closeDrawer('bill-drawer'))
|
|
||||||
: null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user