Skip to content

Commit 1fd19b7

Browse files
committed
Endre og slett funker paa kontaktadresse
1 parent efefc40 commit 1fd19b7

File tree

5 files changed

+51
-5
lines changed

5 files changed

+51
-5
lines changed

apps/dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/PdlVisning.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type PdlVisningProps = {
3434

3535
export const PdlVisning = ({
3636
pdlData,
37+
tmpPersoner,
3738
fagsystemData = {},
3839
loading = {},
3940
miljoeVisning = false,
@@ -69,6 +70,8 @@ export const PdlVisning = ({
6970

7071
const pdlfPerson = fagsystemData?.pdlforvalter?.person
7172

73+
const tmpPdlforvalter = tmpPersoner?.pdlforvalter
74+
7275
return (
7376
<ErrorBoundary>
7477
<div className={miljoeVisning ? 'boks' : ''}>
@@ -98,6 +101,7 @@ export const PdlVisning = ({
98101
<PdlKontaktadresse
99102
data={kontaktadresse}
100103
pdlfData={pdlfPerson?.kontaktadresse}
104+
tmpPersoner={tmpPdlforvalter}
101105
ident={ident}
102106
/>
103107
<Adressebeskyttelse data={adressebeskyttelse} erPdlVisning />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PdlVisning } from '@/components/fagsystem/pdl/visning/PdlVisning'
2+
import { connect } from 'react-redux'
3+
4+
const mapStateToProps = (state: any) => {
5+
return {
6+
tmpPersoner: state?.redigertePersoner,
7+
}
8+
}
9+
10+
export default connect(mapStateToProps)(PdlVisning)

apps/dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/partials/adresser/PdlKontaktadresse.tsx

+25-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from '@/components/fagsystem/pdlf/visning/partials/Kontaktadresse'
66
import { KontaktadresseData } from '@/pages/gruppe/PersonVisning/PersonMiljoeinfo/PdlDataTyper'
77
import { ArrayHistorikk } from '@/components/ui/historikk/ArrayHistorikk'
8+
import _ from 'lodash'
89

910
type PdlKontaktadresseProps = {
1011
data: Array<KontaktadresseData>
@@ -24,22 +25,41 @@ const AdresseVisning = ({ data, idx }: AdresseProps) => {
2425
)
2526
}
2627

27-
const AdresseVisningRedigerbar = ({ data, idx, alleData, ident }: AdresseProps) => {
28+
const AdresseVisningRedigerbar = ({
29+
data,
30+
idx,
31+
alleData,
32+
tmpData,
33+
tmpPersoner,
34+
ident,
35+
}: AdresseProps) => {
2836
return (
2937
<div className="person-visning_content">
3038
<KontaktadresseVisning
3139
kontaktadresseData={data}
3240
idx={idx}
3341
data={alleData}
42+
tmpData={tmpData}
43+
tmpPersoner={tmpPersoner}
3444
ident={ident}
3545
erPdlVisning={false}
3646
/>
3747
</div>
3848
)
3949
}
4050

41-
export const PdlKontaktadresse = ({ data, pdlfData, ident }: PdlKontaktadresseProps) => {
42-
if (!data || data.length === 0) {
51+
export const PdlKontaktadresse = ({
52+
data,
53+
pdlfData,
54+
tmpPersoner,
55+
ident,
56+
}: PdlKontaktadresseProps) => {
57+
if ((!data || data.length === 0) && (!tmpPersoner || Object.keys(tmpPersoner).length < 1)) {
58+
return null
59+
}
60+
61+
const tmpData = _.get(tmpPersoner, `${ident}.person.kontaktadresse`)
62+
if ((!data || data.length === 0) && (!tmpData || tmpData.length < 1)) {
4363
return null
4464
}
4565

@@ -57,6 +77,8 @@ export const PdlKontaktadresse = ({ data, pdlfData, ident }: PdlKontaktadressePr
5777
data={gyldigeAdresser}
5878
pdlfData={pdlfData}
5979
historiskData={historiskeAdresser}
80+
tmpData={tmpData}
81+
tmpPersoner={tmpPersoner}
6082
ident={ident}
6183
header={''}
6284
/>

apps/dolly-frontend/src/main/js/src/components/ui/historikk/ArrayHistorikk.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export const ArrayHistorikk = ({
99
data,
1010
pdlfData,
1111
historiskData,
12+
tmpData,
13+
tmpPersoner,
1214
ident,
1315
header,
1416
}) => {
@@ -27,7 +29,14 @@ export const ArrayHistorikk = ({
2729
)
2830
if (element.metadata.master === 'PDL' && pdlfElement) {
2931
return (
30-
<MainRedigerbar idx={idx} data={pdlfElement} alleData={pdlfData} ident={ident} />
32+
<MainRedigerbar
33+
idx={idx}
34+
data={pdlfElement}
35+
alleData={pdlfData}
36+
tmpData={tmpData}
37+
tmpPersoner={tmpPersoner}
38+
ident={ident}
39+
/>
3140
)
3241
}
3342
return <Main idx={idx} data={element} />

apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import useBoolean from '@/utils/hooks/useBoolean'
9090
import { MalModal, malTyper } from '@/pages/minSide/maler/MalModal'
9191
import { useTenorOversikt } from '@/utils/hooks/useTenorSoek'
9292
import { SkatteetatenVisning } from '@/components/fagsystem/skatteetaten/visning/SkatteetatenVisning'
93+
import PdlVisningConnector from '@/components/fagsystem/pdl/visning/PdlVisningConnector'
9394

9495
const getIdenttype = (ident) => {
9596
if (parseInt(ident.charAt(0)) > 3) {
@@ -432,7 +433,7 @@ export default ({
432433
)}
433434
{ident.master === 'PDLF' && <PdlfVisningConnector fagsystemData={data} loading={loading} />}
434435
{ident.master === 'PDL' && (
435-
<PdlVisning pdlData={data.pdl} fagsystemData={data} loading={loading} />
436+
<PdlVisningConnector pdlData={data.pdl} fagsystemData={data} loading={loading} />
436437
)}
437438
{visArbeidsforhold && (
438439
<AaregVisning

0 commit comments

Comments
 (0)