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): Indictment overview for prison users #15357

Merged
merged 35 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
478aa31
Started working on indictment overview for prisons
oddsson Jun 26, 2024
4ebdc1a
Add indictment completed event type to event log
oddsson Jun 26, 2024
b2f2253
feat(j-s): FMST sees relevant indictment cases
unakb Jun 26, 2024
644dc0d
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jun 26, 2024
6b9611a
Merge branch 'j-s/indictment_confirmed_event_log' of github.com:islan…
oddsson Jun 26, 2024
594df39
Use event logs for completed indictments
oddsson Jun 26, 2024
b926bde
Allow verdictDisplayedDate in info card
oddsson Jun 26, 2024
7e39315
Merge branch 'main' into j-s/indictment_confirmed_event_log
unakb Jun 26, 2024
b48ac9d
Merge remote-tracking branch 'origin/j-s/indictment_confirmed_event_l…
unakb Jun 26, 2024
8ad9d6f
Add verdictViewDate to ClosedIndictmentInfoCard
oddsson Jun 26, 2024
73e60bc
Merge branch 'main' of github.com:island-is/island.is into j-s/priso…
oddsson Jun 26, 2024
ba3ec92
Show indictmentReviewedDate on closedIndictmentInfoCard
oddsson Jun 26, 2024
ad10589
feat(j-s): Prison cases
unakb Jun 26, 2024
fcbd86a
fix(j-s): cases filter test
unakb Jun 26, 2024
c6ea41a
Merge branch 'main' into j-s/prison-indictments-list
unakb Jun 27, 2024
c29e3a1
Update indictmentCase.spec.ts
unakb Jun 27, 2024
82940c9
Merge branch 'j-s/prison-indictments-list' of https://github.com/isla…
unakb Jun 27, 2024
c494b0a
feat(j-s): return indictment completed date
unakb Jun 27, 2024
5572dcc
Merge branch 'main' into j-s/prison-indictments-list
unakb Jun 27, 2024
cda492e
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jun 27, 2024
af69d7d
Merge branch 'j-s/prison-indictments-list' of github.com:island-is/is…
oddsson Jun 27, 2024
e63d341
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jun 27, 2024
5df98e0
Spesific prison routes
oddsson Jun 27, 2024
20e6ace
Add indictmentReviewer to limited access case
oddsson Jun 27, 2024
946949c
Add footer
oddsson Jun 27, 2024
e789d32
Checkpoint
oddsson Jul 4, 2024
df23682
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jul 4, 2024
3561100
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jul 4, 2024
3c08d98
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jul 5, 2024
ccde05a
Change copy
oddsson Jul 5, 2024
5a9891f
Merge branch 'main' into j-s/prison-indictments
kodiakhq[bot] Jul 5, 2024
b06c954
Fix build
oddsson Jul 5, 2024
202fc4c
Merge branch 'j-s/prison-indictments' of github.com:island-is/island.…
oddsson Jul 5, 2024
d5e1a38
Merge branch 'main' of github.com:island-is/island.is into j-s/prison…
oddsson Jul 8, 2024
00a4766
Fix tests
oddsson Jul 8, 2024
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 @@ -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'

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const attributes: (keyof Case)[] = [
'indictmentHash',
'courtSessionType',
'indictmentReviewDecision',
'indictmentReviewerId',
]

export interface LimitedAccessUpdateCase
Expand Down Expand Up @@ -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' },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import IndictmentOverview from '@island.is/judicial-system-web/src/routes/Prison/IndictmentOverview/IndictmentOverview'
oddsson marked this conversation as resolved.
Show resolved Hide resolved

export default IndictmentOverview
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { SignedVerdictOverview } from '@island.is/judicial-system-web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview'

export default SignedVerdictOverview
3 changes: 3 additions & 0 deletions apps/judicial-system/web/pages/fangelsi/krofur.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import PrisonCases from '@island.is/judicial-system-web/src/routes/Shared/Cases/PrisonCases'

export default PrisonCases
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface Props {
infoBoxText?: string
}

