refactoring: sales tables.

refacoring: purchases tables.
This commit is contained in:
a.bouhuolia
2021-02-11 20:45:06 +02:00
parent 3901c336df
commit d48532a7e6
210 changed files with 2799 additions and 5392 deletions

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import React, { useCallback } from 'react';
import {
FormattedMessage as T,
FormattedHTMLMessage,

View File

@@ -1,14 +1,12 @@
import React, { useCallback } from 'react';
import React from 'react';
import { FormattedMessage as T, useIntl } from 'react-intl';
import { Intent, Alert } from '@blueprintjs/core';
import { queryCache } from 'react-query';
import { AppToaster } from 'components';
import { useRejectEstimate } from 'hooks/query';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import withEstimateActions from 'containers/Sales/Estimate/withEstimateActions';
import { compose } from 'utils';
@@ -22,9 +20,6 @@ function EstimateRejectAlert({
isOpen,
payload: { estimateId },
// #withEstimateActions
requestRejectEstimate,
// #withAlertActions
closeAlert,
}) {
@@ -40,8 +35,8 @@ function EstimateRejectAlert({
};
// Handle confirm estimate reject.
const handleConfirmEstimateReject = useCallback(() => {
requestRejectEstimate(estimateId)
const handleConfirmEstimateReject = () => {
rejectEstimateMutate(estimateId)
.then(() => {
AppToaster.show({
message: formatMessage({
@@ -49,13 +44,12 @@ function EstimateRejectAlert({
}),
intent: Intent.SUCCESS,
});
queryCache.invalidateQueries('estimates-table');
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
}, [estimateId, rejectEstimateMutate, formatMessage]);
};
return (
<Alert
@@ -77,5 +71,4 @@ function EstimateRejectAlert({
export default compose(
withAlertStoreConnect(),
withAlertActions,
withEstimateActions,
)(EstimateRejectAlert);