From dcdafc085825145e5be2efa6355cd8ec0858ebf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0j=C3=B3n=20Gu=C3=B0j=C3=B3nsson?= Date: Tue, 3 Sep 2024 11:15:30 +0000 Subject: [PATCH] Only allows additional files after indictment is sent to court --- .../Indictments/Overview/Overview.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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 && (