-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bestillingsvisning forelder barn og delt bosted. Ekspanderbar visning…
… som generell komponent. Div fix
- Loading branch information
1 parent
b97968b
commit 320f215
Showing
8 changed files
with
152 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...lly-frontend/src/main/js/src/components/fagsystem/pdlf/bestilling/partials/DeltBosted.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react' | ||
import { DeltBostedData } from '@/pages/gruppe/PersonVisning/PersonMiljoeinfo/PdlDataTyper' | ||
import { formatDate, showLabel } from '@/utils/DataFormatter' | ||
import { Vegadresse } from '@/components/fagsystem/pdlf/bestilling/partials/Vegadresse' | ||
import { Matrikkeladresse } from '@/components/fagsystem/pdlf/bestilling/partials/Matrikkeladresse' | ||
import { UkjentBosted } from '@/components/fagsystem/pdlf/bestilling/partials/UkjentBosted' | ||
import { TitleValue } from '@/components/ui/titleValue/TitleValue' | ||
|
||
type DeltBostedTypes = { | ||
deltBosted: DeltBostedData | ||
} | ||
|
||
export const DeltBosted = ({ deltBosted }: DeltBostedTypes) => { | ||
if (!deltBosted) { | ||
return null | ||
} | ||
|
||
return ( | ||
<> | ||
<TitleValue | ||
title="Adressetype" | ||
value={showLabel('adressetypeDeltBosted', deltBosted.adressetype)} | ||
/> | ||
<Vegadresse vegadresse={deltBosted.vegadresse} /> | ||
<Matrikkeladresse matrikkeladresse={deltBosted.matrikkeladresse} /> | ||
<UkjentBosted ukjentBosted={deltBosted.ukjentBosted} /> | ||
<TitleValue | ||
title="Startdato for kontrakt" | ||
value={formatDate(deltBosted.startdatoForKontrakt)} | ||
/> | ||
<TitleValue | ||
title="Sluttdato for kontrakt" | ||
value={formatDate(deltBosted.sluttdatoForKontrakt)} | ||
/> | ||
</> | ||
) | ||
} |
96 changes: 96 additions & 0 deletions
96
...nd/src/main/js/src/components/fagsystem/pdlf/bestilling/partials/ForelderBarnRelasjon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary' | ||
import { BestillingTitle } from '@/components/bestilling/sammendrag/Bestillingsdata' | ||
import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' | ||
import React from 'react' | ||
import { TitleValue } from '@/components/ui/titleValue/TitleValue' | ||
import { ForeldreBarnRelasjon } from '@/components/fagsystem/pdlf/PdlTypes' | ||
import { showLabel } from '@/utils/DataFormatter' | ||
import { EkspanderbarVisning } from '@/components/bestilling/sammendrag/visning/EkspanderbarVisning' | ||
import { DeltBosted } from '@/components/fagsystem/pdlf/bestilling/partials/DeltBosted' | ||
import { RelatertPerson } from '@/components/bestilling/sammendrag/visning/RelatertPerson' | ||
import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils' | ||
|
||
type ForelderBarnTypes = { | ||
forelderBarnListe: Array<ForeldreBarnRelasjon> | ||
} | ||
|
||
const getHeader = (forelderBarnRelasjon: ForeldreBarnRelasjon) => { | ||
return showLabel('pdlRelasjonTyper', forelderBarnRelasjon?.relatertPersonsRolle) | ||
} | ||
|
||
export const ForelderBarnRelasjon = ({ forelderBarnListe }: ForelderBarnTypes) => { | ||
if (!forelderBarnListe || forelderBarnListe.length < 1) { | ||
return null | ||
} | ||
|
||
return ( | ||
<div className="person-visning"> | ||
<ErrorBoundary> | ||
<BestillingTitle>Barn/foreldre</BestillingTitle> | ||
<DollyFieldArray header="Relasjon" getHeader={getHeader} data={forelderBarnListe}> | ||
{(forelderBarn: ForeldreBarnRelasjon, idx: number) => { | ||
if ( | ||
forelderBarn.relatertPersonsRolle === 'FORELDER' && | ||
isEmpty(forelderBarn, [ | ||
'kilde', | ||
'master', | ||
'minRolleForPerson', | ||
'relatertPersonsRolle', | ||
]) | ||
) { | ||
return <TitleValue title="Relasjon" value="Ingen verdier satt" /> | ||
} | ||
const dataIsEmpty = (data: any) => { | ||
return !data || isEmpty(data, ['syntetisk']) | ||
} | ||
|
||
return ( | ||
<React.Fragment key={idx}> | ||
<TitleValue | ||
title="Rolle for barn" | ||
value={ | ||
forelderBarn.relatertPersonsRolle === 'BARN' && | ||
showLabel('pdlRelasjonTyper', forelderBarn.minRolleForPerson) | ||
} | ||
/> | ||
<TitleValue title="Bor ikke sammen" value={forelderBarn.borIkkeSammen && 'Ja'} /> | ||
<TitleValue | ||
title="Partner ikke forelder" | ||
value={forelderBarn.partnerErIkkeForelder && 'Ja'} | ||
/> | ||
<TitleValue | ||
title={`Type ${forelderBarn.relatertPersonsRolle}`} | ||
value={showLabel('typeAnsvarlig', forelderBarn.typeForelderBarn)} | ||
/> | ||
<TitleValue | ||
title={forelderBarn.relatertPersonsRolle} | ||
value={forelderBarn.relatertPerson} | ||
/> | ||
<EkspanderbarVisning | ||
vis={!dataIsEmpty(forelderBarn.deltBosted)} | ||
header="DELT BOSTED" | ||
> | ||
<DeltBosted deltBosted={forelderBarn.deltBosted} /> | ||
</EkspanderbarVisning> | ||
<EkspanderbarVisning | ||
vis={!dataIsEmpty(forelderBarn.nyRelatertPerson)} | ||
header={forelderBarn.relatertPersonsRolle} | ||
> | ||
<RelatertPerson personData={forelderBarn.nyRelatertPerson} /> | ||
</EkspanderbarVisning> | ||
<EkspanderbarVisning | ||
vis={!dataIsEmpty(forelderBarn.relatertPersonUtenFolkeregisteridentifikator)} | ||
header={forelderBarn.relatertPersonsRolle} | ||
> | ||
<RelatertPerson | ||
personData={forelderBarn.relatertPersonUtenFolkeregisteridentifikator} | ||
/> | ||
</EkspanderbarVisning> | ||
</React.Fragment> | ||
) | ||
}} | ||
</DollyFieldArray> | ||
</ErrorBoundary> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters