Skip to content

Commit

Permalink
✨ fnr på manuelle barn i test slik at vi kan koble de mot pdl
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbjoern committed Jul 5, 2024
1 parent 8c46575 commit dff7baf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .nais/dev-gcp.env
Original file line number Diff line number Diff line change
Expand Up @@ -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"

28 changes: 26 additions & 2 deletions components/pageComponents/standard/Barnetillegg/AddBarnModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,6 +44,7 @@ export interface CreateOrUpdateManuelleBarn {
navn?: Navn;
fødseldato?: Date;
relasjon?: Relasjon;
fnr?: string;
}

const ALDER_BARN_ÅR = 18;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -202,6 +213,19 @@ export const AddBarnModal = ({
}}
/>

{erKelvinSoknad() && (
<TextField
label="FNR"
name={'fnr'}
id="fnr"
value={barn?.fnr}
onChange={(event) => {
clearErrors();
setBarn({ ...barn, fnr: event.target.value });
}}
/>
)}

<RadioGroup
legend={formatMessage({ id: 'søknad.barnetillegg.leggTilBarn.modal.relasjon.label' })}
name={'relasjon'}
Expand Down
1 change: 1 addition & 0 deletions types/Soknad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export type ManuelleBarn = {
fødseldato: Date;
relasjon: Relasjon;
vedlegg?: Vedlegg[];
fnr?: string;
};

export type Ferie = {
Expand Down
2 changes: 2 additions & 0 deletions utils/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export const isDev = () => 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';

0 comments on commit dff7baf

Please sign in to comment.