diff --git a/apps/judicial-system/api/src/app/modules/auth/auth.controller.ts b/apps/judicial-system/api/src/app/modules/auth/auth.controller.ts index 21476b07e3c4..9cf8b9aaee6c 100644 --- a/apps/judicial-system/api/src/app/modules/auth/auth.controller.ts +++ b/apps/judicial-system/api/src/app/modules/auth/auth.controller.ts @@ -22,11 +22,13 @@ import { DEFENDER_CASES_ROUTE, EXPIRES_IN_MILLISECONDS, IDS_ID_TOKEN, + PRISON_CASES_ROUTE, USERS_ROUTE, } from '@island.is/judicial-system/consts' import { EventType, InstitutionType, + isPrisonSystemUser, UserRole, } from '@island.is/judicial-system/types' @@ -241,6 +243,8 @@ export class AuthController { ? DEFENDER_CASES_ROUTE : user.institution?.type === InstitutionType.COURT_OF_APPEALS ? COURT_OF_APPEAL_CASES_ROUTE + : isPrisonSystemUser(user) + ? PRISON_CASES_ROUTE : CASES_ROUTE, } } else { 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 9bbcf11f0d57..95fe5ea86d23 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 @@ -1485,6 +1485,16 @@ export class CaseService { return this.eventLogService.create(eventLogDTO, transaction) } + + if (update.indictmentReviewDecision) { + const eventLogDTO = this.constructEventLogDTO( + EventType.INDICTMENT_REVIEWED, + theCase, + user, + ) + + return this.eventLogService.create(eventLogDTO, transaction) + } } } diff --git a/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts b/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts index 29800e6eab89..cb42b7181d0c 100644 --- a/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts +++ b/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts @@ -105,6 +105,7 @@ export const attributes: (keyof Case)[] = [ 'indictmentHash', 'courtSessionType', 'indictmentReviewDecision', + 'indictmentReviewerId', ] export interface LimitedAccessUpdateCase @@ -164,6 +165,11 @@ export const include: Includeable[] = [ as: 'appealJudge3', include: [{ model: Institution, as: 'institution' }], }, + { + model: User, + as: 'indictmentReviewer', + include: [{ model: Institution, as: 'institution' }], + }, { model: Case, as: 'parentCase', attributes }, { model: Case, as: 'childCase', attributes }, { model: Defendant, as: 'defendants' }, diff --git a/apps/judicial-system/web/pages/fangelsi/akaera/yfirlit/[id].ts b/apps/judicial-system/web/pages/fangelsi/akaera/yfirlit/[id].ts new file mode 100644 index 000000000000..55046930afa9 --- /dev/null +++ b/apps/judicial-system/web/pages/fangelsi/akaera/yfirlit/[id].ts @@ -0,0 +1,3 @@ +import IndictmentOverview from '@island.is/judicial-system-web/src/routes/Prison/IndictmentOverview/IndictmentOverview' + +export default IndictmentOverview diff --git a/apps/judicial-system/web/pages/fangelsi/krafa/yfirlit/[id].ts b/apps/judicial-system/web/pages/fangelsi/krafa/yfirlit/[id].ts new file mode 100644 index 000000000000..a8ff34bf59ee --- /dev/null +++ b/apps/judicial-system/web/pages/fangelsi/krafa/yfirlit/[id].ts @@ -0,0 +1,3 @@ +import { SignedVerdictOverview } from '@island.is/judicial-system-web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview' + +export default SignedVerdictOverview diff --git a/apps/judicial-system/web/pages/fangelsi/krofur.ts b/apps/judicial-system/web/pages/fangelsi/krofur.ts new file mode 100644 index 000000000000..7cf5786c649d --- /dev/null +++ b/apps/judicial-system/web/pages/fangelsi/krofur.ts @@ -0,0 +1,3 @@ +import PrisonCases from '@island.is/judicial-system-web/src/routes/Shared/Cases/PrisonCases' + +export default PrisonCases diff --git a/apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx b/apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx index b0c628b9f2db..86da4c6a855e 100644 --- a/apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx +++ b/apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx @@ -36,7 +36,7 @@ interface Props { infoBoxText?: string } -const FormFooter: FC> = ({ +const FormFooter: FC = ({ previousUrl, previousIsDisabled, previousButtonText, diff --git a/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql b/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql index a63bd030e550..39b75cd6e736 100644 --- a/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql +++ b/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql @@ -146,6 +146,17 @@ query LimitedAccessCase($input: CaseQueryInput!) { postponedIndefinitelyExplanation indictmentDecision indictmentRulingDecision + indictmentCompletedDate + indictmentReviewDecision + indictmentReviewer { + id + name + } courtSessionType + eventLogs { + id + created + eventType + } } } diff --git a/apps/judicial-system/web/src/components/Header/Header.tsx b/apps/judicial-system/web/src/components/Header/Header.tsx index ace9f09739e1..a43d8b6dfc5e 100644 --- a/apps/judicial-system/web/src/components/Header/Header.tsx +++ b/apps/judicial-system/web/src/components/Header/Header.tsx @@ -31,6 +31,7 @@ import { isAdminUser, isCourtOfAppealsUser, isDefenceUser, + isPrisonSystemUser, } from '@island.is/judicial-system/types' import { api } from '@island.is/judicial-system-web/src/services' @@ -96,6 +97,8 @@ const HeaderContainer = () => { ? constants.USERS_ROUTE : isCourtOfAppealsUser(user) ? constants.COURT_OF_APPEAL_CASES_ROUTE + : isPrisonSystemUser(user) + ? constants.PRISON_CASES_ROUTE : constants.CASES_ROUTE const handleLogout = () => { diff --git a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts index 1b953be027ea..7b2b9fbb4d4e 100644 --- a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts +++ b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts @@ -23,6 +23,11 @@ export const strings = defineMessages({ defaultMessage: 'Verjandi', description: 'Notað til að birta titil á verjanda í ákæru.', }, + verdictDisplayedDate: { + id: 'judicial.system.core:info_card.defendant_info.verdict_displayed_date', + defaultMessage: 'Dómur birtur {date}', + description: 'Notað til að birta dagsetningu þegar dómur var birtur.', + }, noDefenderAssigned: { id: 'judicial.system.core:info_card.defendant_info.no_defender_assigned', defaultMessage: 'Ekki skráður', diff --git a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx index 9eeaededde45..e9c5652abef9 100644 --- a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx +++ b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx @@ -27,14 +27,17 @@ interface DefendantInfoProps { displayDefenderInfo: boolean displayAppealExpirationInfo?: boolean defendantInfoActionButton?: DefendantInfoActionButton + displayVerdictViewDate?: boolean } -export const DefendantInfo: FC = ({ - defendant, - displayDefenderInfo, - displayAppealExpirationInfo, - defendantInfoActionButton, -}) => { +export const DefendantInfo: FC = (props) => { + const { + defendant, + displayDefenderInfo, + displayAppealExpirationInfo, + defendantInfoActionButton, + displayVerdictViewDate, + } = props const { formatMessage } = useIntl() const getAppealExpirationInfo = (viewDate?: string) => { @@ -76,7 +79,6 @@ export const DefendantInfo: FC = ({ {defendant.address && `, ${defendant.address}`} - {displayAppealExpirationInfo && ( @@ -84,7 +86,6 @@ export const DefendantInfo: FC = ({ )} - {displayDefenderInfo && ( {`${formatMessage(strings.defender)}: ${ @@ -106,8 +107,14 @@ export const DefendantInfo: FC = ({ )} )} + {displayVerdictViewDate && ( + + {formatMessage(strings.verdictDisplayedDate, { + date: formatDate(defendant.verdictViewDate, 'PPP'), + })} + + )} - {defendantInfoActionButton && ( + + + {formatMessage(strings.title)} + + + {workingCase.courtCaseNumber && ( + + + {formatMessage(core.caseNumber, { + caseNumber: workingCase.courtCaseNumber, + })} + + + )} + {workingCase.indictmentCompletedDate && ( + + + {formatMessage(strings.indictmentCompletedTitle, { + date: formatDate(workingCase.indictmentCompletedDate, 'PPP'), + })} + + + )} + + + + + + {formatMessage(strings.verdictTitle)} + + file.category === CaseFileCategory.RULING, + ) || [] + } + /> + + + + + + + ) +} + +export default IndictmentOverview diff --git a/apps/judicial-system/web/src/routes/Shared/Cases/AllCases.tsx b/apps/judicial-system/web/src/routes/Shared/Cases/AllCases.tsx index 00f3bb40f0c4..fc94c44896cd 100644 --- a/apps/judicial-system/web/src/routes/Shared/Cases/AllCases.tsx +++ b/apps/judicial-system/web/src/routes/Shared/Cases/AllCases.tsx @@ -1,22 +1,14 @@ import React, { FC, useContext } from 'react' -import { - isPrisonSystemUser, - isPublicProsecutorUser, -} from '@island.is/judicial-system/types' +import { isPublicProsecutorUser } from '@island.is/judicial-system/types' import { UserContext } from '@island.is/judicial-system-web/src/components' import PublicProsecutorCases from '../../PublicProsecutor/Cases/PublicProsecutorCases' import Cases from './Cases' -import PrisonCases from './PrisonCases' export const AllCases: FC = () => { const { user } = useContext(UserContext) - if (isPrisonSystemUser(user)) { - return - } - if (isPublicProsecutorUser(user)) { return } diff --git a/apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx b/apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx index e417e113ddd0..1288c0d39528 100644 --- a/apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx @@ -444,7 +444,13 @@ export const SignedVerdictOverview: FC = () => { diff --git a/apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx b/apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx index d0013695b275..a4f6b465fc71 100644 --- a/apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx +++ b/apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx @@ -15,6 +15,7 @@ import { isDefenceUser, isDistrictCourtUser, isInvestigationCase, + isPrisonSystemUser, isPublicProsecutorUser, isRequestCase, isRestrictionCase, @@ -93,10 +94,12 @@ const useCaseList = () => { } } } else { - // The user is a prosecution user + // The user is a prosecution or prison system user. They can only see completed cases if (isRestrictionCase(caseToOpen.type)) { if (isCompletedCase(caseToOpen.state)) { - routeTo = constants.SIGNED_VERDICT_OVERVIEW_ROUTE + routeTo = isPrisonSystemUser(user) + ? constants.PRISON_SIGNED_VERDICT_OVERVIEW_ROUTE + : constants.SIGNED_VERDICT_OVERVIEW_ROUTE } else { routeTo = findFirstInvalidStep( constants.prosecutorRestrictionCasesRoutes, @@ -105,7 +108,9 @@ const useCaseList = () => { } } else if (isInvestigationCase(caseToOpen.type)) { if (isCompletedCase(caseToOpen.state)) { - routeTo = constants.SIGNED_VERDICT_OVERVIEW_ROUTE + routeTo = isPrisonSystemUser(user) + ? constants.PRISON_SIGNED_VERDICT_OVERVIEW_ROUTE + : constants.SIGNED_VERDICT_OVERVIEW_ROUTE } else { routeTo = findFirstInvalidStep( constants.prosecutorInvestigationCasesRoutes, @@ -114,7 +119,9 @@ const useCaseList = () => { } } else { if (isCompletedCase(caseToOpen.state)) { - routeTo = constants.CLOSED_INDICTMENT_OVERVIEW_ROUTE + routeTo = isPrisonSystemUser(user) + ? constants.PRISON_CLOSED_INDICTMENT_OVERVIEW_ROUTE + : constants.CLOSED_INDICTMENT_OVERVIEW_ROUTE } else { routeTo = findFirstInvalidStep( constants.prosecutorIndictmentRoutes(isTrafficViolation), diff --git a/libs/judicial-system/consts/src/lib/consts.ts b/libs/judicial-system/consts/src/lib/consts.ts index 8fb4af170a2d..f2a7d41a7a73 100644 --- a/libs/judicial-system/consts/src/lib/consts.ts +++ b/libs/judicial-system/consts/src/lib/consts.ts @@ -101,6 +101,13 @@ export const PUBLIC_PROSECUTOR_STAFF_INDICTMENT_OVERVIEW_ROUTE = '/rikissaksoknari/akaera/yfirlit' //#endregion Public prosecutor user routes +//#region Prison user routes +export const PRISON_CASES_ROUTE = '/fangelsi/krofur' +export const PRISON_SIGNED_VERDICT_OVERVIEW_ROUTE = '/fangelsi/krafa/yfirlit' +export const PRISON_CLOSED_INDICTMENT_OVERVIEW_ROUTE = + '/fangelsi/akaera/yfirlit' +//#endregion Prison user routes + //#region Court of appeals user routes export const COURT_OF_APPEAL_OVERVIEW_ROUTE = '/landsrettur/yfirlit' export const COURT_OF_APPEAL_CASES_ROUTE = '/landsrettur/krofur' diff --git a/libs/judicial-system/types/src/lib/eventLog.ts b/libs/judicial-system/types/src/lib/eventLog.ts index b51be0676be1..bbb599780607 100644 --- a/libs/judicial-system/types/src/lib/eventLog.ts +++ b/libs/judicial-system/types/src/lib/eventLog.ts @@ -6,6 +6,7 @@ export enum EventType { LOGIN_BYPASS_UNAUTHORIZED = 'LOGIN_BYPASS_UNAUTHORIZED', INDICTMENT_CONFIRMED = 'INDICTMENT_CONFIRMED', INDICTMENT_COMPLETED = 'INDICTMENT_COMPLETED', + INDICTMENT_REVIEWED = 'INDICTMENT_REVIEWED', CASE_RECEIVED_BY_COURT = 'CASE_RECEIVED_BY_COURT', INDICTMENT_SENT_TO_PUBLIC_PROSECUTOR = 'INDICTMENT_SENT_TO_PUBLIC_PROSECUTOR', }