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

fix(j-s): Additional Documents #15866

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Changes from all commits
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
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