From dff7baf8170c9b3c0a842487c004c99678b17d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halvor=20Grizzly=20Bj=C3=B8rn?= Date: Fri, 5 Jul 2024 13:02:44 +0200 Subject: [PATCH] =?UTF-8?q?:sparkles:=20fnr=20p=C3=A5=20manuelle=20barn=20?= =?UTF-8?q?i=20test=20slik=20at=20vi=20kan=20koble=20de=20mot=20pdl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .nais/dev-gcp.env | 2 ++ .../standard/Barnetillegg/AddBarnModal.tsx | 28 +++++++++++++++++-- types/Soknad.ts | 1 + utils/environments.ts | 2 ++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.nais/dev-gcp.env b/.nais/dev-gcp.env index 8451e23d..9c7129fe 100644 --- a/.nais/dev-gcp.env +++ b/.nais/dev-gcp.env @@ -14,3 +14,5 @@ INNSENDING_AUDIENCE="dev-gcp:aap:innsending" NEXT_PUBLIC_FARO_URL="https://telemetry.ekstern.dev.nav.no/collect" +NEXT_PUBLIC_KELVIN_SOKNAD="enabled" + diff --git a/components/pageComponents/standard/Barnetillegg/AddBarnModal.tsx b/components/pageComponents/standard/Barnetillegg/AddBarnModal.tsx index 4b752d26..5f2b4821 100644 --- a/components/pageComponents/standard/Barnetillegg/AddBarnModal.tsx +++ b/components/pageComponents/standard/Barnetillegg/AddBarnModal.tsx @@ -22,6 +22,7 @@ import { IntlFormatters, useIntl } from 'react-intl'; import { mapValidationErrorToSøknadValidationError } from 'lib/utils/validationUtils'; import { useFormErrors } from 'hooks/FormErrorHook'; import { v4 as uuid4 } from 'uuid'; +import { erKelvinSoknad } from 'utils/environments'; interface Props { søknad?: Soknad; @@ -43,6 +44,7 @@ export interface CreateOrUpdateManuelleBarn { navn?: Navn; fødseldato?: Date; relasjon?: Relasjon; + fnr?: string; } const ALDER_BARN_ÅR = 18; @@ -82,6 +84,7 @@ export const getAddBarnSchema = (formatMessage: IntlFormatters['formatMessage']) id: 'søknad.barnetillegg.leggTilBarn.modal.fødselsdato.validation.typeError', }), ), + fnr: yup.string().nullable(), relasjon: yup .string() .required( @@ -147,9 +150,17 @@ export const AddBarnModal = ({ }); if (result?.internId !== undefined) { - updateManuelleBarn({ ...result, internId: result.internId }); + updateManuelleBarn({ + ...result, + internId: result.internId, + fnr: result.fnr ?? undefined, + }); } else { - appendManuelleBarn({ ...result, internId: uuid4() }); + appendManuelleBarn({ + ...result, + internId: uuid4(), + fnr: result.fnr ?? undefined, + }); } clearErrors(); onCloseClick(); @@ -202,6 +213,19 @@ export const AddBarnModal = ({ }} /> + {erKelvinSoknad() && ( + { + clearErrors(); + setBarn({ ...barn, fnr: event.target.value }); + }} + /> + )} + process.env.RUNTIME_ENVIRONMENT === 'dev'; export const clientSideIsProd = () => typeof window !== 'undefined' && window.location.href.includes('www.nav.no'); + +export const erKelvinSoknad = () => process.env.NEXT_PUBLIC_KELVIN_SOKNAD === 'enabled';