diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/Form.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/Form.tsx
index ac4837edbe4..99d55a5e610 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/Form.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/Form.tsx
@@ -11,6 +11,7 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions'
import { FormDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker'
import { getYearRangeOptions } from '@/utils/DataFormatter'
import { BelopForm } from '@/components/fagsystem/afpOffentlig/form/BeloepForm'
+import { validation } from '@/components/fagsystem/afpOffentlig/form/validation'
export const afpOffentligPath = 'pensjonforvalter.afpOffentlig'
@@ -91,3 +92,5 @@ export const AfpOffentligForm = () => {
)
}
+
+AfpOffentligForm.validation = validation
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/validation.tsx
new file mode 100644
index 00000000000..81e6b1c3b73
--- /dev/null
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/form/validation.tsx
@@ -0,0 +1,30 @@
+import { ifPresent, requiredDate, requiredNumber } from '@/utils/YupValidations'
+import * as Yup from 'yup'
+
+export const validation = {
+ afpOffentlig: ifPresent(
+ '$pensjonforvalter.afpOffentlig',
+ Yup.object({
+ direktekall: Yup.array().of(Yup.string()).nullable(),
+ mocksvar: Yup.array().of(
+ Yup.object({
+ tpId: Yup.string().nullable(),
+ statusAfp: Yup.string().nullable(),
+ virkningsDato: Yup.date().nullable(),
+ sistBenyttetG: Yup.number()
+ .transform((i, j) => (j === '' ? null : i))
+ .nullable(),
+ belopsListe: Yup.array().of(
+ Yup.object({
+ fomDato: ifPresent('$fomDato', requiredDate),
+ belop: ifPresent(
+ '$belop',
+ requiredNumber.transform((i, j) => (j === '' ? null : i)),
+ ),
+ }),
+ ),
+ }),
+ ),
+ }),
+ ),
+}
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx
index ce64a432e76..5552a77d453 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx
@@ -1,12 +1,12 @@
export const initialBeloep = {
- fomDato: '',
+ fomDato: null,
belop: 0,
}
export const initialMocksvar = {
- tpId: '',
- statusAfp: '',
- virkningsDato: '',
+ tpId: null,
+ statusAfp: null,
+ virkningsDato: null,
sistBenyttetG: 2024,
belopsListe: [initialBeloep],
}
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/visning/AfpOffentligVisning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/visning/AfpOffentligVisning.tsx
index a97523d5a89..1f9bed1163d 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/visning/AfpOffentligVisning.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/visning/AfpOffentligVisning.tsx
@@ -44,14 +44,16 @@ const DataVisning = ({ data }) => {
-
- {(belop, idy) => (
-
-
-
-
- )}
-
+ {mocksvar?.belopsListe?.length > 0 && (
+
+ {(belop, idy) => (
+
+
+
+
+ )}
+
+ )}
)}
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx
index a91cc5abfe6..271c2000ec8 100644
--- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx
+++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx
@@ -6,6 +6,7 @@ import { AlderspensjonForm } from '@/components/fagsystem/alderspensjon/form/For
import { UforetrygdForm } from '@/components/fagsystem/uforetrygd/form/Form'
import { PensjonsavtaleForm } from '@/components/fagsystem/pensjonsavtale/form/Form'
import { getYear } from 'date-fns'
+import { AfpOffentligForm } from '@/components/fagsystem/afpOffentlig/form/Form'
function calculate_age(dob) {
const diff_ms = Date.now() - dob.getTime()
@@ -224,6 +225,7 @@ export const validation = {
...TjenestepensjonForm.validation,
...AlderspensjonForm.validation,
...UforetrygdForm.validation,
+ ...AfpOffentligForm.validation,
}),
),
}