Skip to content

Commit

Permalink
Merge pull request #8069 from opencrvs/disable-save-exit-button-on-async
Browse files Browse the repository at this point in the history
feat(fetch-button): disable save and exit button also when a fetch in progress
  • Loading branch information
tahmidrahman-dsi authored Nov 26, 2024
2 parents cb97021 + c5b54c3 commit 71b5c7c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/client/src/views/RegisterForm/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,16 @@ function FormAppBar({
duplicate,
modifyDeclarationMethod,
deleteDeclarationMethod,
printDeclarationMethod
printDeclarationMethod,
canSaveAndExit
}: {
duplicate: boolean | undefined
section: IFormSection
declaration: IDeclaration
modifyDeclarationMethod: (declration: IDeclaration) => void
deleteDeclarationMethod: (declration: IDeclaration) => void
printDeclarationMethod: (declarationId: string) => void
canSaveAndExit: boolean
}) {
const intl = useIntl()
const dispatch = useDispatch()
Expand Down Expand Up @@ -551,6 +553,7 @@ function FormAppBar({
id="save-exit-btn"
type="primary"
size="small"
disabled={!canSaveAndExit}
onClick={handleSaveAndExit}
>
<Icon name="DownloadSimple" />
Expand Down Expand Up @@ -609,7 +612,12 @@ function FormAppBar({
mobileRight={
<>
{!isCorrection(declaration) && (
<Button type="icon" size="small" onClick={handleSaveAndExit}>
<Button
type="icon"
size="small"
disabled={!canSaveAndExit}
onClick={handleSaveAndExit}
>
<Icon name="DownloadSimple" />
</Button>
)}
Expand Down Expand Up @@ -1047,6 +1055,7 @@ class RegisterFormView extends React.Component<FullProps, State> {
modifyDeclarationMethod={this.props.modifyDeclaration}
deleteDeclarationMethod={this.onDeleteDeclaration}
printDeclarationMethod={this.props.goToPrintRecord}
canSaveAndExit={canContinue}
/>
}
key={activeSection.id}
Expand Down

0 comments on commit 71b5c7c

Please sign in to comment.