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

feat(j-s): Public prosecutor can change indictment reviewer #16466

Merged
merged 4 commits into from
Oct 18, 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 @@ -57,8 +57,6 @@ export const Overview = () => {
const [modalVisible, setModalVisible] = useState<VisibleModal>()
const lawsBroken = useIndictmentsLawsBroken(workingCase)

const displayReviewerChoices = workingCase.indictmentReviewer === null

const [selectedDefendant, setSelectedDefendant] = useState<Defendant | null>()
const { setAndSendDefendantToServer } = useDefendants()

Expand Down Expand Up @@ -172,51 +170,59 @@ export const Overview = () => {
<IndictmentCaseFilesList workingCase={workingCase} />
</Box>
)}
{displayReviewerChoices && (
<Box marginBottom={5}>
<SectionHeading
title={fm(strings.reviewerTitle)}
description={
<Text variant="eyebrow">
{fm(strings.reviewerSubtitle, {
indictmentAppealDeadline: formatDate(
workingCase.indictmentAppealDeadline,
),
})}
</Text>
<Box marginBottom={5}>
<SectionHeading
title={fm(strings.reviewerTitle)}
description={
<Text variant="eyebrow">
{fm(strings.reviewerSubtitle, {
indictmentAppealDeadline: formatDate(
workingCase.indictmentAppealDeadline,
),
})}
</Text>
}
/>
<BlueBox>
<Select
name="reviewer"
label={fm(strings.reviewerLabel)}
placeholder={fm(strings.reviewerPlaceholder)}
value={
selectedIndictmentReviewer
? selectedIndictmentReviewer
: workingCase.indictmentReviewer
? {
label: workingCase.indictmentReviewer.name || '',
value: workingCase.indictmentReviewer.id,
}
: undefined
}
options={publicProsecutors}
onChange={(value) => {
setSelectedIndictmentReviewer(value as Option<string>)
}}
isDisabled={loading}
required
/>
<BlueBox>
<Select
name="reviewer"
label={fm(strings.reviewerLabel)}
placeholder={fm(strings.reviewerPlaceholder)}
value={selectedIndictmentReviewer}
options={publicProsecutors}
onChange={(value) => {
setSelectedIndictmentReviewer(value as Option<string>)
}}
isDisabled={loading}
required
/>
</BlueBox>
</Box>
)}
</BlueBox>
</Box>
</FormContentContainer>
<FormContentContainer isFooter>
<FormFooter
nextButtonIcon="arrowForward"
previousUrl={constants.CASES_ROUTE}
nextIsLoading={isLoadingWorkingCase}
nextIsDisabled={
!selectedIndictmentReviewer ||
selectedIndictmentReviewer.value ===
workingCase.indictmentReviewer?.id ||
isLoadingWorkingCase
}
onNextButtonClick={assignReviewer}
nextButtonText={fm(core.continue)}
/>
</FormContentContainer>

{displayReviewerChoices && (
<FormContentContainer isFooter>
<FormFooter
nextButtonIcon="arrowForward"
previousUrl={`${constants.CASES_ROUTE}`}
nextIsLoading={isLoadingWorkingCase}
nextIsDisabled={!selectedIndictmentReviewer || isLoadingWorkingCase}
onNextButtonClick={assignReviewer}
nextButtonText={fm(core.continue)}
/>
</FormContentContainer>
)}

{modalVisible === 'REVIEWER_ASSIGNED' && (
<Modal
title={fm(strings.reviewerAssignedModalTitle)}
Expand All @@ -228,7 +234,6 @@ export const Overview = () => {
onSecondaryButtonClick={() => router.push(constants.CASES_ROUTE)}
/>
)}

{modalVisible === 'DEFENDANT_VIEWS_VERDICT' && (
<Modal
title={fm(strings.defendantViewsVerdictModalTitle)}
Expand Down