Skip to content

Commit

Permalink
feat(new-primary-school): Siblings relation column removal
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhelgason committed Jan 8, 2025
1 parent 50422b0 commit 17f36a0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,66 +38,6 @@ export class NewPrimarySchoolService extends BaseTemplateApiService {
}

async getChildren({ auth }: TemplateApiModuleActionProps) {
if (isRunningOnEnvironment('dev')) {
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 All @@ -115,7 +55,7 @@ export class NewPrimarySchoolService extends BaseTemplateApiService {
'6666666669',
]
if (
isRunningOnEnvironment('local') &&
(isRunningOnEnvironment('local') || isRunningOnEnvironment('dev')) &&
validChildren.includes(child.nationalId)
) {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { Box, GridColumn, GridRow } from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { format as formatKennitala } from 'kennitala'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import {
getApplicationAnswers,
getSiblingRelationOptionLabel,
} from '../../../lib/newPrimarySchoolUtils'
import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils'
import { ReviewGroupProps } from './props'

export const Siblings = ({
Expand All @@ -20,11 +17,7 @@ export const Siblings = ({
const { siblings } = getApplicationAnswers(application.answers)

const rows = siblings.map((s) => {
return [
s.fullName,
formatKennitala(s.nationalId),
getSiblingRelationOptionLabel(s.relation),
]
return [s.fullName, formatKennitala(s.nationalId)]
})

return (
Expand Down Expand Up @@ -52,7 +45,6 @@ export const Siblings = ({
header: [
newPrimarySchoolMessages.shared.fullName,
newPrimarySchoolMessages.shared.nationalId,
newPrimarySchoolMessages.shared.relation,
],
rows,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@ import {
buildTableRepeaterField,
} from '@island.is/application/core'
import { format as formatKennitala } from 'kennitala'
import {
ReasonForApplicationOptions,
SiblingRelationOptions,
} from '../../../lib/constants'
import { ReasonForApplicationOptions } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import {
getApplicationAnswers,
getSiblingRelationOptionLabel,
getSiblingRelationOptions,
} from '../../../lib/newPrimarySchoolUtils'
import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils'

export const siblingsSubSection = buildSubSection({
id: 'siblingsSubSection',
Expand Down Expand Up @@ -60,25 +53,14 @@ export const siblingsSubSection = buildSubSection({
placeholder: '000000-0000',
dataTestId: 'sibling-national-id',
},
relation: {
component: 'select',
label: newPrimarySchoolMessages.shared.relation,
placeholder: newPrimarySchoolMessages.shared.relationPlaceholder,
// TODO: Nota gögn fá Júní
options: getSiblingRelationOptions(),
dataTestId: 'sibling-relation',
},
},
table: {
format: {
nationalId: (value) => formatKennitala(value),
relation: (value) =>
getSiblingRelationOptionLabel(value as SiblingRelationOptions),
},
header: [
newPrimarySchoolMessages.shared.fullName,
newPrimarySchoolMessages.shared.nationalId,
newPrimarySchoolMessages.shared.relation,
],
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { NO, YES } from '@island.is/application/types'
import * as kennitala from 'kennitala'
import { parsePhoneNumberFromString } from 'libphonenumber-js'
import { z } from 'zod'
import {
ReasonForApplicationOptions,
SiblingRelationOptions,
} from './constants'
import { ReasonForApplicationOptions } from './constants'
import { errorMessages } from './messages'

const validatePhoneNumber = (value: string) => {
Expand Down Expand Up @@ -131,7 +128,6 @@ export const dataSchema = z.object({
nationalId: z.string().refine((n) => kennitala.isValid(n), {
params: errorMessages.nationalId,
}),
relation: z.nativeEnum(SiblingRelationOptions),
}),
)
.refine((r) => r === undefined || r.length > 0, {
Expand Down

0 comments on commit 17f36a0

Please sign in to comment.