Skip to content

Commit

Permalink
Bestillingsvisning histark
Browse files Browse the repository at this point in the history
  • Loading branch information
betsytraran committed Dec 19, 2024
1 parent aafc168 commit 97d0ea6
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { Krrstub } from '@/components/fagsystem/krrstub/bestilling/Krrstub'
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'

export const BestillingTitle = styled.h4`
margin: 5px 0 15px 0;
Expand Down Expand Up @@ -152,6 +153,7 @@ export const Bestillingsdata = ({ bestilling }: any) => {
<Medl medl={bestilling.medl} />
<Udistub udistub={bestilling.udistub} />
<Dokarkiv dokarkiv={bestilling.dokarkiv} />
<Histark histark={bestilling.histark} />
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export type HistarkTypes = {
dokumenter: [
{
temakoder: Array<string>
enhetsnavn: string
startYear: number
endYear: number
skanningsTidspunkt: Date
skanner: string
skannested: string
tittel: string
},
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils'
import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary'
import { BestillingData, BestillingTitle } from '@/components/bestilling/sammendrag/Bestillingsdata'
import { TitleValue } from '@/components/ui/titleValue/TitleValue'
import { arrayToString, formatDateTime, showKodeverkLabel } from '@/utils/DataFormatter'
import React from 'react'
import { Kodeverk } from '@/components/fagsystem/dokarkiv/form/DokarkivForm'
import { HistarkTypes } from '@/components/fagsystem/histark/HistarkTypes'

type HistarkProps = {
histark: HistarkTypes
}

export const Histark = ({ histark }: HistarkProps) => {
if (!histark || isEmpty(histark)) {
return null
}

const dokument = histark.dokumenter?.[0]

return (
<div className="person-visning">
<ErrorBoundary>
<BestillingTitle>Dokumenter (Histark)</BestillingTitle>
<BestillingData>
<TitleValue
title="Temakoder"
value={arrayToString(
dokument?.temakoder?.map((kode) => showKodeverkLabel(Kodeverk.TEMA, kode)),
)}
/>
<TitleValue title="Nav-enhet" value={dokument?.enhetsnavn} />
<TitleValue title="Startår" value={dokument?.startYear} />
<TitleValue title="Sluttår" value={dokument?.endYear} />
<TitleValue
title="Skanningstidspunkt"
value={formatDateTime(dokument?.skanningsTidspunkt)}
/>
<TitleValue title="Skanner" value={dokument?.skanner} />
<TitleValue title="Skannested" value={dokument?.skannested} />
<TitleValue title="Vedlegg tittel" value={dokument?.tittel} />
</BestillingData>
</ErrorBoundary>
</div>
)
}

0 comments on commit 97d0ea6

Please sign in to comment.