From 17f36a07918ccda070d579508498ccb65031d572 Mon Sep 17 00:00:00 2001 From: hfhelgason Date: Wed, 8 Jan 2025 13:58:25 +0000 Subject: [PATCH] feat(new-primary-school): Siblings relation column removal --- .../new-primary-school.service.ts | 62 +------------------ .../fields/Review/review-groups/Siblings.tsx | 12 +--- .../siblingsSubSection.ts | 22 +------ .../new-primary-school/src/lib/dataSchema.ts | 6 +- 4 files changed, 6 insertions(+), 96 deletions(-) diff --git a/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.service.ts b/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.service.ts index ce131be8fb24..1b09ed1bf53b 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.service.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.service.ts @@ -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) @@ -115,7 +55,7 @@ export class NewPrimarySchoolService extends BaseTemplateApiService { '6666666669', ] if ( - isRunningOnEnvironment('local') && + (isRunningOnEnvironment('local') || isRunningOnEnvironment('dev')) && validChildren.includes(child.nationalId) ) { return true diff --git a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Siblings.tsx b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Siblings.tsx index fa7b3317e14b..9cc34dac9db7 100644 --- a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Siblings.tsx +++ b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Siblings.tsx @@ -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 = ({ @@ -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 ( @@ -52,7 +45,6 @@ export const Siblings = ({ header: [ newPrimarySchoolMessages.shared.fullName, newPrimarySchoolMessages.shared.nationalId, - newPrimarySchoolMessages.shared.relation, ], rows, }} diff --git a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts index e03a8d321d78..6a643161b0e3 100644 --- a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts +++ b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts @@ -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', @@ -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, ], }, }), diff --git a/libs/application/templates/new-primary-school/src/lib/dataSchema.ts b/libs/application/templates/new-primary-school/src/lib/dataSchema.ts index 54f61828ba0e..9dcce96ee1cd 100644 --- a/libs/application/templates/new-primary-school/src/lib/dataSchema.ts +++ b/libs/application/templates/new-primary-school/src/lib/dataSchema.ts @@ -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) => { @@ -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, {