Skip to content

Commit

Permalink
fix(j-s): Indictment Post Processing (#15077)
Browse files Browse the repository at this point in the history
* Fixes post processing of dismissed and cancelled indictments

* Refactors code

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
gudjong and kodiakhq[bot] authored Jun 5, 2024
1 parent 19b919b commit eebb157
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ const Completed: FC = () => {
[workingCase.id],
)

const isRulingOrFine =
workingCase.indictmentRulingDecision &&
[
CaseIndictmentRulingDecision.RULING,
CaseIndictmentRulingDecision.FINE,
].includes(workingCase.indictmentRulingDecision)

const stepIsValid = () =>
workingCase.indictmentRulingDecision === CaseIndictmentRulingDecision.RULING
? workingCase.defendants?.every(
Expand Down Expand Up @@ -112,30 +119,32 @@ const Completed: FC = () => {
<Box marginBottom={5} component="section">
<IndictmentCaseFilesList workingCase={workingCase} />
</Box>
<Box marginBottom={5} component="section">
<SectionHeading
title={formatMessage(strings.criminalRecordUpdateTitle)}
/>
<InputFileUpload
fileList={uploadFiles.filter(
(file) =>
file.category === CaseFileCategory.CRIMINAL_RECORD_UPDATE,
)}
accept="application/pdf"
header={formatMessage(core.uploadBoxTitle)}
buttonLabel={formatMessage(core.uploadBoxButtonLabel)}
description={formatMessage(core.uploadBoxDescription, {
fileEndings: '.pdf',
})}
onChange={(files) =>
handleCriminalRecordUpdateUpload(
files,
CaseFileCategory.CRIMINAL_RECORD_UPDATE,
)
}
onRemove={(file) => handleRemoveFile(file)}
/>
</Box>
{isRulingOrFine && (
<Box marginBottom={5} component="section">
<SectionHeading
title={formatMessage(strings.criminalRecordUpdateTitle)}
/>
<InputFileUpload
fileList={uploadFiles.filter(
(file) =>
file.category === CaseFileCategory.CRIMINAL_RECORD_UPDATE,
)}
accept="application/pdf"
header={formatMessage(core.uploadBoxTitle)}
buttonLabel={formatMessage(core.uploadBoxButtonLabel)}
description={formatMessage(core.uploadBoxDescription, {
fileEndings: '.pdf',
})}
onChange={(files) =>
handleCriminalRecordUpdateUpload(
files,
CaseFileCategory.CRIMINAL_RECORD_UPDATE,
)
}
onRemove={(file) => handleRemoveFile(file)}
/>
</Box>
)}
{workingCase.indictmentRulingDecision ===
CaseIndictmentRulingDecision.RULING && (
<Box marginBottom={10}>
Expand Down Expand Up @@ -239,6 +248,7 @@ const Completed: FC = () => {
<FormContentContainer isFooter>
<FormFooter
previousUrl={constants.CASES_ROUTE}
hideNextButton={!isRulingOrFine}
nextButtonText={formatMessage(strings.sendToPublicProsecutor)}
nextIsDisabled={!stepIsValid()}
onNextButtonClick={handleNextButtonClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ export const strings = defineMessages({
description: 'Notaður sem titill á staðfestingarglugga um að mál sé lokið.',
},
completedCaseModalBody: {
id: 'judicial.system.core:indictments.summary.completed_case_modal_body',
defaultMessage:
'Gögn hafa verið send á ákæranda og verjanda hafi þeim verið hlaðið upp.',
id: 'judicial.system.core:indictments.summary.completed_case_modal_body_v2',
defaultMessage: 'Gögn hafa verið send ákæranda og verjanda.',
description: 'Notaður sem texti í staðfestingarglugga um að mál sé lokið.',
},
})

0 comments on commit eebb157

Please sign in to comment.