diff --git a/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx b/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx index a6786a4d51c0..20ae6fa85667 100644 --- a/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx +++ b/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx @@ -62,18 +62,24 @@ const Overview: FC = () => { const latestDate = workingCase.courtDate ?? workingCase.arraignmentDate const isIndictmentNew = workingCase.state === CaseState.DRAFT + const isIndictmentWaitingForConfirmation = + workingCase.state === CaseState.WAITING_FOR_CONFIRMATION const isIndictmentSubmitted = workingCase.state === CaseState.SUBMITTED const isIndictmentWaitingForCancellation = workingCase.state === CaseState.WAITING_FOR_CANCELLATION const isIndictmentReceived = workingCase.state === CaseState.RECEIVED const userCanSendIndictmentToCourt = - Boolean(user?.canConfirmIndictment) && - workingCase.state === CaseState.WAITING_FOR_CONFIRMATION + Boolean(user?.canConfirmIndictment) && isIndictmentWaitingForConfirmation const userCanCancelIndictment = - (workingCase.state === CaseState.SUBMITTED || - workingCase.state === CaseState.RECEIVED) && + (isIndictmentSubmitted || isIndictmentReceived) && !workingCase.indictmentDecision + const userCanAddDocuments = + isIndictmentSubmitted || + (isIndictmentReceived && + workingCase.indictmentDecision !== + IndictmentDecision.POSTPONING_UNTIL_VERDICT && + workingCase.indictmentDecision !== IndictmentDecision.COMPLETING) const handleTransition = async (transitionType: CaseTransition) => { const caseTransitioned = await transitionCase( @@ -215,8 +221,7 @@ const Overview: FC = () => { > - {workingCase.indictmentDecision !== - IndictmentDecision.POSTPONING_UNTIL_VERDICT ? ( + {userCanAddDocuments && ( { {formatMessage(strings.addDocumentsButtonText)} - ) : null} + )} {userCanSendIndictmentToCourt && (