Skip to content

Commit

Permalink
tekst for dokumenttilstand for vedtak
Browse files Browse the repository at this point in the history
  • Loading branch information
ramnav990 committed Mar 7, 2023
1 parent 24a3718 commit 1407740
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 25 deletions.
60 changes: 35 additions & 25 deletions src/pages/saksbehandling/sakintro/Vedtakstabell/Vedtakstabell.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as RemoteData from '@devexperts/remote-data-ts';
import { Email } from '@navikt/ds-icons';
import { Button, Table } from '@navikt/ds-react';
import { BodyShort, Button, Table } from '@navikt/ds-react';
import * as arr from 'fp-ts/Array';
import * as Ord from 'fp-ts/Ord';
import * as S from 'fp-ts/string';
Expand All @@ -22,7 +22,11 @@ import { Klage, KlageStatus } from '~src/types/Klage';
import { Vedtak } from '~src/types/Vedtak';
import { formatDateTime, formatPeriode } from '~src/utils/date/dateUtils';
import { getBlob } from '~src/utils/dokumentUtils';
import { erDokumentGenerertEllerSenere } from '~src/utils/VedtakUtils';
import {
erDokumentGenerertEllerSenere,
erDokumentIkkeGenerertEnda,
skalDokumentIkkeGenereres,
} from '~src/utils/VedtakUtils';

import messages from '../sakintro-nb';

Expand Down Expand Up @@ -142,30 +146,36 @@ const Vedtakstabell = (props: { sakId: string; vedtakOgOversendteKlager: VedtakO
</Link>
</Table.DataCell>
<Table.DataCell>
{isOversendtKlage(vedtak) || erDokumentGenerertEllerSenere(vedtak) ? (
<Button
className={styles.seBrevButton}
variant="secondary"
size={'small'}
loading={RemoteData.isPending(hentDokumenterStatus)}
onClick={() => {
hentDokumenter(
{
id: vedtak.id,
idType: isOversendtKlage(vedtak)
? DokumentIdType.Klage
: DokumentIdType.Vedtak,
},
(dokumenter) =>
window.open(URL.createObjectURL(getBlob(dokumenter[0])))
);
}}
>
<Email />
</Button>
) : (
'-'
{!isOversendtKlage(vedtak) && skalDokumentIkkeGenereres(vedtak) && (
<BodyShort>{formatMessage('datacell.brev.skalIkkeGenerere')}</BodyShort>
)}
{!isOversendtKlage(vedtak) && erDokumentIkkeGenerertEnda(vedtak) && (
<BodyShort>{formatMessage('datacell.brev.ikkeGenerert')}</BodyShort>
)}

{isOversendtKlage(vedtak) ||
(erDokumentGenerertEllerSenere(vedtak) && (
<Button
className={styles.seBrevButton}
variant="secondary"
size={'small'}
loading={RemoteData.isPending(hentDokumenterStatus)}
onClick={() => {
hentDokumenter(
{
id: vedtak.id,
idType: isOversendtKlage(vedtak)
? DokumentIdType.Klage
: DokumentIdType.Vedtak,
},
(dokumenter) =>
window.open(URL.createObjectURL(getBlob(dokumenter[0])))
);
}}
>
<Email />
</Button>
))}
</Table.DataCell>
</Table.Row>
);
Expand Down
3 changes: 3 additions & 0 deletions src/pages/saksbehandling/sakintro/sakintro-nb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ export default {

'dataCell.seOppsummering': 'Se oppsummering',

'datacell.brev.skalIkkeGenerere': 'Skal ikke sende brev',
'datacell.brev.ikkeGenerert': 'Ikke generert',

'datacell.vedtakstype.SØKNAD': 'Søknad',
'datacell.vedtakstype.AVSLAG': 'Søknad',
'datacell.vedtakstype.ENDRING': 'Revurdering',
Expand Down

0 comments on commit 1407740

Please sign in to comment.