diff --git a/apps/dolly-frontend/src/main/js/package-lock.json b/apps/dolly-frontend/src/main/js/package-lock.json index 35ad1be86fe..266c908d413 100644 --- a/apps/dolly-frontend/src/main/js/package-lock.json +++ b/apps/dolly-frontend/src/main/js/package-lock.json @@ -66,7 +66,7 @@ "@hookform/error-message": "^2.0.1", "@navikt/ds-css": "^5.0.3", "@navikt/ds-icons": "^3.4.3", - "@navikt/ds-react": "^5.0.3", + "@navikt/ds-react": "^5.15.0", "@redux-devtools/extension": "^3.2.3", "@reduxjs/toolkit": "^1.8.4", "@rollup/plugin-terser": "^0.4.1", @@ -1287,9 +1287,9 @@ } }, "node_modules/@floating-ui/react-dom": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.5.tgz", - "integrity": "sha512-UsBK30Bg+s6+nsgblXtZmwHhgS2vmbuQK22qgt2pTQM6M3X6H1+cQcLXqgRY3ihVLcZJE6IvqDQozhsnIVqK/Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.6.tgz", + "integrity": "sha512-IB8aCRFxr8nFkdYZgH+Otd9EVQPJoynxeFRGTB8voPoZMRWo8XjYuCRgpI1btvuKY69XMiLnW+ym7zoBHM90Rw==", "dependencies": { "@floating-ui/dom": "^1.5.4" }, @@ -1635,16 +1635,16 @@ "optional": true }, "node_modules/@navikt/aksel-icons": { - "version": "5.14.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/aksel-icons/5.14.0/04394757d4986022f99c221cc39a1bd9f4aee32f", - "integrity": "sha512-9WlVwy1G03puzAYZe1HeH10aHVHI0DNmeS23i0tchsU12514Q1S6Btu7ZDilNf5qasQVetZPNxGGeGPGAG3mOA==", + "version": "5.15.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/aksel-icons/5.15.1/595a3c27937e7065b1bb192e9c9aa34c83abfaf8", + "integrity": "sha512-yH/G4f70cPlrwyo6jRYkhUUJfNnKBQbuXLH7OPUD2l1LS9S+z+YzEbYZd6ENgIjma5Lkf9qIpYy6viJnrigRJg==", "dev": true, "license": "MIT" }, "node_modules/@navikt/ds-css": { - "version": "5.14.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-css/5.14.0/d059737c7e7cc620a7ca3c7411b4e26b9779cf73", - "integrity": "sha512-6PdRn8Zc86vQ0MZXC2GqcEP6DeCoO0Shl94ZPErgXq2zVDnleKvmbqFxjbnT9xco8srn8WzBQ9HBbu4Io7/4CQ==", + "version": "5.15.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-css/5.15.1/bfb6b25d04e606d433e0e8f9345e74cf1de2ef93", + "integrity": "sha512-LhcFuI4YGuxPHRe0KgMniMCI5j3cLph5Wl+sr3t10+KM7fGPBTqJFV2zeLyr6ccMl5iXJiIUL850J80VK7G3gg==", "dev": true, "license": "MIT" }, @@ -1666,15 +1666,15 @@ } }, "node_modules/@navikt/ds-react": { - "version": "5.14.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-react/5.14.0/c5c2b7e6cc6b8d8a8ee508ed862e561d042e9fbf", - "integrity": "sha512-MQeaNp5PsFkxuxf2Oegj67+X4dneipw1i8cJfpvdOCrHdo5Cf38oHSYCxCfbEZgu8g0/eJVtQLnNANm84Niejw==", + "version": "5.15.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-react/5.15.1/90565836af4c3643d85330e6377b87ae0cc8cede", + "integrity": "sha512-ZJQimTCTGAfMooeZ6RAg/zaPuZBfsD1CyMTq+WZiQWtLLUnuLxgwpAVv8kMkdjiecB7rRglRfInXkfx3yQTmxg==", "dev": true, "license": "MIT", "dependencies": { "@floating-ui/react": "0.25.4", - "@navikt/aksel-icons": "^5.14.0", - "@navikt/ds-tokens": "^5.14.0", + "@navikt/aksel-icons": "^5.15.1", + "@navikt/ds-tokens": "^5.15.1", "@radix-ui/react-tabs": "1.0.0", "@radix-ui/react-toggle-group": "1.0.0", "clsx": "^1.2.1", @@ -1817,9 +1817,9 @@ } }, "node_modules/@navikt/ds-tokens": { - "version": "5.14.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-tokens/5.14.0/094f94cb19e7076e462831b1a655de628acf9172", - "integrity": "sha512-NR5dyrLQJrxdeUz6Tan5ggQeo9FUuDa8FNeZzRIxvRDJm9Uk9BKDb7THiC6edms6P7PIvVZVTczZdEqlyZibgg==", + "version": "5.15.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-tokens/5.15.1/4b154b871363b03f828b523374ef25bf2893f3c6", + "integrity": "sha512-UJkryT/uaXolJSVrLkbKTLKyC2AyEh8TG6QNDuA2bctz4+3+pUGvdLKLbR6QzA0fGa62/POwVHUXunFn5oL82A==", "dev": true, "license": "MIT" }, @@ -2525,9 +2525,9 @@ } }, "node_modules/@pkgr/core": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.0.tgz", - "integrity": "sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "dev": true, "engines": { "node": "^12.20.0 || ^14.18.0 || >=16.0.0" @@ -3232,9 +3232,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.3.tgz", - "integrity": "sha512-nrlmbvGPNGaj84IJZXMPhQuCMEVTT/hXZMJJG/aIqVL9fKxqk814sGGtJA4GI6hpJSLQjpi6cn0Qx9eOf9SDVg==", + "version": "20.11.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", + "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -4430,9 +4430,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001577", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001577.tgz", - "integrity": "sha512-rs2ZygrG1PNXMfmncM0B5H1hndY5ZCC9b5TkFaVNfZ+AUlyqcMyVIQtc3fsezi0NUCk5XZfDf9WS6WxMxnfdrg==", + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", "funding": [ { "type": "opencollective", @@ -4972,15 +4972,14 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/cypress": { - "version": "13.6.2", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.2.tgz", - "integrity": "sha512-TW3bGdPU4BrfvMQYv1z3oMqj71YI4AlgJgnrycicmPZAXtvywVFZW9DAToshO65D97rCWfG/kqMFsYB6Kp91gQ==", + "version": "13.6.3", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.3.tgz", + "integrity": "sha512-d/pZvgwjAyZsoyJ3FOsJT5lDsqnxQ/clMqnNc++rkHjbkkiF2h9s0JsZSyyH4QXhVFW3zPFg82jD25roFLOdZA==", "dev": true, "hasInstallScript": true, "dependencies": { "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", @@ -5053,15 +5052,6 @@ "fast-deep-equal": "^2.0.1" } }, - "node_modules/cypress/node_modules/@types/node": { - "version": "18.19.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.7.tgz", - "integrity": "sha512-IGRJfoNX10N/PfrReRZ1br/7SQ+2vF/tK3KXNwzXz82D32z5dMQEoOlFew18nLSN+vMNcLY4GrKfzwi/yWI8/w==", - "dev": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, "node_modules/cypress/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -5426,9 +5416,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.632", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.632.tgz", - "integrity": "sha512-JGmudTwg7yxMYvR/gWbalqqQiyu7WTFv2Xu3vw4cJHXPFxNgAk0oy8UHaer8nLF4lZJa+rNoj6GsrKIVJTV6Tw==" + "version": "1.4.634", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.634.tgz", + "integrity": "sha512-gQNahJfF5AE4MZo+pMSwmnwkzVZ+F4ZGGj4Z/MMddOXVQM0y9OHy6ts3W9SDzAJaiZM3p6eixn5ABCQ+AfXzcQ==" }, "node_modules/emoji-regex": { "version": "9.2.2", @@ -9332,9 +9322,9 @@ } }, "node_modules/prettier": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.2.tgz", - "integrity": "sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -10029,9 +10019,9 @@ } }, "node_modules/react-toastify": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.1.tgz", - "integrity": "sha512-gQ/S2StRDl/6T6gUtfQyDhlYyWx37Q469nGi94Jddx3Wq220ym2mw80Wlvx3/PNvamEvQuCjw86ZZAILA7fXPg==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.3.tgz", + "integrity": "sha512-PBJwXjFKKM73tgb6iSld4GMs9ShBWGUvc9zPHmdDgT4CdSr32iqSNh6y/fFN/tosvkTS6/tBLptDxXiXgcjvuw==", "dependencies": { "clsx": "^2.1.0" }, @@ -11624,18 +11614,18 @@ "dev": true }, "node_modules/tsconfck": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.1.2.tgz", - "integrity": "sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.0.1.tgz", + "integrity": "sha512-7ppiBlF3UEddCLeI1JRx5m2Ryq+xk4JrZuq4EuYXykipebaq1dV0Fhgr1hb7CkmHt32QSgOZlcqVLEtHBG4/mg==", "dev": true, "bin": { "tsconfck": "bin/tsconfck.js" }, "engines": { - "node": "^14.13.1 || ^16 || >=18" + "node": "^18 || >=20" }, "peerDependencies": { - "typescript": "^4.3.5 || ^5.0.0" + "typescript": "^5.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -12026,14 +12016,14 @@ } }, "node_modules/vite-tsconfig-paths": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.2.3.tgz", - "integrity": "sha512-xVsA2xe6QSlzBujtWF8q2NYexh7PAUYfzJ4C8Axpe/7d2pcERYxuxGgph9F4f0iQO36g5tyGq6eBUYIssdUrVw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.3.1.tgz", + "integrity": "sha512-cfgJwcGOsIxXOLU/nELPny2/LUD/lcf1IbfyeKTv2bsupVbTH/xpFtdQlBmIP1GEK2CjjLxYhFfB+QODFAx5aw==", "dev": true, "dependencies": { "debug": "^4.1.1", "globrex": "^0.1.2", - "tsconfck": "^2.1.0" + "tsconfck": "^3.0.1" }, "peerDependencies": { "vite": "*" diff --git a/apps/dolly-frontend/src/main/js/package.json b/apps/dolly-frontend/src/main/js/package.json index ec11b89a194..6177c5d7072 100644 --- a/apps/dolly-frontend/src/main/js/package.json +++ b/apps/dolly-frontend/src/main/js/package.json @@ -74,7 +74,7 @@ "@hookform/error-message": "^2.0.1", "@navikt/ds-css": "^5.0.3", "@navikt/ds-icons": "^3.4.3", - "@navikt/ds-react": "^5.0.3", + "@navikt/ds-react": "^5.15.0", "@redux-devtools/extension": "^3.2.3", "@reduxjs/toolkit": "^1.8.4", "@rollup/plugin-terser": "^0.4.1", diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Brreg.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Brreg.tsx index a169ac40dc2..f250de85314 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Brreg.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Brreg.tsx @@ -37,7 +37,7 @@ BrregPanel.initialValues = ({ set, del, has }) => ({ foretaksNavn: { navn1: '', }, - orgNr: '', + orgNr: null, personroller: [], }, ], diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx index 54717c21095..4619db93f41 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react' import styled from 'styled-components' import useBoolean from '@/utils/hooks/useBoolean' import * as _ from 'lodash' -import { add, eachMonthOfInterval, format, isDate } from 'date-fns' +import { add, eachMonthOfInterval, format, isAfter, isDate } from 'date-fns' import { DollySelect } from '@/components/ui/form/inputs/select/Select' import { ArbeidKodeverk } from '@/config/kodeverk' import NavButton from '@/components/ui/button/NavButton/NavButton' @@ -63,15 +63,19 @@ export const AmeldingForm = ({ warningMessage }: AmeldingFormProps): JSX.Element const handlePeriodeChange = (dato: string, type: string) => { const fixedDato = fixTimezone(dato) - formMethods.setValue(`aareg[0].genererPeriode.${type}`, fixedDato) + formMethods.setValue(`aareg[0].genererPeriode.${type}`, fixedDato, { shouldTouch: true }) if ((type === 'tom' && fom) || (type === 'fom' && tom)) { const maanederPrev: Array = formMethods.watch(paths.amelding) const maaneder: Array = [] - const maanederTmp = eachMonthOfInterval({ - start: new Date(type === 'fom' ? dato : fomDate), - end: new Date(type === 'tom' ? dato : tomDate), - }) + const startDate = dato && new Date(type === 'fom' ? dato : fomDate) + const endDate = dato && new Date(type === 'tom' ? dato : tomDate) + const maanederTmp = isAfter(endDate, startDate) + ? eachMonthOfInterval({ + start: startDate, + end: endDate, + }) + : [] maanederTmp.forEach((maaned) => { maaneder.push(format(maaned, 'yyyy-MM')) }) @@ -102,7 +106,7 @@ export const AmeldingForm = ({ warningMessage }: AmeldingFormProps): JSX.Element }) } } - formMethods.trigger() + formMethods.trigger('aareg') } const handleArbeidsforholdstypeChange = (event: KodeverkValue) => { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdToggle.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdToggle.tsx index 7bc40e6383e..c3dbc4ce0fb 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdToggle.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdToggle.tsx @@ -67,13 +67,13 @@ export const ArbeidsforholdToggle = (): ReactElement => { const handleToggleChange = (value: ArbeidsgiverTyper) => { setTypeArbeidsgiver(value) if (value === ArbeidsgiverTyper.privat) { - formMethods.setValue('aareg', [initialAaregPers]) + formMethods.resetField('aareg', { defaultValue: [initialAaregPers] }) } else if (value === ArbeidsgiverTyper.felles || value === ArbeidsgiverTyper.fritekst) { - formMethods.setValue('aareg', [initialAaregOrg]) + formMethods.resetField('aareg', { defaultValue: [initialAaregOrg] }) } else if (value === ArbeidsgiverTyper.egen) { - formMethods.setValue('aareg', [initialValues]) + formMethods.resetField('aareg', { defaultValue: [initialValues] }) } - formMethods.trigger('aareg') + formMethods.clearErrors('aareg') } const warningMessage = ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx index b8f3b226fa5..3fcaef89736 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx @@ -12,7 +12,7 @@ const initialValues = { foretaksNavn: { navn1: '', }, - orgNr: '', + orgNr: null, personroller: [], } @@ -49,6 +49,7 @@ export const EnheterForm = ({ formMethods }) => { } formMethods.setValue(path, currentValues) + formMethods.trigger(path) } return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/orgnrToggle.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/orgnrToggle.tsx index 4e3e7017264..ae6ba387119 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/orgnrToggle.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/orgnrToggle.tsx @@ -41,7 +41,7 @@ export const OrgnrToggle = ({ if (oldValues.hasOwnProperty('postAdresse')) { delete oldValues['postAdresse'] } - oldValues['orgNr'] = '' + oldValues['orgNr'] = null formMethods.setValue(path, oldValues) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/orgnummerToggle.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/orgnummerToggle.tsx index af71bd9a25a..cd302d150fe 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/orgnummerToggle.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/orgnummerToggle.tsx @@ -40,6 +40,7 @@ export const OrgnummerToggle = ({ formMethods, opplysningspliktigPath, path }: P setInputType(value) sessionStorage.setItem(ORGANISASJONSTYPE_TOGGLE, value) formMethods.setValue(path, '') + formMethods.clearErrors(path) } const handleChange = (value: { juridiskEnhet: string; orgnr: string }) => { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/KrrForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/KrrForm.tsx index b4b8fe4c480..d750621a3bf 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/KrrForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/KrrForm.tsx @@ -39,6 +39,7 @@ export const KrrstubForm = () => { } else { formMethods.setValue('krrstub.registrert', true) } + formMethods.trigger('krrstub') } return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx index 4e983a0f7fc..95a62ad5061 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx @@ -190,7 +190,11 @@ export const Kontakt = ({ formMethods, path, eksisterendeNyPerson = null }: Kont size="xlarge" placeholder={getPlaceholder(formMethods.getValues(), `${personPath}.navn`)} isLoading={loading} - onChange={(navn: string) => setNavn(navn, `${personPath}.navn`, formMethods.setValue)} + onChange={(navn: string) => { + setNavn(navn, `${personPath}.navn`, formMethods.setValue) + formMethods.setValue(`${personPath}.identifikasjonsnummer`, undefined) + formMethods.trigger(personPath) + }} value={formMethods.watch(`${personPath}.navn.fornavn`)} isDisabled={disablePersoninfo} /> diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx index 6fc22996b67..3509caa4a7e 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx @@ -140,6 +140,10 @@ export const PdlEksisterendePerson = ({ {filteredOptions?.length > 0 ? ( { + formMethods.setValue(eksisterendePersonPath, person?.value || null) + formMethods.trigger('pdldata.person.kontaktinformasjonForDoedsbo') + }} label={label} options={filteredOptions} size={'xlarge'} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/kontaktinformasjonForDoedsbo.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/kontaktinformasjonForDoedsbo.tsx index 888b6e3531e..988ee0d8744 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/kontaktinformasjonForDoedsbo.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/kontaktinformasjonForDoedsbo.tsx @@ -1,6 +1,7 @@ import * as Yup from 'yup' import { requiredDate, requiredString } from '@/utils/YupValidations' import { nyPerson } from '@/components/fagsystem/pdlf/form/validation/partials' +import * as _ from 'lodash' export const kontaktDoedsbo = Yup.object().shape({ skifteform: requiredString, @@ -53,14 +54,18 @@ export const kontaktDoedsbo = Yup.object().shape({ Yup.object().shape( { identifikasjonsnummer: Yup.mixed() - .when('foedselsdato', { + .when('navn', { is: null, then: () => requiredString, }) .nullable(), foedselsdato: Yup.mixed() .when('identifikasjonsnummer', { - is: null, + is: undefined || null, + then: () => requiredDate.nullable(), + }) + .when('navn', { + is: (v) => !_.isEmpty(v), then: () => requiredDate.nullable(), }) .nullable(), @@ -70,7 +75,7 @@ export const kontaktDoedsbo = Yup.object().shape({ etternavn: Yup.string().nullable(), }).nullable(), }, - ['identifikasjonsnummer', 'foedselsdato'] + ['identifikasjonsnummer', 'navn'], ), }) .nullable() diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx index 5f58dfa43b4..571659e7832 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx @@ -13,7 +13,7 @@ export const SkjermingForm = ({ formMethods }) => { ? isAfter( new Date(personFoerLeggTil?.skjermingsregister?.skjermetTil?.substring(0, 10)), new Date(), - ) + ) : false } else { return personFoerLeggTil?.skjermingsregister?.hasOwnProperty('skjermetFra') @@ -22,6 +22,7 @@ export const SkjermingForm = ({ formMethods }) => { const settFormikDate = (value, path) => { formMethods.setValue(`skjerming.${path}`, value) + formMethods.trigger(`skjerming.${path}`) } const harSkjerming = HarAktivSkjerming() diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/Sykemelding.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/Sykemelding.tsx index e4b235e11d7..c5fbf2b4fce 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/Sykemelding.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/Sykemelding.tsx @@ -47,7 +47,7 @@ const initialValuesDetaljertSykemelding = { manglendeTilretteleggingPaaArbeidsplassen: false, mottaker: { navn: '', - orgNr: '', + orgNr: null, adresse: { by: '', gate: '', diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/uforetrygd/form/Form.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/uforetrygd/form/Form.tsx index 318ec6626fc..8a1b2a99266 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/uforetrygd/form/Form.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/uforetrygd/form/Form.tsx @@ -47,9 +47,10 @@ export const UforetrygdForm = () => { name={`${uforetrygdPath}.onsketVirkningsDato`} label="Ønsket virkningsdato" date={formMethods.getValues(`${uforetrygdPath}.onsketVirkningsDato`)} - handleDateChange={(dato: string) => + handleDateChange={(dato: string) => { formMethods.setValue(`${uforetrygdPath}.onsketVirkningsDato`, dato) - } + formMethods.trigger(`${uforetrygdPath}`) + }} /> { const datoTom = _.get(testContext.parent, tomPath) if (!value || !datoTom) return true - if (isEqual(new Date(value), new Date(datoTom))) return true - return isBefore(new Date(value), new Date(datoTom)) + if (isEqual(value, datoTom)) return true + return isBefore(value, datoTom) }) } @@ -15,8 +15,8 @@ export const testDatoTom = (val, fomPath, feilmelding = 'Dato må være etter fr return val.test('is-after-fom', feilmelding, (value, testContext) => { const datoFom = _.get(testContext.parent, fomPath) if (!value || !datoFom) return true - if (isEqual(new Date(value), new Date(datoFom))) return true - return isAfter(new Date(value), new Date(datoFom)) + if (isEqual(value, datoFom)) return true + return isAfter(value, datoFom) }) } diff --git a/apps/dolly-frontend/src/main/js/src/components/organisasjonSelect/OrganisasjonLoader.tsx b/apps/dolly-frontend/src/main/js/src/components/organisasjonSelect/OrganisasjonLoader.tsx index a57a775c40a..ba489496d28 100644 --- a/apps/dolly-frontend/src/main/js/src/components/organisasjonSelect/OrganisasjonLoader.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/organisasjonSelect/OrganisasjonLoader.tsx @@ -69,7 +69,7 @@ export const OrganisasjonLoader = ({ /> ) : ( { const formMethods = useFormContext() - const val = value || formMethods?.watch(name) + const val = formMethods?.watch(name) let _value = isMulti ? options?.filter?.((o) => val?.some((el) => el === o?.value)) : options?.filter?.((o) => { diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/textInput/TextInput.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/textInput/TextInput.tsx index 106762998db..8894b7fa772 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/textInput/TextInput.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/textInput/TextInput.tsx @@ -49,10 +49,11 @@ export const TextInput = React.forwardRef( getFieldState, } = useFormContext() const errorContext: ShowErrorContextType = useContext(ShowErrorContext) - const isTouched = _.has(touchedFields, name) + const isTouched = _.has(touchedFields, name) || _.has(touchedFields, fieldName) const feil = getFieldState(fieldName)?.error || getFieldState(name)?.error + const visFeil = feil && (errorContext?.showError || isTouched) const css = cn('skjemaelement__input', className, { - 'skjemaelement__input--harFeil': feil && (errorContext?.showError || isTouched), + 'skjemaelement__input--harFeil': visFeil, }) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/kategori/Kategori.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/kategori/Kategori.tsx index f6e2ed39e03..4bc872839f6 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/kategori/Kategori.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/kategori/Kategori.tsx @@ -15,10 +15,10 @@ export const Kategori = ({ const css = flexRow ? cn({ 'form-kategori-flex-row': flex, - }) + }) : cn({ 'form-kategori-flex': flex, - }) + }) const render = (
diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useWeather.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useWeather.tsx index e3a5a3d1c9b..d1e25795b74 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useWeather.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useWeather.tsx @@ -17,7 +17,7 @@ export const useWeatherFyrstikkAlleen = () => { const millimeterNedboer = data?.properties?.timeseries?.[0]?.data?.next_6_hours?.details?.precipitation_amount - const nedBoerType = data?.properties?.timeseries?.[0]?.data?.next_6_hou + const nedBoerType = data?.properties?.timeseries?.[0]?.data?.next_6_hours?.summary?.symbol_code return { millimeterNedboer: millimeterNedboer ? millimeterNedboer * 10 : 0,