-
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 foedselsdato og foedested
- Loading branch information
1 parent
3dfb3d2
commit d2edbee
Showing
3 changed files
with
97 additions
and
0 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
51 changes: 51 additions & 0 deletions
51
...olly-frontend/src/main/js/src/components/fagsystem/pdlf/bestilling/partials/Foedested.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,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> | ||
) | ||
} |
42 changes: 42 additions & 0 deletions
42
...y-frontend/src/main/js/src/components/fagsystem/pdlf/bestilling/partials/Foedselsdato.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,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> | ||
) | ||
} |