Skip to content

Commit

Permalink
Merge branch 'main' into j-s/public-defender-reviewed-case
Browse files Browse the repository at this point in the history
  • Loading branch information
unakb authored May 21, 2024
2 parents 9b53f42 + 0ff63ca commit 2e62d05
Show file tree
Hide file tree
Showing 27 changed files with 823 additions and 317 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Allow } from 'class-validator'

import { Field, InputType } from '@nestjs/graphql'
import type { Aid } from '@island.is/financial-aid/shared/lib'
import type { Aid, ChildrenAid } from '@island.is/financial-aid/shared/lib'
import { AidInput } from '../../aid'

@InputType()
Expand Down Expand Up @@ -42,6 +42,10 @@ export class UpdateMunicipalityInput {
@Field({ nullable: true })
readonly navPassword?: string

@Allow()
@Field(() => String, { nullable: true })
readonly childrenAid?: ChildrenAid

@Allow()
@Field()
readonly municipalityId!: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Field, ObjectType, ID } from '@nestjs/graphql'

import { Municipality } from '@island.is/financial-aid/shared/lib'
import { ChildrenAid, Municipality } from '@island.is/financial-aid/shared/lib'

import { AidModel } from '../../aid'
import { StaffModel } from '../../staff/models'
Expand Down Expand Up @@ -54,4 +54,7 @@ export class MunicipalityModel implements Municipality {

@Field({ nullable: true })
readonly navPassword?: string

@Field(() => String)
readonly childrenAid!: ChildrenAid
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict'

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.addColumn(
'municipality',
'children_aid',
{
type: Sequelize.ENUM('NotDefined', 'Institution', 'Applicant'),
allowNull: false,
defaultValue: 'NotDefined',
},
{ transaction: t },
),
]),
)
},

down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.removeColumn('municipality', 'children_aid', {
transaction: t,
}),
]),
)
},
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IsBoolean, IsObject, IsOptional, IsString } from 'class-validator'

import { ApiProperty } from '@nestjs/swagger'
import type { Aid } from '@island.is/financial-aid/shared/lib'
import type { Aid, ChildrenAid } from '@island.is/financial-aid/shared/lib'

