-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6860552
commit b26bde0
Showing
24 changed files
with
463 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { setupWorker } from 'msw/browser'; | ||
import { handlers } from './handlers'; | ||
import { handlers } from './handlers/handlers'; | ||
|
||
export const worker = setupWorker(...handlers); |
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
82 changes: 82 additions & 0 deletions
82
apps/ungdomsytelse-deltaker/mock/msw/mocks/soker1/deltakelser/harSøkt.ts
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,82 @@ | ||
export const deltakelserHarSøkt = [ | ||
{ | ||
id: '123', | ||
programperiodeFraOgMed: '2024-07-01', | ||
programperiodeTilOgMed: '2025-06-30', | ||
harSøkt: true, | ||
rapporteringsPerioder: [ | ||
{ | ||
fraOgMed: '2024-07-01', | ||
tilOgMed: '2024-07-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-08-01', | ||
tilOgMed: '2024-08-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-09-01', | ||
tilOgMed: '2024-09-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-10-01', | ||
tilOgMed: '2024-10-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-11-01', | ||
tilOgMed: '2024-11-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-12-01', | ||
tilOgMed: '2024-12-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-01-01', | ||
tilOgMed: '2025-01-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-02-01', | ||
tilOgMed: '2025-02-28', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-03-01', | ||
tilOgMed: '2025-03-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-04-01', | ||
tilOgMed: '2025-04-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-05-01', | ||
tilOgMed: '2025-05-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-06-01', | ||
tilOgMed: '2025-06-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
], | ||
}, | ||
]; |
82 changes: 82 additions & 0 deletions
82
apps/ungdomsytelse-deltaker/mock/msw/mocks/soker1/deltakelser/ikkeSøkt.ts
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,82 @@ | ||
export const deltakelserIkkeSøkt = [ | ||
{ | ||
id: '123', | ||
programperiodeFraOgMed: '2024-07-01', | ||
programperiodeTilOgMed: '2025-06-30', | ||
harSøkt: false, | ||
rapporteringsPerioder: [ | ||
{ | ||
fraOgMed: '2024-07-01', | ||
tilOgMed: '2024-07-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-08-01', | ||
tilOgMed: '2024-08-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-09-01', | ||
tilOgMed: '2024-09-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-10-01', | ||
tilOgMed: '2024-10-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-11-01', | ||
tilOgMed: '2024-11-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2024-12-01', | ||
tilOgMed: '2024-12-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-01-01', | ||
tilOgMed: '2025-01-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-02-01', | ||
tilOgMed: '2025-02-28', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-03-01', | ||
tilOgMed: '2025-03-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-04-01', | ||
tilOgMed: '2025-04-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-05-01', | ||
tilOgMed: '2025-05-31', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
{ | ||
fraOgMed: '2025-06-01', | ||
tilOgMed: '2025-06-30', | ||
harRapportert: false, | ||
inntekt: null, | ||
}, | ||
], | ||
}, | ||
]; |
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { arbeidsgiverMock } from './arbeidsgiverMock'; | ||
import { barnMock } from './barnMock'; | ||
import { personaliaMock } from './personaliaMock'; | ||
import { søkerMock } from './søkerMock'; | ||
|
||
export const søker1Mock = { | ||
barn: barnMock, | ||
søker: søkerMock, | ||
arbeidsgiver: arbeidsgiverMock, | ||
personalia: personaliaMock, | ||
}; |
9 changes: 9 additions & 0 deletions
9
apps/ungdomsytelse-deltaker/mock/msw/mocks/soker1/personaliaMock.ts
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,9 @@ | ||
import { PersonaliaApiData } from '../../../../src/api/types'; | ||
|
||
export const personaliaMock: PersonaliaApiData = { | ||
personalia: { | ||
kontoregisterStatus: 'FAILURE', | ||
kontonr: '97105351740', | ||
utenlandskbank: null, | ||
}, | ||
}; |
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
11 changes: 11 additions & 0 deletions
11
apps/ungdomsytelse-deltaker/src/api/schemas/personaliaSchema.ts
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,11 @@ | ||
import { z } from 'zod'; | ||
|
||
export const kontonummerSchema = z.object({ | ||
kontoregisterStatus: z.enum(['SUCCESS', 'FAILURE']), | ||
kontonr: z.string().nullable(), | ||
utenlandskbank: z.boolean().nullable(), | ||
}); | ||
|
||
export const personaliaApiDataSchema = z.object({ | ||
personalia: kontonummerSchema, | ||
}); |
18 changes: 18 additions & 0 deletions
18
apps/ungdomsytelse-deltaker/src/api/services/personaliaService.ts
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,18 @@ | ||
import { personaliaApiDataSchema } from '../schemas/personaliaSchema'; | ||
import { PersonaliaApiData } from '../types'; | ||
|
||
export const personaliaService = { | ||
fetch: async (): Promise<PersonaliaApiData | undefined> => { | ||
try { | ||
const response = await fetch(`person/personopplysninger-api/personalia`); | ||
if (!response.ok) { | ||
throw new Error(`Failed to fetch personalia: ${response.status}`); | ||
} | ||
const json = await response.json(); | ||
return await personaliaApiDataSchema.parse(json); | ||
} catch (e) { | ||
console.log(e); | ||
return undefined; | ||
} | ||
}, | ||
}; |
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
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
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
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,30 @@ | ||
import { setBreadcrumbs } from '@navikt/nav-dekoratoren-moduler'; | ||
import { EnvKey } from '@navikt/sif-common-env'; | ||
import { useEffectOnce } from '@navikt/sif-common-hooks'; | ||
import { useDeltakerContext } from '../../context/DeltakerContext'; | ||
import { appEnv } from '../../utils/appEnv'; | ||
import { InnsynContextProvider } from './context/InnsynContext'; | ||
import InnsynForside from './pages/InnsynForside'; | ||
|
||
const Innsyn = () => { | ||
const { | ||
data: { søker, deltakelserSøktFor, kontonummerInfo }, | ||
} = useDeltakerContext(); | ||
|
||
const deltakelse = deltakelserSøktFor[0]; | ||
|
||
useEffectOnce(() => { | ||
setBreadcrumbs([ | ||
{ title: 'Min side', url: '/dittnav/' }, | ||
{ title: 'Ungdomsprogrammet', url: appEnv[EnvKey.PUBLIC_PATH] }, | ||
]); | ||
}); | ||
|
||
return ( | ||
<InnsynContextProvider initialData={{ deltakelse, kontonummerInfo, søker }}> | ||
<InnsynForside /> | ||
</InnsynContextProvider> | ||
); | ||
}; | ||
|
||
export default Innsyn; |
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
34 changes: 34 additions & 0 deletions
34
apps/ungdomsytelse-deltaker/src/sites/innsyn/components/DeltakelseInfo.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,34 @@ | ||
import { Heading, VStack } from '@navikt/ds-react'; | ||
import { Deltakelse, KontonummerInfo } from '../../../api/types'; | ||
import { Søker } from '@navikt/sif-common-api'; | ||
import { List } from '@navikt/ds-react/List'; | ||
import { dateFormatter } from '@navikt/sif-common-utils'; | ||
import KontonummerStatusTekst from './KontonummerStatusTekst'; | ||
|
||
interface Props { | ||
deltakelse: Deltakelse; | ||
søker: Søker; | ||
kontonummerInfo?: KontonummerInfo; | ||
} | ||
const DeltakelseInfo = ({ deltakelse, kontonummerInfo }: Props) => { | ||
const { programPeriode } = deltakelse; | ||
return ( | ||
<VStack> | ||
<Heading level="2" size="medium" spacing={true}> | ||
Om deg og ungdomsprogrammet | ||
</Heading> | ||
<List> | ||
<List.Item title="Deltakerperiode"> | ||
Fra: {dateFormatter.dateShortMonthYear(programPeriode.from)} | ||
{programPeriode.to ? ` til ${dateFormatter.dateShortMonthYear(programPeriode.to)}` : ''} | ||
</List.Item> | ||
<List.Item title="Dager brukt">[TODO]</List.Item> | ||
<List.Item title="Kontonummer"> | ||
<KontonummerStatusTekst kontonummerInfo={kontonummerInfo} /> | ||
</List.Item> | ||
</List> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default DeltakelseInfo; |
Oops, something went wrong.