feat: alert messages of pause.resume bank feeds

This commit is contained in:
Ahmed Bouhuolia
2024-08-04 16:05:35 +02:00
parent 208800b411
commit b84675325f
6 changed files with 62 additions and 24 deletions

View File

@@ -197,12 +197,15 @@ function AccountTransactionsActionsBar({
// Handle resume bank feeds syncing.
const handleResumeFeedsSyncing = () => {
openAlert('resume-feeds-syncing-bank-accounnt');
openAlert('resume-feeds-syncing-bank-accounnt', {
bankAccountId: accountId,
});
};
// Handles pause bank feeds syncing.
const handlePauseFeedsSyncing = () => {
openAlert('pause-feeds-syncing-bank-accounnt');
openAlert('pause-feeds-syncing-bank-accounnt', {
bankAccountId: accountId,
});
};
return (
@@ -298,14 +301,21 @@ function AccountTransactionsActionsBar({
}}
content={
<Menu>
<MenuItem
onClick={handlePauseFeedsSyncing}
text={'Pause bankfeeds syncing'}
/>
<MenuItem
onClick={handleResumeFeedsSyncing}
text={'Resume bankfeeds syncing'}
/>
<If condition={isSyncingOwner}>
<MenuItem
onClick={handlePauseFeedsSyncing}
text={'Pause bank feeds'}
/>
<MenuDivider />
</If>
<If condition={isSyncingOwner}>
<MenuItem
onClick={handleResumeFeedsSyncing}
text={'Resume bank feeds'}
/>
<MenuDivider />
</If>
<If condition={isSyncingOwner && isFeedsActive}>
<MenuItem onClick={handleBankUpdateClick} text={'Update'} />

View File

@@ -1,6 +1,5 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster, FormattedMessage as T } from '@/components';
@@ -30,10 +29,9 @@ function PauseFeedsBankAccountAlert({
const handleCancelActivateItem = () => {
closeAlert(name);
};
// Handle confirm item activated.
const handleConfirmItemActivate = () => {
pauseBankAccountFeeds(bankAccountId)
pauseBankAccountFeeds({ bankAccountId })
.then(() => {
AppToaster.show({
message: 'The bank feeds of the bank account has been paused.',
@@ -49,14 +47,17 @@ function PauseFeedsBankAccountAlert({
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'activate'} />}
confirmButtonText={'Pause bank feeds'}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleCancelActivateItem}
loading={isLoading}
onConfirm={handleConfirmItemActivate}
>
<p>Are you sure.</p>
<p>
Are you sure want to pause bank feeds syncing of this bank account, you
can always resume it again?
</p>
</Alert>
);
}

View File

@@ -33,7 +33,7 @@ function ResumeFeedsBankAccountAlert({
// Handle confirm item activated.
const handleConfirmItemActivate = () => {
resumeFeedsBankAccount(bankAccountId)
resumeFeedsBankAccount({ bankAccountId })
.then(() => {
AppToaster.show({
message: 'The bank feeds of the bank account has been resumed.',
@@ -49,14 +49,17 @@ function ResumeFeedsBankAccountAlert({
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'activate'} />}
intent={Intent.WARNING}
confirmButtonText={'Resume bank feeds'}
intent={Intent.SUCCESS}
isOpen={isOpen}
onCancel={handleCancelActivateItem}
loading={isLoading}
onConfirm={handleConfirmItemActivate}
>
<p>Are you sure.</p>
<p>
Are you sure want to resume bank feeds syncing of this bank account, you
can always pause it again?
</p>
</Alert>
);
}