Skip to content

Commit

Permalink
Bestillingsvisning foedselsdato og foedested
Browse files Browse the repository at this point in the history
  • Loading branch information
betsytraran committed Dec 20, 2024
1 parent 3dfb3d2 commit d2edbee
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ import { Medl } from '@/components/fagsystem/medl/bestilling/Medl'
import { Udistub } from '@/components/fagsystem/udistub/bestilling/Udistub'
import { Dokarkiv } from '@/components/fagsystem/dokarkiv/bestilling/Dokarkiv'
import { Histark } from '@/components/fagsystem/histark/bestilling/Histark'
import { Foedested } from '@/components/fagsystem/pdlf/bestilling/partials/Foedested'
import { Foedselsdato } from '@/components/fagsystem/pdlf/bestilling/partials/Foedselsdato'

export const BestillingTitle = styled.h4`
margin: 5px 0 15px 0;
Expand Down Expand Up @@ -84,6 +86,8 @@ export const Bestillingsdata = ({ bestilling }: any) => {
return (
<>
<Alder opprettNyPerson={bestilling.pdldata?.opprettNyPerson} />
<Foedested foedestedListe={bestilling.pdldata?.person?.foedested} />
<Foedselsdato foedselsdatoListe={bestilling.pdldata?.person?.foedselsdato} />
<Foedsel foedselListe={bestilling.pdldata?.person?.foedsel} />
<Doedsfall doedsfallListe={bestilling.pdldata?.person?.doedsfall} />
<Statsborgerskap statsborgerskapListe={bestilling.pdldata?.person?.statsborgerskap} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary'
import { BestillingTitle, EmptyObject } from '@/components/bestilling/sammendrag/Bestillingsdata'
import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray'
import React from 'react'
import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils'
import { TitleValue } from '@/components/ui/titleValue/TitleValue'
import { AdresseKodeverk } from '@/config/kodeverk'
import { FoedestedData } from '@/components/fagsystem/pdlf/PdlTypes'

type FoedestedTypes = {
foedestedListe: Array<FoedestedData>
}

export const Foedested = ({ foedestedListe }: FoedestedTypes) => {
if (!foedestedListe || foedestedListe.length < 1) {
return null
}

return (
<div className="person-visning">
<ErrorBoundary>
<BestillingTitle>Fødested</BestillingTitle>
<DollyFieldArray header="Fødested" data={foedestedListe}>
{(foedested: FoedestedData, idx: number) => {
return (
<React.Fragment key={idx}>
{isEmpty(foedested, ['kilde', 'master']) ? (
<EmptyObject />
) : (
<>
<TitleValue title="Fødested" value={foedested.foedested} />
<TitleValue
title="Fødekommune"
value={foedested.foedekommune}
kodeverk={AdresseKodeverk.Kommunenummer}
/>
<TitleValue
title="Fødeland"
value={foedested.foedeland}
kodeverk={AdresseKodeverk.StatsborgerskapLand}
/>
</>
)}
</React.Fragment>
)
}}
</DollyFieldArray>
</ErrorBoundary>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary'
import { BestillingTitle, EmptyObject } from '@/components/bestilling/sammendrag/Bestillingsdata'
import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray'
import { FoedselsdatoData } from '@/components/fagsystem/pdlf/PdlTypes'
import React from 'react'
import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils'
import { TitleValue } from '@/components/ui/titleValue/TitleValue'
import { formatDate } from '@/utils/DataFormatter'

type FoedselsdatoTypes = {
foedselsdatoListe: Array<FoedselsdatoData>
}

export const Foedselsdato = ({ foedselsdatoListe }: FoedselsdatoTypes) => {
if (!foedselsdatoListe || foedselsdatoListe.length < 1) {
return null
}

return (
<div className="person-visning">
<ErrorBoundary>
<BestillingTitle>Fødselsdato</BestillingTitle>
<DollyFieldArray header="Fødselsdato" data={foedselsdatoListe}>
{(foedselsdato: FoedselsdatoData, idx: number) => {
return (
<React.Fragment key={idx}>
{isEmpty(foedselsdato, ['kilde', 'master']) ? (
<EmptyObject />
) : (
<>
<TitleValue title="Fødselsdato" value={formatDate(foedselsdato.foedselsdato)} />
<TitleValue title="Fødselsår" value={foedselsdato.foedselsaar} />
</>
)}
</React.Fragment>
)
}}
</DollyFieldArray>
</ErrorBoundary>
</div>
)
}

0 comments on commit d2edbee

Please sign in to comment.