mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
BIG-29: fix close drawer when delete inventory.
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
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 withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
|
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
|
||||||
import withAlertActions from 'containers/Alert/withAlertActions';
|
import withAlertActions from 'containers/Alert/withAlertActions';
|
||||||
import {
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
useDeleteInventoryAdjustment
|
import { useDeleteInventoryAdjustment } from 'hooks/query';
|
||||||
} from 'hooks/query';
|
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -24,12 +23,12 @@ function InventoryAdjustmentDeleteAlert({
|
|||||||
|
|
||||||
// #withAlertActions
|
// #withAlertActions
|
||||||
closeAlert,
|
closeAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
}) {
|
}) {
|
||||||
|
const { mutateAsync: deleteInventoryAdjMutate, isLoading } =
|
||||||
const {
|
useDeleteInventoryAdjustment();
|
||||||
mutateAsync: deleteInventoryAdjMutate,
|
|
||||||
isLoading
|
|
||||||
} = useDeleteInventoryAdjustment();
|
|
||||||
|
|
||||||
// handle cancel delete alert.
|
// handle cancel delete alert.
|
||||||
const handleCancelInventoryAdjustmentDelete = () => {
|
const handleCancelInventoryAdjustmentDelete = () => {
|
||||||
@@ -44,6 +43,7 @@ function InventoryAdjustmentDeleteAlert({
|
|||||||
message: intl.get('the_adjustment_has_been_deleted_successfully'),
|
message: intl.get('the_adjustment_has_been_deleted_successfully'),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
closeDrawer('inventory-adjustment-drawer');
|
||||||
})
|
})
|
||||||
.catch((errors) => {})
|
.catch((errors) => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@@ -76,4 +76,5 @@ function InventoryAdjustmentDeleteAlert({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
|
withDrawerActions,
|
||||||
)(InventoryAdjustmentDeleteAlert);
|
)(InventoryAdjustmentDeleteAlert);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
|||||||
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
||||||
|
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
|
||||||
|
|
||||||
import { Icon, FormattedMessage as T } from 'components';
|
import { Icon, FormattedMessage as T } from 'components';
|
||||||
|
|
||||||
@@ -18,16 +17,12 @@ import { compose } from 'utils';
|
|||||||
function InventoryAdjustmentDetailActionsBar({
|
function InventoryAdjustmentDetailActionsBar({
|
||||||
// #withAlertsActions
|
// #withAlertsActions
|
||||||
openAlert,
|
openAlert,
|
||||||
|
|
||||||
// #withDrawerActions
|
|
||||||
closeDrawer,
|
|
||||||
}) {
|
}) {
|
||||||
const { inventoryId } = useInventoryAdjustmentDrawerContext();
|
const { inventoryId } = useInventoryAdjustmentDrawerContext();
|
||||||
|
|
||||||
// Handle delete inventory adjustment.
|
// Handle delete inventory adjustment.
|
||||||
const handleDeleteInventoryAdjustment = () => {
|
const handleDeleteInventoryAdjustment = () => {
|
||||||
openAlert('inventory-adjustment-delete', { inventoryId });
|
openAlert('inventory-adjustment-delete', { inventoryId });
|
||||||
closeDrawer('inventory-adjustment-drawer');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -45,7 +40,4 @@ function InventoryAdjustmentDetailActionsBar({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default compose(withAlertsActions)(InventoryAdjustmentDetailActionsBar);
|
||||||
withDrawerActions,
|
|
||||||
withAlertsActions,
|
|
||||||
)(InventoryAdjustmentDetailActionsBar);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user