Skip to content

Commit

Permalink
Merge branch 'main' into j-s/update-punishment-type-prison-indictment…
Browse files Browse the repository at this point in the history
…-overview
  • Loading branch information
kodiakhq[bot] authored Dec 16, 2024
2 parents 00d4c02 + 65767dc commit 33f5477
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ export const yearSelectContainer = style({
md: { width: '204px' },
}),
})

export const noWrap = style({
flexWrap: 'nowrap',
})
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
GET_ORGANIZATION_PAGE_QUERY,
GET_ORGANIZATION_QUERY,
} from '../../queries'
import { PensionCalculatorTitle } from './PensionCalculatorTitle'
import { PensionCalculatorWrapper } from './PensionCalculatorWrapper'
import { translationStrings } from './translationStrings'
import {
Expand Down Expand Up @@ -554,16 +555,12 @@ const PensionCalculator: CustomScreen<PensionCalculatorProps> = ({
>
<Box paddingY={5}>
<Stack space={3}>
{isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} <div>{titlePostfix}</div>
</Text>
)}
{!isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} {titlePostfix}
</Text>
)}
<PensionCalculatorTitle
isNewSystemActive={isNewSystemActive}
title={title}
titlePostfix={titlePostfix}
titleVariant={titleVariant}
/>
<Text>{formatMessage(translationStrings.isTurnedOff)}</Text>
</Stack>
</Box>
Expand All @@ -584,16 +581,12 @@ const PensionCalculator: CustomScreen<PensionCalculatorProps> = ({
<Stack space={3}>
<Stack space={3}>
<Box paddingTop={6}>
{isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} <div>{titlePostfix}</div>
</Text>
)}
{!isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} {titlePostfix}
</Text>
)}
<PensionCalculatorTitle
isNewSystemActive={isNewSystemActive}
title={title}
titlePostfix={titlePostfix}
titleVariant={titleVariant}
/>
</Box>
</Stack>
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
GET_ORGANIZATION_QUERY,
} from '../../queries'
import { GET_PENSION_CALCULATION } from '../../queries/PensionCalculator'
import { PensionCalculatorTitle } from './PensionCalculatorTitle'
import { PensionCalculatorWrapper } from './PensionCalculatorWrapper'
import { translationStrings } from './translationStrings'
import {
Expand Down Expand Up @@ -361,16 +362,12 @@ const PensionCalculatorResults: CustomScreen<PensionCalculatorResultsProps> = ({
>
<Box paddingY={5}>
<Stack space={3}>
{isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} <div>{titlePostfix}</div>
</Text>
)}
{!isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} {titlePostfix}
</Text>
)}
<PensionCalculatorTitle
isNewSystemActive={isNewSystemActive}
title={title}
titlePostfix={titlePostfix}
titleVariant={titleVariant}
/>
<Text>
{formatMessage(translationStrings.isTurnedOff)}
</Text>
Expand All @@ -391,16 +388,12 @@ const PensionCalculatorResults: CustomScreen<PensionCalculatorResultsProps> = ({
<Box paddingY={6}>
<Stack space={5}>
<Stack space={2}>
{isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} <div>{titlePostfix}</div>
</Text>
)}
{!isNewSystemActive && (
<Text variant={titleVariant} as="h1">
{title} {titlePostfix}
</Text>
)}
<PensionCalculatorTitle
isNewSystemActive={isNewSystemActive}
title={title}
titlePostfix={titlePostfix}
titleVariant={titleVariant}
/>
<Box className={styles.textMaxWidth}>
<Text>
{formatMessage(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { useIntl } from 'react-intl'

import { GridColumn, GridRow, Text } from '@island.is/island-ui/core'

import { translationStrings } from './translationStrings'
import * as styles from './PensionCalculator.css'

interface PensionCalculatorTitleProps {
isNewSystemActive: boolean
title: string
titlePostfix: string
titleVariant: 'h1' | 'h2'
}

export const PensionCalculatorTitle = ({
isNewSystemActive,
title,
titlePostfix,
titleVariant,
}: PensionCalculatorTitleProps) => {
const { formatMessage } = useIntl()
if (isNewSystemActive)
return (
<GridRow rowGap={3} className={styles.noWrap}>
<GridColumn hiddenBelow="lg">
<img
width={84}
height={70}
src={formatMessage(translationStrings.after1stSeptember2025IconUrl)}
alt=""
/>
</GridColumn>
<GridColumn>
<Text variant={titleVariant} as="h1">
{title} <div>{titlePostfix}</div>
</Text>
</GridColumn>
</GridRow>
)
return (
<Text variant={titleVariant} as="h1">
{title} {titlePostfix}
</Text>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,13 @@ export const translationStrings = defineMessages({
defaultMessage: 'Eftir 1. september 2025',
description: 'Eftir 1. september 2025',
},
after1stSeptember2025IconUrl: {
id: 'web.pensionCalculator:after1stSeptember2025IconUrl',
defaultMessage:
'https://images.ctfassets.net/8k0h54kbe6bj/5RIwKVet87Nm4ycltkzjnX/9c594855a9b2f90dde63766ee87a09ca/58dd40fbf365769d984be22a9b64bc29.png',
description:
'Mynd vinstra megin við titil "Reiknivél örorku- og endurhæfingargreiðslna eftir 1. september 2025"',
},
after1stSeptember2025Calculate: {
id: 'web.pensionCalculator:after1stSeptember2025Calculate',
defaultMessage: 'Reikna',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TemplateApiModuleActionProps } from '../../../types'
import { BaseTemplateApiService } from '../../base-template-api.service'
import { transformApplicationToNewPrimarySchoolDTO } from './new-primary-school.utils'
import { isRunningOnEnvironment } from '@island.is/shared/utils'
import { isRunningInProduction } from '../parental-leave/constants'

@Injectable()
export class NewPrimarySchoolService extends BaseTemplateApiService {
Expand All @@ -38,6 +39,66 @@ export class NewPrimarySchoolService extends BaseTemplateApiService {
}

async getChildren({ auth }: TemplateApiModuleActionProps) {
if (!isRunningInProduction) {
if (auth.nationalId === '0101303019') {
return [
{
nationalId: '1111111119',
fullName: 'Stubbur Maack',
genderCode: '3',
livesWithApplicant: true,
livesWithBothParents: true,
},
]
}
if (auth.nationalId === '0101302989') {
return [
{
nationalId: '2222222229',
fullName: 'Stúfur Maack ',
genderCode: '3',
livesWithApplicant: true,
livesWithBothParents: true,
otherParent: {
nationalId: '0101302399',
fullName: 'Gervimaður Færeyjar',
address: {
streetName: 'Hvassaleiti 5',
postalCode: '103',
city: 'Reykjavík',
municipalityCode: '0000',
},
genderCode: '2',
},
},
{
nationalId: '5555555559',
fullName: 'Bína Maack ',
genderCode: '4',
livesWithApplicant: true,
livesWithBothParents: true,
},
{
nationalId: '6666666669',
fullName: 'Snúður Maack',
genderCode: '3',
livesWithApplicant: true,
livesWithBothParents: true,
},
]
}
if (auth.nationalId === '0101304929') {
return [
{
nationalId: '6666666669',
fullName: 'Snúður Maack',
genderCode: '3',
livesWithApplicant: true,
livesWithBothParents: true,
},
]
}
}
const children =
await this.nationalRegistryService.getChildrenCustodyInformation(auth)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,6 @@ export const Review: FC<ReviewScreenProps> = ({
</Box>
</Box>
<Box display="flex" columnGap={2} alignItems="center">
{state === `${States.TRYGGINGASTOFNUN_SUBMITTED}` && (
<Button
colorScheme="default"
iconType="filled"
size="small"
type="button"
variant="text"
icon="pencil"
loading={loadingSubmit}
disabled={loadingSubmit}
onClick={() => handleSubmit('EDIT')}
>
{formatMessage(incomePlanFormMessage.confirm.buttonEdit)}
</Button>
)}
<Button
variant="utility"
icon="print"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,6 @@ describe('Income Plan Template', () => {
})
})

describe('state transitions', () => {
it('should transition from tryggingastofnunSubmitted to draft on edit', () => {
const helper = new ApplicationTemplateHelper(
buildApplication({
state: 'tryggingastofnunSubmitted',
}),
IncomePlanTemplate,
)

const [hasChanged, newState] = helper.changeState({
type: DefaultEvents.EDIT,
})
expect(hasChanged).toBe(true)
expect(newState).toBe('draft')
})
})

describe('Income plan table', () => {
describe('equalForeignIncomePerMonth', () => {
it('should unset equalForeignIncomePerMonth if income is MONTHLY and unevenIncomePerYear is YES', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ const IncomePlanTemplate: ApplicationTemplate<
import('../forms/InReview').then((val) =>
Promise.resolve(val.InReview),
),
actions: [
{
event: DefaultEvents.EDIT,
name: incomePlanFormMessage.confirm.buttonEdit,
type: 'primary',
},
],
read: 'all',
write: 'all',
},
Expand All @@ -223,7 +216,6 @@ const IncomePlanTemplate: ApplicationTemplate<
],
},
on: {
[DefaultEvents.EDIT]: { target: States.DRAFT },
INREVIEW: {
target: States.TRYGGINGASTOFNUN_IN_REVIEW,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@ export const incomePlanFormMessage: MessageDir = {
'Vinsamlegast farðu yfir tekjuáætlunina áður en þú sendir hana inn.',
description: 'Please review the application before submitting.',
},
buttonEdit: {
id: 'ip.application:button.edit',
defaultMessage: 'Breyta tekjuáætlun',
description: 'Edit application',
},
}),

conclusionScreen: defineMessages({
Expand Down Expand Up @@ -336,10 +331,8 @@ export const statesMessages = defineMessages({
},
tryggingastofnunSubmittedContent: {
id: 'ip.application:tryggingastofnunSubmittedContent',
defaultMessage:
'Tekjuáætlunin þín er í bið eftir yfirferð. Hægt er að breyta tekjuáætlun þar til hún er komin í yfirferð.',
description:
'Your income plan is awaiting review. It is possible to edit the income plan until it is under review.',
defaultMessage: 'Tekjuáætlunin þín er í bið eftir yfirferð.',
description: 'Your income plan is awaiting review.',
},
incomePlanEdited: {
id: 'ip.application:incomePlanEdited',
Expand Down

0 comments on commit 33f5477

Please sign in to comment.