Skip to content

Commit 128c4ac

Browse files
committed
ny: Vis journalposter for traader
1 parent 85389c5 commit 128c4ac

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { List, ReadMore } from '@navikt/ds-react';
2+
import type { Journalpost } from 'src/generated/modiapersonoversikt-api';
3+
import { formaterDato } from 'src/utils/string-utils';
4+
5+
type Props = {
6+
journalposter: Journalpost[];
7+
};
8+
9+
export const Journalposter = ({ journalposter }: Props) => {
10+
if (journalposter.length === 0) {
11+
return null;
12+
}
13+
14+
return (
15+
<ReadMore header={`Dialogen er journalført på ${journalposter.length} sak(er)`}>
16+
<List size="small">
17+
{journalposter.map((p) => {
18+
const navn = p.journalfortAv?.navn ?? 'ukjent';
19+
const dato = formaterDato(p.journalfortDato);
20+
const tema = p.journalfortTemanavn;
21+
const saksid = p.journalfortSaksid ? `saksid ${p.journalfortSaksid}` : 'ukjent saksid';
22+
return (
23+
<li className="list-none" key={`${p.journalfortDato}-${p.journalfortSaksid}`}>
24+
{dato}: {tema} ({saksid}) av {navn}
25+
</li>
26+
);
27+
})}
28+
</List>
29+
</ReadMore>
30+
);
31+
};

src/components/Meldinger/Detail/index.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { formatterDatoTid } from 'src/utils/date-utils';
1919
import { formaterDato } from 'src/utils/string-utils';
2020
import { meldingerFilterAtom } from '../List/Filter';
2121
import { erMeldingFraNav, nyesteMelding, saksbehandlerTekst, traadKanBesvares, traadstittel } from '../List/utils';
22+
import { Journalposter } from './Journalposter';
2223

2324
const TraadMeta = ({ traad }: { traad: Traad }) => (
2425
<HStack justify="space-between">
@@ -113,6 +114,8 @@ const TraadDetailContent = ({ traadId }: { traadId: string }) => {
113114
</Alert>
114115
)}
115116

117+
<Journalposter journalposter={traad.journalposter} />
118+
116119
<Box.New
117120
minHeight="0"
118121
overflowY="scroll"

0 commit comments

Comments
 (0)