Skip to content

Commit d669c41

Browse files
committed
Nav-ansatt-kategori steg 1
1 parent 0e00547 commit d669c41

File tree

6 files changed

+188
-46
lines changed

6 files changed

+188
-46
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import * as React from 'react'
2+
import type { SVGProps } from 'react'
3+
import { Ref, forwardRef } from 'react'
4+
interface SVGRProps {
5+
title?: string
6+
titleId?: string
7+
}
8+
const NavLogo = forwardRef(
9+
(
10+
{ title, titleId: _titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps,
11+
ref: Ref<SVGSVGElement>,
12+
) => {
13+
const titleId = 'title-nav-logo'
14+
return (
15+
<svg
16+
xmlns="http://www.w3.org/2000/svg"
17+
width="1em"
18+
height="1em"
19+
fill="none"
20+
viewBox="0 0 64 64"
21+
preserveAspectRatio="xMidYMid meet"
22+
focusable={false}
23+
role="img"
24+
ref={ref}
25+
aria-labelledby={titleId}
26+
{...props}
27+
>
28+
{title ? <title id={titleId}>{title}</title> : null}
29+
<g transform="translate(0, 22)">
30+
<path
31+
fill="currentColor"
32+
fillRule="evenodd"
33+
d="M63.4793 0.520905H56.8203C56.8203 0.520905 56.3613 0.520905 56.199 0.926432L52.5139 12.2133L48.8318 0.926432C48.6695 0.520905 48.2079 0.520905 48.2079 0.520905H35.4043C35.1271 0.520905 34.8948 0.752508 34.8948 1.02804V4.86102C34.8948 1.82046 31.6611 0.520905 29.7675 0.520905C25.5271 0.520905 22.6886 3.31523 21.8047 7.5635C21.7568 4.74522 21.5227 3.7354 20.7639 2.70117C20.4154 2.19448 19.9116 1.76854 19.3631 1.41626C18.2336 0.754282 17.2194 0.520905 15.0398 0.520905H12.4806C12.4806 0.520905 12.018 0.520905 11.8548 0.926432L9.52624 6.70009V1.02804C9.52624 0.752508 9.29564 0.520905 9.01892 0.520905H3.09697C3.09697 0.520905 2.63976 0.520905 2.47346 0.926432L0.0526208 6.92992C0.0526208 6.92992 -0.189065 7.53023 0.363486 7.53023H2.63976V18.9702C2.63976 19.2541 2.86327 19.4791 3.14841 19.4791H9.01892C9.29564 19.4791 9.52624 19.2541 9.52624 18.9702V7.53023H11.8145C13.1276 7.53023 13.4056 7.56616 13.9165 7.80442C14.2242 7.92067 14.5014 8.15582 14.6526 8.42691C14.9622 9.00991 15.0398 9.71005 15.0398 11.7745V18.9702C15.0398 19.2541 15.2677 19.4791 15.5493 19.4791H21.1759C21.1759 19.4791 21.8118 19.4791 22.0633 18.8508L23.3103 15.7672C24.9684 18.0908 27.6974 19.4791 31.089 19.4791H31.83C31.83 19.4791 32.4699 19.4791 32.7231 18.8508L34.8948 13.4698V18.9702C34.8948 19.2541 35.1271 19.4791 35.4043 19.4791H41.148C41.148 19.4791 41.7817 19.4791 42.0362 18.8508C42.0362 18.8508 44.3334 13.1446 44.3422 13.1016H44.3458C44.434 12.6268 43.8345 12.6268 43.8345 12.6268H41.7844V2.8356L48.2345 18.8508C48.4864 19.4791 49.1214 19.4791 49.1214 19.4791H55.9068C55.9068 19.4791 56.5453 19.4791 56.7972 18.8508L63.948 1.13496C64.1955 0.520905 63.4793 0.520905 63.4793 0.520905ZM34.8941 12.6268H31.036C29.5003 12.6268 28.251 11.3827 28.251 9.84442C28.251 8.30883 29.5003 7.05675 31.036 7.05675H32.1149C33.6466 7.05675 34.8941 8.30883 34.8941 9.84442V12.6268Z"
34+
clipRule="evenodd"
35+
/>
36+
</g>
37+
</svg>
38+
)
39+
},
40+
)
41+
export default NavLogo
Lines changed: 7 additions & 7 deletions
Loading

apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/Steg1Person.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { PensjonPanel } from '@/components/bestillingsveileder/stegVelger/steg/s
2121
import { ArbeidssoekerPanel } from '@/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Arbeidssoeker'
2222
import { MedlPanel } from '@/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Medl'
2323
import { useFormContext } from 'react-hook-form'
24+
import { NavAnsattPanel } from '@/components/bestillingsveileder/stegVelger/steg/steg1/paneler/NavAnsatt'
2425

2526
export const identFraTestnorge = (opts: any) => {
2627
if (opts?.is?.importTestnorge) {
@@ -53,6 +54,7 @@ export const Steg1Person = ({ stateModifier }: any) => {
5354
UdiPanel,
5455
DokarkivPanel,
5556
PensjonPanel,
57+
NavAnsattPanel,
5658
]
5759
.map((panel) => ({
5860
label: panel.heading,
@@ -71,10 +73,9 @@ export const Steg1Person = ({ stateModifier }: any) => {
7173
<AdressePanel stateModifier={stateModifier} formValues={formValues} />
7274
<FamilierelasjonPanel stateModifier={stateModifier} formValues={formValues} />
7375
<IdentifikasjonPanel stateModifier={stateModifier} formValues={formValues} />
76+
<NavAnsattPanel stateModifier={stateModifier} formValues={formValues} />
7477
{!testnorgeIdent && (
75-
<>
76-
<KontaktDoedsboPanel stateModifier={stateModifier} formValues={formValues} />
77-
</>
78+
<KontaktDoedsboPanel stateModifier={stateModifier} formValues={formValues} />
7879
)}
7980
<ArbeidInntektPanel stateModifier={stateModifier} formValues={formValues} />
8081
<ArbeidssoekerPanel stateModifier={stateModifier} formValues={formValues} />
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import { useFormContext } from 'react-hook-form'
2+
import React, { useContext } from 'react'
3+
import {
4+
BestillingsveilederContext,
5+
BestillingsveilederContextType,
6+
} from '@/components/bestillingsveileder/BestillingsveilederContext'
7+
import { useGruppeIdenter } from '@/utils/hooks/useGruppe'
8+
import Panel from '@/components/ui/panel/Panel'
9+
import { harValgtAttributt } from '@/components/ui/form/formUtils'
10+
import {
11+
Attributt,
12+
AttributtKategori,
13+
} from '@/components/bestillingsveileder/stegVelger/steg/steg1/Attributt'
14+
import * as _ from 'lodash-es'
15+
16+
export const NavAnsattPanel = ({ stateModifier, formValues }) => {
17+
const formMethods = useFormContext()
18+
const sm = stateModifier(NavAnsattPanel.initialValues)
19+
const opts = useContext(BestillingsveilederContext) as BestillingsveilederContextType
20+
const formGruppeId = formMethods.watch('gruppeId')
21+
22+
const gruppeId = formGruppeId || opts?.gruppeId || opts?.gruppe?.id
23+
const { identer, loading: gruppeLoading, error: gruppeError } = useGruppeIdenter(gruppeId)
24+
const harTestnorgeIdenter = identer?.filter((ident) => ident.master === 'PDL')?.length > 0
25+
26+
const npidPerson = opts?.identtype === 'NPID'
27+
const leggTilPaaGruppe = !!opts?.leggTilPaaGruppe
28+
29+
const getIgnoreKeys = () => {
30+
if (npidPerson || (harTestnorgeIdenter && leggTilPaaGruppe)) {
31+
return ['kontaktinformasjonForDoedsbo']
32+
}
33+
return []
34+
}
35+
36+
// TODO: Trenger vi begrensning paa testnorgeIdent? Se PersoninformasjonPanel
37+
return (
38+
<Panel
39+
heading={NavAnsattPanel.heading}
40+
checkAttributeArray={() => sm.batchAdd(getIgnoreKeys())}
41+
uncheckAttributeArray={sm.batchRemove}
42+
iconType="nav"
43+
startOpen={harValgtAttributt(formValues, ['nomdata', 'skjerming'])}
44+
>
45+
<AttributtKategori attr={sm.attrs}>
46+
<Attributt attr={sm.attrs.nom} />
47+
<Attributt attr={sm.attrs.egenAnsattDatoFom} />
48+
</AttributtKategori>
49+
</Panel>
50+
)
51+
}
52+
53+
NavAnsattPanel.heading = 'Nav-ansatt'
54+
55+
NavAnsattPanel.initialValues = ({ set, opts, setMulti, del, has }) => {
56+
const { personFoerLeggTil } = opts
57+
58+
const paths = {
59+
nom: 'nomdata',
60+
egenAnsattDatoFom: {
61+
tpsM: 'tpsMessaging.egenAnsattDatoFom',
62+
skjerming: 'skjerming.egenAnsattDatoFom',
63+
},
64+
egenAnsattDatoTom: {
65+
tpsM: 'tpsMessaging.egenAnsattDatoTom',
66+
skjerming: 'skjerming.egenAnsattDatoTom',
67+
},
68+
skjermetFra: 'skjermingsregister.skjermetFra',
69+
}
70+
71+
return {
72+
nom: {
73+
label: 'Er Nav-ansatt (NOM)',
74+
checked: has(paths.nom),
75+
add: () => set(paths.nom, { startDato: new Date(), sluttDato: null as unknown as string }),
76+
remove: () => del(paths.nom),
77+
},
78+
egenAnsattDatoFom: {
79+
label: 'Skjerming (egen ansatt)',
80+
checked: has(paths.egenAnsattDatoFom.tpsM) || has(paths.egenAnsattDatoFom.skjerming),
81+
add() {
82+
setMulti(
83+
[
84+
paths.egenAnsattDatoFom.skjerming,
85+
_.get(personFoerLeggTil, paths.skjermetFra)?.substring(0, 10) ||
86+
_.get(personFoerLeggTil, paths.egenAnsattDatoFom.tpsM) ||
87+
new Date(),
88+
],
89+
[paths.egenAnsattDatoTom.skjerming, undefined],
90+
)
91+
},
92+
remove() {
93+
del(['skjerming', paths.egenAnsattDatoFom.tpsM, paths.egenAnsattDatoFom.skjerming])
94+
},
95+
},
96+
}
97+
}

apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => {
178178
<Attributt attr={sm.attrs.fullmakt} />
179179
<Attributt attr={sm.attrs.sikkerhetstiltak} />
180180
<Attributt attr={sm.attrs.tilrettelagtKommunikasjon} />
181-
<Attributt attr={sm.attrs.nom} />
182-
<Attributt attr={sm.attrs.egenAnsattDatoFom} />
181+
{/*<Attributt attr={sm.attrs.nom} />*/}
182+
{/*<Attributt attr={sm.attrs.egenAnsattDatoFom} />*/}
183183
</AttributtKategori>
184184
</Panel>
185185
)
@@ -220,16 +220,16 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => {
220220
vergemaal: 'pdldata.person.vergemaal',
221221
sikkerhetstiltak: 'pdldata.person.sikkerhetstiltak',
222222
tilrettelagtKommunikasjon: 'pdldata.person.tilrettelagtKommunikasjon',
223-
nom: 'nomdata',
224-
egenAnsattDatoFom: {
225-
tpsM: 'tpsMessaging.egenAnsattDatoFom',
226-
skjerming: 'skjerming.egenAnsattDatoFom',
227-
},
228-
egenAnsattDatoTom: {
229-
tpsM: 'tpsMessaging.egenAnsattDatoTom',
230-
skjerming: 'skjerming.egenAnsattDatoTom',
231-
},
232-
skjermetFra: 'skjermingsregister.skjermetFra',
223+
// nom: 'nomdata',
224+
// egenAnsattDatoFom: {
225+
// tpsM: 'tpsMessaging.egenAnsattDatoFom',
226+
// skjerming: 'skjerming.egenAnsattDatoFom',
227+
// },
228+
// egenAnsattDatoTom: {
229+
// tpsM: 'tpsMessaging.egenAnsattDatoTom',
230+
// skjerming: 'skjerming.egenAnsattDatoTom',
231+
// },
232+
// skjermetFra: 'skjermingsregister.skjermetFra',
233233
}
234234

235235
return {
@@ -411,29 +411,29 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => {
411411
del(paths.tilrettelagtKommunikasjon)
412412
},
413413
},
414-
nom: {
415-
label: 'Nav-ansatt (NOM)',
416-
checked: has(paths.nom),
417-
add: () => set(paths.nom, { startDato: new Date(), sluttDato: null as unknown as string }),
418-
remove: () => del(paths.nom),
419-
},
420-
egenAnsattDatoFom: {
421-
label: 'Skjerming (egen ansatt)',
422-
checked: has(paths.egenAnsattDatoFom.tpsM) || has(paths.egenAnsattDatoFom.skjerming),
423-
add() {
424-
setMulti(
425-
[
426-
paths.egenAnsattDatoFom.skjerming,
427-
_.get(personFoerLeggTil, paths.skjermetFra)?.substring(0, 10) ||
428-
_.get(personFoerLeggTil, paths.egenAnsattDatoFom.tpsM) ||
429-
new Date(),
430-
],
431-
[paths.egenAnsattDatoTom.skjerming, undefined],
432-
)
433-
},
434-
remove() {
435-
del(['skjerming', paths.egenAnsattDatoFom.tpsM, paths.egenAnsattDatoFom.skjerming])
436-
},
437-
},
414+
// nom: {
415+
// label: 'Nav-ansatt (NOM)',
416+
// checked: has(paths.nom),
417+
// add: () => set(paths.nom, { startDato: new Date(), sluttDato: null as unknown as string }),
418+
// remove: () => del(paths.nom),
419+
// },
420+
// egenAnsattDatoFom: {
421+
// label: 'Skjerming (egen ansatt)',
422+
// checked: has(paths.egenAnsattDatoFom.tpsM) || has(paths.egenAnsattDatoFom.skjerming),
423+
// add() {
424+
// setMulti(
425+
// [
426+
// paths.egenAnsattDatoFom.skjerming,
427+
// _.get(personFoerLeggTil, paths.skjermetFra)?.substring(0, 10) ||
428+
// _.get(personFoerLeggTil, paths.egenAnsattDatoFom.tpsM) ||
429+
// new Date(),
430+
// ],
431+
// [paths.egenAnsattDatoTom.skjerming, undefined],
432+
// )
433+
// },
434+
// remove() {
435+
// del(['skjerming', paths.egenAnsattDatoFom.tpsM, paths.egenAnsattDatoFom.skjerming])
436+
// },
437+
// },
438438
}
439439
}

apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ import TenorLogo from '@/assets/icons/custom/TenorLogo.svg?raw'
7878
import SlackLogo from '@/assets/icons/custom/SlackLogo.svg?raw'
7979
import Playwright from '@/assets/img/playwright.png'
8080

81+
import NavLogo from '@/assets/icons/custom/NavLogo'
82+
8183
import './Icon.less'
8284
import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary'
8385
import React from 'react'
@@ -89,6 +91,7 @@ export const icons = {
8991
dolly: Dolly,
9092
dollyPanic: DollyPanic,
9193
playwright: Playwright,
94+
nav: NavLogo,
9295
tenor: TenorLogo,
9396
slack: SlackLogo,
9497

0 commit comments

Comments
 (0)