Skip to content

Commit

Permalink
Only allows additional files after indictment is sent to court
Browse files Browse the repository at this point in the history
  • Loading branch information
gudjong committed Sep 3, 2024
1 parent 5786cb9 commit dcdafc0
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -215,8 +221,7 @@ const Overview: FC = () => {
>
<IndictmentCaseFilesList workingCase={workingCase} />
</Box>
{workingCase.indictmentDecision !==
IndictmentDecision.POSTPONING_UNTIL_VERDICT ? (
{userCanAddDocuments && (
<Box
display="flex"
justifyContent="flexEnd"
Expand All @@ -234,7 +239,7 @@ const Overview: FC = () => {
{formatMessage(strings.addDocumentsButtonText)}
</Button>
</Box>
) : null}
)}
{userCanSendIndictmentToCourt && (
<Box marginBottom={10}>
<SectionHeading
Expand Down

0 comments on commit dcdafc0

Please sign in to comment.