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

chore(j-s): Completed case notifications #14832

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
12 changes: 6 additions & 6 deletions apps/judicial-system/backend/src/app/messages/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,22 @@ export const notifications = {
}),
caseCompleted: defineMessages({
subject: {
id: 'judicial.system.backend:notifications.case_completed.subject',
defaultMessage: 'Dómur í máli {courtCaseNumber}',
id: 'judicial.system.backend:notifications.case_completed.subject_v1',
defaultMessage: 'Máli lokið {courtCaseNumber}',
description:
'Notaður sem titill í pósti til hagaðila vegna staðfests dóms',
},
prosecutorBody: {
id: 'judicial.system.backend:notifications.case_completed.prosecutor_body',
id: 'judicial.system.backend:notifications.case_completed.prosecutor_body_v1',
defaultMessage:
'Dómari hefur staðfest dóm í máli {courtCaseNumber} hjá {courtName}.<br /><br />Skjöl málsins eru aðengileg á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}.',
'Máli {courtCaseNumber} hjá {courtName} hefur verið lokið.<br /><br />Niðurstaða: {caseIndictmentRulingDecision}<br /><br />Skjöl málsins eru aðengileg á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}.',
description:
'Notaður sem texti í pósti til sækjanda vegna staðfests dóms',
},
defenderBody: {
id: 'judicial.system.backend:notifications.case_completed.defender_body_v2',
id: 'judicial.system.backend:notifications.case_completed.defender_body_v3',
defaultMessage:
'Dómari hefur staðfest dóm í máli {courtCaseNumber} hjá {courtName}.<br /><br />{defenderHasAccessToRvg, select, false {Þú getur nálgast gögn málsins hjá {courtName} ef þau hafa ekki þegar verið afhent} other {Þú getur nálgast gögn málsins á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}}}.',
'Máli {courtCaseNumber} hjá {courtName} hefur verið lokið.<br /><br />Niðurstaða: {caseIndictmentRulingDecision}<br /><br />{defenderHasAccessToRvg, select, false {Þú getur nálgast gögn málsins hjá {courtName} ef þau hafa ekki þegar verið afhent} other {Þú getur nálgast gögn málsins á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}}}.',
description:
'Notaður sem texti í pósti til verjanda vegna staðfests dóms',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import {
formatDate,
getAppealResultTextByValue,
getHumanReadableCaseIndictmentRulingDecision,
} from '@island.is/judicial-system/formatters'
import {
CaseMessage,
Expand Down Expand Up @@ -963,6 +964,10 @@ export class NotificationService {
? this.formatMessage(notifications.caseCompleted.prosecutorBody, {
courtCaseNumber: theCase.courtCaseNumber,
courtName: theCase.court?.name?.replace('dómur', 'dómi'),
caseIndictmentRulingDecision:
getHumanReadableCaseIndictmentRulingDecision(
theCase.indictmentRulingDecision,
),
linkStart: `<a href="${this.config.clientUrl}${CLOSED_INDICTMENT_OVERVIEW_ROUTE}/${theCase.id}">`,
linkEnd: '</a>',
})
Expand Down Expand Up @@ -997,6 +1002,10 @@ export class NotificationService {
? this.formatMessage(notifications.caseCompleted.defenderBody, {
courtCaseNumber: theCase.courtCaseNumber,
courtName: theCase.court?.name?.replace('dómur', 'dómi'),
caseIndictmentRulingDecision:
getHumanReadableCaseIndictmentRulingDecision(
theCase.indictmentRulingDecision,
),
defenderHasAccessToRvg: Boolean(defenderNationalId),
linkStart: `<a href="${formatDefenderRoute(
this.config.clientUrl,
Expand Down
14 changes: 14 additions & 0 deletions libs/judicial-system/formatters/src/lib/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CaseAppealDecision,
CaseAppealRulingDecision,
CaseCustodyRestrictions,
CaseIndictmentRulingDecision,
CaseType,
Gender,
IndictmentSubtype,
Expand Down Expand Up @@ -99,6 +100,19 @@ export const laws = {
_100_1: '1. mgr. 100. gr. sml.',
}

export const getHumanReadableCaseIndictmentRulingDecision = (
rulingDecision?: CaseIndictmentRulingDecision,
) => {
switch (rulingDecision) {
case CaseIndictmentRulingDecision.FINE:
return 'Viðurlagaákvæði'
case CaseIndictmentRulingDecision.RULING:
return 'Dómur'
default:
return 'Ekki skráð'
}
}

type CaseTypes = { [c in CaseType]: string }
const caseTypes: CaseTypes = {
// Indicitment cases
Expand Down
Loading