|
1 | 1 | import { Box, Heading, LinkPanel, VStack } from '@navikt/ds-react';
|
2 | 2 | import { ReactElement } from 'react';
|
| 3 | +import { setBreadcrumbs } from '@navikt/nav-dekoratoren-moduler'; |
3 | 4 | import { useAmplitudeInstance } from '@navikt/sif-common-amplitude';
|
4 | 5 | import { useEffectOnce } from '@navikt/sif-common-hooks';
|
| 6 | +import { dateFormatter } from '@navikt/sif-common-utils'; |
5 | 7 | import Head from 'next/head';
|
| 8 | +import Link from 'next/link'; |
6 | 9 | import { withAuthenticatedPage } from '../auth/withAuthentication';
|
7 | 10 | import DineInnsendteSøknader from '../components/dine-innsendte-søknader/DineInnsendteSøknader';
|
8 | 11 | import HvaSkjer from '../components/hva-skjer/HvaSkjer';
|
9 | 12 | import DefaultPageLayout from '../components/page-layout/default-page-layout/DefaultPageLayout';
|
10 | 13 | import Snarveier from '../components/snarveier/Snarveier';
|
| 14 | +import StatusTag from '../components/status-tag/StatusTag'; |
11 | 15 | import Svarfrist from '../components/svarfrist/Svarfrist';
|
12 | 16 | import { useInnsynsdataContext } from '../hooks/useInnsynsdataContext';
|
| 17 | +import { PleietrengendeMedSak } from '../server/api-models/PleietrengendeMedSakSchema'; |
| 18 | +import { InnsendtSøknad, InnsendtSøknadstype } from '../types/Søknad'; |
| 19 | +import { getAllBreadcrumbs } from '../utils/decoratorBreadcrumbs'; |
13 | 20 | import { Feature } from '../utils/features';
|
14 |
| -import SakPage from './sak/SakPage'; |
15 | 21 | import { personaliaUtils } from '../utils/personaliaUtils';
|
16 |
| -import { dateFormatter } from '@navikt/sif-common-utils'; |
17 |
| -import Link from 'next/link'; |
18 |
| -import { getAllBreadcrumbs } from '../utils/decoratorBreadcrumbs'; |
19 |
| -import { setBreadcrumbs } from '@navikt/nav-dekoratoren-moduler'; |
20 |
| -import StatusTag from '../components/status-tag/StatusTag'; |
21 | 22 | import { getBehandlingsstatusISak } from '../utils/sakUtils';
|
| 23 | +import SakPage from './sak/SakPage'; |
| 24 | + |
| 25 | +const harSendtInnSøknadEllerEndringsmelding = (søknader: InnsendtSøknad[]): boolean => { |
| 26 | + return søknader.some( |
| 27 | + (søknad) => |
| 28 | + søknad.søknadstype === InnsendtSøknadstype.PP_SYKT_BARN || |
| 29 | + søknad.søknadstype === InnsendtSøknadstype.PP_SYKT_BARN_ENDRINGSMELDING, |
| 30 | + ); |
| 31 | +}; |
| 32 | + |
| 33 | +const getSaksbehandlingsfrist = (søknader: InnsendtSøknad[], saker: PleietrengendeMedSak[]): Date | undefined => { |
| 34 | + if (saker.length === 1 && harSendtInnSøknadEllerEndringsmelding(søknader)) { |
| 35 | + return saker[0].sak.saksbehandlingsFrist; |
| 36 | + } |
| 37 | + return undefined; |
| 38 | +}; |
22 | 39 |
|
23 | 40 | function DinePleiepengerPage(): ReactElement {
|
24 | 41 | const {
|
@@ -99,7 +116,7 @@ function DinePleiepengerPage(): ReactElement {
|
99 | 116 | </div>
|
100 | 117 | <div className="md:mb-none shrink-0 md:w-72">
|
101 | 118 | <Svarfrist
|
102 |
| - frist={saker.length === 1 ? saker[0].sak.saksbehandlingsFrist : undefined} |
| 119 | + frist={getSaksbehandlingsfrist(innsendteSøknader, saker)} |
103 | 120 | saksbehandlingstidUker={saksbehandlingstidUker}
|
104 | 121 | />
|
105 | 122 | </div>
|
|
0 commit comments