const FormFooter: FC<React.PropsWithChildren<Props>> = ({
const FormFooter: FC<Props> = ({
previousUrl,
previousIsDisabled,
previousButtonText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ query LimitedAccessCase($input: CaseQueryInput!) {
postponedIndefinitelyExplanation
indictmentDecision
indictmentRulingDecision
indictmentCompletedDate
indictmentReviewDecision
indictmentReviewer {
id
name
}
courtSessionType
eventLogs {
id
created
eventType
}
}
}
3 changes: 3 additions & 0 deletions apps/judicial-system/web/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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 = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ interface DefendantInfoProps {
displayDefenderInfo: boolean
displayAppealExpirationInfo?: boolean
defendantInfoActionButton?: DefendantInfoActionButton
displayVerdictViewDate?: boolean
}

export const DefendantInfo: FC<DefendantInfoProps> = ({
defendant,
displayDefenderInfo,
displayAppealExpirationInfo,
defendantInfoActionButton,
}) => {
export const DefendantInfo: FC<DefendantInfoProps> = (props) => {
const {
defendant,
displayDefenderInfo,
displayAppealExpirationInfo,
defendantInfoActionButton,
displayVerdictViewDate,
} = props
const { formatMessage } = useIntl()

const getAppealExpirationInfo = (viewDate?: string) => {
Expand Down Expand Up @@ -76,15 +79,13 @@ export const DefendantInfo: FC<DefendantInfoProps> = ({
{defendant.address && `, ${defendant.address}`}
</Text>
</span>

{displayAppealExpirationInfo && (
<Box>
<Text as="span">
{getAppealExpirationInfo(defendant.verdictViewDate ?? '')}
</Text>
</Box>
)}

{displayDefenderInfo && (
<Box display="flex" key={defendant.defenderName} role="paragraph">
<Text as="span">{`${formatMessage(strings.defender)}: ${
Expand All @@ -106,8 +107,14 @@ export const DefendantInfo: FC<DefendantInfoProps> = ({
)}
</Box>
)}
{displayVerdictViewDate && (
<Text>
{formatMessage(strings.verdictDisplayedDate, {
date: formatDate(defendant.verdictViewDate, 'PPP'),
})}
</Text>
)}
</div>

{defendantInfoActionButton && (
<Box>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface Props {
items: Defendant[]
defendantInfoActionButton?: DefendantInfoActionButton
displayAppealExpirationInfo?: boolean
displayVerdictViewDate?: boolean
}
defenders?: Defender[]
icon?: IconMapIcon
Expand Down Expand Up @@ -130,6 +131,7 @@ const InfoCard: FC<Props> = (props) => {
defendantInfoActionButton={
defendants.defendantInfoActionButton
}
displayVerdictViewDate={defendants.displayVerdictViewDate}
/>
))}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('getAdditionalDataSections', () => {
{
data: [
{ title: 'Yfirlestur', value: 'John Doe' },
{ title: 'Ákvörðun', value: 'Una' },
{ title: 'Ákvörðun', value: 'Una dómi' },
],
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IntlFormatters, useIntl } from 'react-intl'
import { Text } from '@island.is/island-ui/core'
import {
capitalize,
formatDate,
readableIndictmentSubtypes,
} from '@island.is/judicial-system/formatters'
import { core } from '@island.is/judicial-system-web/messages'
Expand All @@ -17,12 +18,15 @@ import { strings } from '../InfoCardIndictment.strings'
export interface Props {
defendantInfoActionButton?: DefendantInfoActionButton
displayAppealExpirationInfo?: boolean
displayVerdictViewDate?: boolean
indictmentReviewedDate?: string | null
}

export const getAdditionalDataSections = (
formatMessage: IntlFormatters['formatMessage'],
reviewerName?: string | null,
reviewDecision?: IndictmentCaseReviewDecision | null,
indictmendReviewedDate?: string | null,
): DataSection[] => [
...(reviewerName
? [
Expand All @@ -43,6 +47,14 @@ export const getAdditionalDataSections = (
},
]
: []),
...(indictmendReviewedDate
? [
{
title: formatMessage(strings.indictmentReviewedDateTitle),
value: formatDate(indictmendReviewedDate, 'PPP'),
},
]
: []),
],
},
]
Expand All @@ -53,7 +65,12 @@ const InfoCardClosedIndictment: FC<Props> = (props) => {
const { workingCase } = useContext(FormContext)
const { formatMessage } = useIntl()

const { defendantInfoActionButton, displayAppealExpirationInfo } = props
const {
defendantInfoActionButton,
displayAppealExpirationInfo,
displayVerdictViewDate,
indictmentReviewedDate,
} = props

return (
<InfoCard
Expand Down Expand Up @@ -117,13 +134,15 @@ const InfoCardClosedIndictment: FC<Props> = (props) => {
items: workingCase.defendants,
defendantInfoActionButton: defendantInfoActionButton,
displayAppealExpirationInfo,
displayVerdictViewDate,
}
: undefined
}
additionalDataSections={getAdditionalDataSections(
formatMessage,
workingCase.indictmentReviewer?.name,
workingCase.indictmentReviewDecision,
indictmentReviewedDate,
)}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,19 @@ export const strings = defineMessages({
description: 'Notaður sem titill á "dómfelldu" hluta af yfirliti ákæru.',
},
reviewTagAppealed: {
id: 'judicial.system.core:info_card_indictment.review_tag_appealed',
defaultMessage: 'Áfrýjun',
id: 'judicial.system.core:info_card_indictment.review_tag_appealed_v1',
defaultMessage: 'Áfrýja dómi',
description:
'Notað sem texti á tagg fyrir "Áfrýjun" tillögu í yfirliti ákæru.',
},
reviewTagAccepted: {
id: 'judicial.system.core:info_card_indictment.review_tag_completed',
defaultMessage: 'Una',
id: 'judicial.system.core:info_card_indictment.review_tag_completed_v1',
defaultMessage: 'Una dómi',
description: 'Notað sem texti á tagg fyrir "Una" tillögu í yfirliti ákæru.',
},
indictmentReviewedDateTitle: {
id: 'judicial.system.core:info_card_indictment.indictment_reviewed_date_title',
defaultMessage: 'Dagsetning áritunar',
description: 'Notaður sem titill á "Dagsetning" hluta af yfirliti ákæru.',
},
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { defineMessages } from 'react-intl'

export const strings = defineMessages({
htmlTitle: {
id: 'judicial.system.core:indictment_overview.html_title',
defaultMessage: 'Yfirlit ákæru - Réttarvörslugátt',
description: 'Titill á yfirliti ákæru',
},
title: {
id: 'judicial.system.core:indictment_overview.title',
defaultMessage: 'Dómur til fullnustu',
description: 'Notaður sem titill á yfirliti ákæru fyrir fangelsi',
},
indictmentCompletedTitle: {
id: 'judicial.system.core:indictment_overview.indictment_completed_title',
defaultMessage: 'Dómsuppkvaðning {date}',
description: 'Titill á yfirliti ákæru fyrir fangelsi',
},
infoCardDefendantsTitle: {
id: 'judicial.system.core:indictment_overview.info_card_defendants_title',
defaultMessage: 'Dómfelld{count, plural, one {i} other {u}}',
description: 'Titill á upplýsingakorti um dómfelldu',
},
verdictTitle: {
id: 'judicial.system.core:indictment_overview.verdict_title',
defaultMessage: 'Dómur',
description: 'Titill á Dómur hluta',
},
})
Loading