diff --git a/apps/judicial-system/backend/src/app/modules/case/case.service.ts b/apps/judicial-system/backend/src/app/modules/case/case.service.ts index b8d00b5bfc7c..618ee04b71d3 100644 --- a/apps/judicial-system/backend/src/app/modules/case/case.service.ts +++ b/apps/judicial-system/backend/src/app/modules/case/case.service.ts @@ -311,7 +311,7 @@ export const include: Includeable[] = [ model: CaseFile, as: 'caseFiles', required: false, - where: { state: { [Op.not]: CaseFileState.DELETED }, category: null }, + where: { state: { [Op.not]: CaseFileState.DELETED } }, separate: true, }, { model: Institution, as: 'court' }, diff --git a/apps/judicial-system/web/src/components/AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem.strings.ts b/apps/judicial-system/web/src/components/AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem.strings.ts new file mode 100644 index 000000000000..83c7ba93cb39 --- /dev/null +++ b/apps/judicial-system/web/src/components/AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem.strings.ts @@ -0,0 +1,10 @@ +import { defineMessages } from 'react-intl' + +export const strings = defineMessages({ + heading: { + id: 'judicial.system.core:connected_case_files_accordion.heading', + defaultMessage: 'Gögn úr máli {caseNumber}', + description: + 'Notaður sem titill fyrir gögn úr sameinuðu ákærumáli á dómara skjá', + }, +}) diff --git a/apps/judicial-system/web/src/components/AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem.tsx b/apps/judicial-system/web/src/components/AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem.tsx new file mode 100644 index 000000000000..e49bf5bacd32 --- /dev/null +++ b/apps/judicial-system/web/src/components/AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem.tsx @@ -0,0 +1,39 @@ +import React, { FC } from 'react' +import { useIntl } from 'react-intl' + +import { AccordionItem } from '@island.is/island-ui/core' + +import { Case } from '@island.is/judicial-system-web/src/graphql/schema' +import { strings } from './ConnectedCaseFilesAccordionItem.strings' + +import { IndictmentCaseFilesList } from '@island.is/judicial-system-web/src/components' + +interface Props { + connectedCase: Case +} + +const ConnectedCaseFilesAccordionItem: FC = ({ connectedCase }) => { + const { formatMessage } = useIntl() + const { caseFiles, courtCaseNumber } = connectedCase + + if (!courtCaseNumber || !caseFiles || caseFiles.length < 1) { + return null + } + + return ( + + + + ) +} + +export default ConnectedCaseFilesAccordionItem diff --git a/apps/judicial-system/web/src/components/FormProvider/case.graphql b/apps/judicial-system/web/src/components/FormProvider/case.graphql index cde0ca65bc63..2aff01484b69 100644 --- a/apps/judicial-system/web/src/components/FormProvider/case.graphql +++ b/apps/judicial-system/web/src/components/FormProvider/case.graphql @@ -275,6 +275,7 @@ query Case($input: CaseQueryInput!) { mergedCases { id courtCaseNumber + type court { id name @@ -301,6 +302,7 @@ query Case($input: CaseQueryInput!) { state key size + category } policeCaseNumbers indictmentSubtypes diff --git a/apps/judicial-system/web/src/components/IndictmentCaseFilesList/IndictmentCaseFilesList.tsx b/apps/judicial-system/web/src/components/IndictmentCaseFilesList/IndictmentCaseFilesList.tsx index 12d20dae6ed9..e7071594d2f8 100644 --- a/apps/judicial-system/web/src/components/IndictmentCaseFilesList/IndictmentCaseFilesList.tsx +++ b/apps/judicial-system/web/src/components/IndictmentCaseFilesList/IndictmentCaseFilesList.tsx @@ -28,6 +28,7 @@ import { strings } from './IndictmentCaseFilesList.strings' interface Props { workingCase: Case + displayHeading?: boolean } interface RenderFilesProps { @@ -57,7 +58,10 @@ export const RenderFiles: FC = ({ ) } -const IndictmentCaseFilesList: FC = ({ workingCase }) => { +const IndictmentCaseFilesList: FC = ({ + workingCase, + displayHeading = true, +}) => { const { formatMessage } = useIntl() const { user } = useContext(UserContext) const { onOpen, fileNotFound, dismissFileNotFound } = useFileList({ @@ -93,7 +97,9 @@ const IndictmentCaseFilesList: FC = ({ workingCase }) => { return ( <> - + {displayHeading && ( + + )} {indictments && indictments.length > 0 && ( diff --git a/apps/judicial-system/web/src/components/index.ts b/apps/judicial-system/web/src/components/index.ts index dc835ddff6c7..1d2ecc1e47c1 100644 --- a/apps/judicial-system/web/src/components/index.ts +++ b/apps/judicial-system/web/src/components/index.ts @@ -10,6 +10,7 @@ export { default as CheckboxList, type CheckboxInfo, } from './CheckboxList/CheckboxList' +export { default as ConnectedCaseFilesAccordionItem } from './AccordionItems/ConnectedCaseFilesAccordionItem/ConnectedCaseFilesAccordionItem' export { default as CommentsAccordionItem } from './AccordionItems/CommentsAccordionItem/CommentsAccordionItem' export { default as ConclusionDraft } from './ConclusionDraft/ConclusionDraft' export { default as ContextMenu } from './ContextMenu/ContextMenu' @@ -53,7 +54,7 @@ export { default as ParentCaseFiles } from './ParentCaseFiles/ParentCaseFiles' export { default as PdfButton } from './PdfButton/PdfButton' export { default as PoliceRequestAccordionItem } from './AccordionItems/PoliceRequestAccordionItem/PoliceRequestAccordionItem' export { default as ProsecutorSelection } from './ProsecutorSelection/ProsecutorSelection' -export { RenderFiles } from './IndictmentCaseFilesList/IndictmentCaseFilesList' +export { RenderFiles, } from './IndictmentCaseFilesList/IndictmentCaseFilesList' export { default as RestrictionTags } from './RestrictionTags/RestrictionTags' export { default as RulingAccordionItem } from './AccordionItems/RulingAccordionItem/RulingAccordionItem' export { default as RulingInput } from './RulingInput/RulingInput' diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx b/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx index 46d32529317a..c5fea1d07046 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx @@ -18,6 +18,7 @@ import { PageLayout, PageTitle, useIndictmentsLawsBroken, + ConnectedCaseFilesAccordionItem, } from '@island.is/judicial-system-web/src/components' import { CaseState, @@ -103,6 +104,13 @@ const IndictmentOverview = () => { )} + {workingCase.mergedCases && + workingCase.mergedCases.length > 0 && + workingCase.mergedCases.map((mergedCase) => ( + + + + ))} {workingCase.caseFiles && (