export class UpdateMunicipalityDto {
@IsOptional()
Expand Down Expand Up @@ -49,6 +49,11 @@ export class UpdateMunicipalityDto {
@ApiProperty()
navPassword?: string

@IsOptional()
@IsString()
@ApiProperty()
childrenAid?: ChildrenAid

@IsString()
@ApiProperty()
readonly municipalityId: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

import { ApiProperty } from '@nestjs/swagger'

import { Municipality } from '@island.is/financial-aid/shared/lib'
import { ChildrenAid, Municipality } from '@island.is/financial-aid/shared/lib'

import { AidModel } from '../../aid/models'
@Table({
Expand Down Expand Up @@ -132,4 +132,12 @@ export class MunicipalityModel extends Model<Municipality> {
})
@ApiProperty()
navPassword?: string

@Column({
type: DataType.ENUM,
allowNull: false,
values: Object.values(ChildrenAid),
})
@ApiProperty({ enum: ChildrenAid })
childrenAid: ChildrenAid
}
1 change: 1 addition & 0 deletions apps/financial-aid/web-veita/graphql/sharedGql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ export const UpdateMunicipalityMutation = gql`
navUrl
navUsername
navPassword
childrenAid
individualAid {
ownPlace
registeredRenting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import {
Button,
ToastContainer,
Checkbox,
RadioButton,
} from '@island.is/island-ui/core'

import {
Aid,
AidName,
ApiKeysForMunicipality,
ChildrenAid,
Municipality,
scrollToId,
} from '@island.is/financial-aid/shared/lib'
Expand Down Expand Up @@ -379,6 +381,50 @@ const MunicipalityAdminSettings = ({ currentMunicipality }: Props) => {
)
})}

<Box marginBottom={[2, 2, 7]} id="childrenAid" className={`contentUp`}>
<Text as="h3" variant="h3" marginBottom={[2, 2, 3]} color="dark300">
Börn
</Text>
<Box
display="flex"
alignItems="center"
width="full"
columnGap={3}
rowGap={3}
flexWrap={'wrap'}
>
<Box flexGrow={1}>
<RadioButton
name="children-aid-institution"
label="Styrkur greiddur til stofnunar"
value={ChildrenAid.INSTITUTION}
checked={state.childrenAid === ChildrenAid.INSTITUTION}
onChange={() => {
setState({ ...state, childrenAid: ChildrenAid.INSTITUTION })
}}
backgroundColor="blue"
large
/>
</Box>
<Box flexGrow={1}>
<RadioButton
name="children-aid-applicant"
label="Styrkur greiddur til umsækjanda"
value={ChildrenAid.APPLICANT}
checked={state.childrenAid === ChildrenAid.APPLICANT}
onChange={() => {
setState({
...state,
childrenAid: ChildrenAid.APPLICANT,
})
}}
backgroundColor="blue"
large
/>
</Box>
</Box>
</Box>

<Box display="flex" justifyContent="flexEnd">
<Button loading={loading} onClick={submit} icon="checkmark">
Vista stillingar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const useCurrentMunicipalityState = ({ municipality }: Props) => {
: state.navUrl,
navUsername: state.navUsername,
navPassword: state.navPassword,
childrenAid: state.childrenAid,
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const MunicipalityQuery = gql`
navUrl
navUsername
navPassword
childrenAid
individualAid {
ownPlace
registeredRenting
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ describe('InternalNotificationController - Send ruling notifications', () => {
expect(mockEmailService.sendEmail).toHaveBeenCalledWith(
expect.objectContaining({
to: [{ name: prosecutor.name, address: prosecutor.email }],
subject: 'Dómur í máli 007-2022-07',
html: `Dómari hefur staðfest dóm í máli 007-2022-07 hjá Héraðsdómi Reykjavíkur.<br /><br />Skjöl málsins eru aðengileg á ${expectedLink}yfirlitssíðu málsins í Réttarvörslugátt</a>.`,
subject: 'Máli lokið 007-2022-07',
html: `Máli 007-2022-07 hjá Héraðsdómi Reykjavíkur hefur verið lokið.<br /><br />Niðurstaða: Ekki skráð<br /><br />Skjöl málsins eru aðengileg á ${expectedLink}yfirlitssíðu málsins í Réttarvörslugátt</a>.`,
}),
)
})
Expand Down
14 changes: 14 additions & 0 deletions apps/native/app/src/hooks/use-translate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useIntl } from 'react-intl'
import { TranslatedMessage } from '../messages'

/**
* Helper hook to simplify translations in the app.
*/
export const useTranslate = () => {
const intl = useIntl()

return (key: TranslatedMessage) =>
intl.formatMessage({
id: key,
})
}
11 changes: 11 additions & 0 deletions apps/native/app/src/messages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,4 +504,15 @@ export const en: TranslatedMessages = {
// offline
'offline.title': 'No internet connection',
'offline.message': 'Information has not been updated.',

// problem
'problem.error.tag': 'Error',
'problem.error.title': 'Service is temporarily down',
'problem.error.message': 'Please try again later',
'problem.noData.title': 'No data',
'problem.noData.message':
'If you believe you have data that should appear here, please contact service provider.',
'problem.offline.title': 'No internet connection',
'problem.offline.message':
'An error occurred while communicating with the service provider',
}
12 changes: 11 additions & 1 deletion apps/native/app/src/messages/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,17 @@ export const is = {
'airDiscount.emptyListDescription':
'Einungis íbúar landsbyggðarinnar sem eiga lögheimili fjarri höfuðborgarsvæðinu og eyjum eiga rétt á Loftbrú.',

// Offline
// offline
'offline.title': 'Ekkert netsamband',
'offline.message': 'Upplýsingar hafa ekki verið uppfærðar.',

// problems
'problem.error.tag': 'Villa',
'problem.error.title': 'Þjónusta liggur tímabundið niðri',
'problem.error.message': 'Vinsamlegast reyndu aftur síðar',
'problem.noData.title': 'Engin gögn',
'problem.noData.message':
'Ef þú telur þig eiga gögn sem ættu að birtast hér, vinsamlegast hafðu samband við þjónustuaðila.',
'problem.offline.title': 'Samband næst ekki',
'problem.offline.message': 'Villa kom upp í samskiptum við þjónustuaðila',
}
11 changes: 5 additions & 6 deletions apps/native/app/src/screens/document-detail/document-detail.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useApolloClient, useFragment_experimental } from '@apollo/client'
import { blue400, dynamicColor, Header, Loader, Typography } from '@ui'
import { blue400, dynamicColor, Header, Loader } from '@ui'
import { Problem } from '@ui/lib/problem/problem'
import React, { useEffect, useRef, useState } from 'react'
import { FormattedDate, useIntl } from 'react-intl'
import { Animated, Platform, StyleSheet, View } from 'react-native'
Expand Down Expand Up @@ -382,16 +383,14 @@ export const DocumentDetailScreen: NavigationFunctionComponent<{
style={[
StyleSheet.absoluteFill,
{
alignItems: 'center',
justifyContent: 'center',
maxHeight: 300,

maxHeight: 500,
},
]}
>
{error ? (
<Typography>
{intl.formatMessage({ id: 'licenseScanDetail.errorUnknown' })}
</Typography>
<Problem type="error" withContainer />
) : (
<Loader
text={intl.formatMessage({ id: 'documentDetail.loadingText' })}
Expand Down
Loading

0 comments on commit 2e62d05

Please sign in to comment.