From ea236acb083444b6563b53a4409bf0c57a24d530 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 26 Nov 2024 12:16:33 +0600 Subject: [PATCH] feat: disable save and exit button also when a fetch in progress --- .../client/src/views/RegisterForm/RegisterForm.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/client/src/views/RegisterForm/RegisterForm.tsx b/packages/client/src/views/RegisterForm/RegisterForm.tsx index e33bd5a889..b28243eb42 100644 --- a/packages/client/src/views/RegisterForm/RegisterForm.tsx +++ b/packages/client/src/views/RegisterForm/RegisterForm.tsx @@ -260,7 +260,8 @@ function FormAppBar({ duplicate, modifyDeclarationMethod, deleteDeclarationMethod, - printDeclarationMethod + printDeclarationMethod, + canSaveAndExit }: { duplicate: boolean | undefined section: IFormSection @@ -268,6 +269,7 @@ function FormAppBar({ modifyDeclarationMethod: (declration: IDeclaration) => void deleteDeclarationMethod: (declration: IDeclaration) => void printDeclarationMethod: (declarationId: string) => void + canSaveAndExit: boolean }) { const intl = useIntl() const dispatch = useDispatch() @@ -551,6 +553,7 @@ function FormAppBar({ id="save-exit-btn" type="primary" size="small" + disabled={!canSaveAndExit} onClick={handleSaveAndExit} > @@ -609,7 +612,12 @@ function FormAppBar({ mobileRight={ <> {!isCorrection(declaration) && ( - )} @@ -1047,6 +1055,7 @@ class RegisterFormView extends React.Component { modifyDeclarationMethod={this.props.modifyDeclaration} deleteDeclarationMethod={this.onDeleteDeclaration} printDeclarationMethod={this.props.goToPrintRecord} + canSaveAndExit={canContinue} /> } key={activeSection.id}