Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(User roles) fix: Send for review action button display logic #7973

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 33 additions & 28 deletions packages/client/src/components/form/ReviewActionComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,35 +388,40 @@ const ReviewActionComponent = ({
{intl.formatMessage(buttonMessages.sendForApproval)}
</Button>
</ProtectedComponent>
) : !completeDeclaration ? (
<ProtectedComponent scopes={[SCOPES.RECORD_SUBMIT_INCOMPLETE]}>
<Button
type="primary"
size="large"
id="submit_incomplete"
onClick={toggleSubmitModalOpen}
disabled={hasErrorsOnFields || totalFileSizeExceeded}
>
<Upload />
{intl.formatMessage(buttonMessages.sendIncomplete)}
</Button>
</ProtectedComponent>
) : (
<ProtectedComponent
scopes={[SCOPES.RECORD_SUBMIT_FOR_REVIEW]}
denyScopes={[SCOPES.RECORD_SUBMIT_INCOMPLETE]}
>
<Button
type="primary"
size="large"
id="submit_for_review"
onClick={toggleSubmitModalOpen}
disabled={hasErrorsOnFields || totalFileSizeExceeded}
>
<Upload />
{intl.formatMessage(buttonMessages.sendForReview)}
</Button>
</ProtectedComponent>
<>
{!completeDeclaration && (
<ProtectedComponent scopes={[SCOPES.RECORD_SUBMIT_INCOMPLETE]}>
<Button
type="primary"
size="large"
id="submit_incomplete"
onClick={toggleSubmitModalOpen}
disabled={hasErrorsOnFields || totalFileSizeExceeded}
>
<Upload />
{intl.formatMessage(buttonMessages.sendIncomplete)}
Zangetsu101 marked this conversation as resolved.
Show resolved Hide resolved
</Button>
</ProtectedComponent>
)}
<ProtectedComponent scopes={[SCOPES.RECORD_SUBMIT_FOR_REVIEW]}>
<Button
type="primary"
size="large"
id="submit_for_review"
onClick={toggleSubmitModalOpen}
disabled={
hasErrorsOnFields ||
totalFileSizeExceeded ||
(!completeDeclaration &&
!hasScope(SCOPES.RECORD_SUBMIT_INCOMPLETE))
}
>
<Upload />
{intl.formatMessage(buttonMessages.sendForReview)}
</Button>
</ProtectedComponent>
</>
)}
{rejectDeclarationAction && !alreadyRejectedDeclaration && (
<ProtectedComponent scopes={[SCOPES.RECORD_SUBMIT_FOR_UPDATES]}>
Expand Down
Loading