From 0022bfde9037e1797152b795a816b0330e577cfa Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Wed, 10 Apr 2024 18:09:04 +0200 Subject: [PATCH 01/13] Fix visning av valgte egenskaper --- .../stegVelger/steg/steg1/Steg1Person.tsx | 9 ++- .../steg/steg1/paneler/Personinformasjon.tsx | 60 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/Steg1Person.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/Steg1Person.tsx index 5c19ac21c4f..5df1f2958c3 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/Steg1Person.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/Steg1Person.tsx @@ -53,11 +53,10 @@ export const Steg1Person = ({ stateModifier }: any) => { ] .map((panel) => ({ label: panel.heading, - values: stateModifier(panel.initialValues).checked, - })) - .map((v) => ({ - ...v, - values: v?.values.filter((val) => !personFoerLeggTil && !leggTil && val !== 'Alder'), + values: stateModifier(panel.initialValues).checked?.filter( + (val: string) => + (!personFoerLeggTil && !leggTil) || ((personFoerLeggTil || leggTil) && val !== 'Alder'), + ), })) .filter((v) => v.values.length) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx index 6ab6d2896db..c8668f85329 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx @@ -180,6 +180,8 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => { skjerming: 'skjerming.egenAnsattDatoTom', }, skjermetFra: 'skjermingsregister.skjermetFra', + norskBankkonto: 'bankkonto.norskBankkonto', + utenlandskBankkonto: 'bankkonto.utenlandskBankkonto', telefonnummer: { pdl: 'pdldata.person.telefonnummer', tpsM: 'tpsMessaging.telefonnummer', @@ -188,8 +190,6 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => { fullmakt: 'pdldata.person.fullmakt', sikkerhetstiltak: 'pdldata.person.sikkerhetstiltak', tilrettelagtKommunikasjon: 'pdldata.person.tilrettelagtKommunikasjon', - utenlandskBankkonto: 'bankkonto.utenlandskBankkonto', - norskBankkonto: 'bankkonto.norskBankkonto', } return { @@ -301,6 +301,34 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => { del('skjerming') }, }, + norskBankkonto: { + label: 'Norsk bank', + checked: has(paths.norskBankkonto), + add: () => + set(paths.norskBankkonto, { + kontonummer: '', + tilfeldigKontonummer: opts.antall && opts.antall > 1, + }), + remove: () => del(paths.norskBankkonto), + }, + utenlandskBankkonto: { + label: 'Utenlandsk bank', + checked: has(paths.utenlandskBankkonto), + add: () => + set(paths.utenlandskBankkonto, { + kontonummer: '', + tilfeldigKontonummer: false, + swift: 'BANKXX11222', + landkode: null, + banknavn: '', + iban: '', + valuta: null, + bankAdresse1: '', + bankAdresse2: '', + bankAdresse3: '', + }), + remove: () => del(paths.utenlandskBankkonto), + }, telefonnummer: { label: 'Telefonnummer', checked: has(paths.telefonnummer.pdl), @@ -369,33 +397,5 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => { del(paths.tilrettelagtKommunikasjon) }, }, - utenlandskBankkonto: { - label: 'Utenlandsk bank', - checked: has(paths.utenlandskBankkonto), - add: () => - set(paths.utenlandskBankkonto, { - kontonummer: '', - tilfeldigKontonummer: false, - swift: 'BANKXX11222', - landkode: null, - banknavn: '', - iban: '', - valuta: null, - bankAdresse1: '', - bankAdresse2: '', - bankAdresse3: '', - }), - remove: () => del(paths.utenlandskBankkonto), - }, - norskBankkonto: { - label: 'Norsk bank', - checked: has(paths.norskBankkonto), - add: () => - set(paths.norskBankkonto, { - kontonummer: '', - tilfeldigKontonummer: opts.antall && opts.antall > 1, - }), - remove: () => del(paths.norskBankkonto), - }, } } From 8a4b858ecad8bfdbe8116ef42fda52774b186659 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Thu, 11 Apr 2024 14:18:47 +0200 Subject: [PATCH 02/13] Omskrivning henting av arenadata --- .../bestillingsveileder/Bestillingsveileder.tsx | 4 ++-- .../bestillingsveileder/options/options.tsx | 11 ----------- .../src/pages/gruppe/PersonVisning/PersonVisning.tsx | 3 +++ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/Bestillingsveileder.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/Bestillingsveileder.tsx index 9123fe97ced..c73b96cce67 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/Bestillingsveileder.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/Bestillingsveileder.tsx @@ -14,7 +14,7 @@ export const Bestillingsveileder = ({ error, sendBestilling }) => { const navigate = useNavigate() const [showError, setShowError] = useState(false) const [navigateRoot, setNavigateRoot] = useState(false) - const { gruppeId, personId } = useParams() + const { gruppeId } = useParams() const erOrganisasjon = location?.state?.opprettOrganisasjon const importPersoner = location?.state?.importPersoner @@ -46,7 +46,7 @@ export const Bestillingsveileder = ({ error, sendBestilling }) => { return null } - const options = BVOptions(location.state, gruppeId, personId) + const options = BVOptions(location.state, gruppeId) const handleSubmit = (values) => { sendBestilling(values, options, gruppeId, navigate) } diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx index 7f84f5973a1..d65dc99ee3f 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx @@ -1,6 +1,4 @@ import { initialValuesBasedOnMal } from '@/components/bestillingsveileder/options/malOptions' -import { useArenaData } from '@/utils/hooks/useFagsystemer' -import { harArenaBestilling } from '@/utils/SjekkBestillingFagsystem' const TYPE = Object.freeze({ NY_BESTILLING: 'NY_BESTILLING', @@ -29,7 +27,6 @@ export const BVOptions = ( gruppe, } = {}, gruppeId, - personId, ) => { let initialValues = { antall: antall || 1, @@ -114,14 +111,6 @@ export const BVOptions = ( initialValues = initialValuesLeggTil } - if (personFoerLeggTil) { - const bestillinger = tidligereBestillinger?.map((best) => best?.data) - const { arenaData } = useArenaData(personId, harArenaBestilling(bestillinger)) - if (arenaData && arenaData.length > 0) { - personFoerLeggTil.arenaforvalteren = arenaData - } - } - if (leggTilPaaGruppe) { bestType = TYPE.LEGG_TIL_PAA_GRUPPE initialValues = initialValuesLeggTilPaaGruppe diff --git a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx index be1e792ae3f..987613e8892 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx @@ -371,6 +371,9 @@ export default ({ if (arbeidsplassencvData) { personData.arbeidsplassenCV = { harHjemmel: getArbeidsplassencvHjemmel() } } + if (arenaData) { + personData.arenaforvalteren = arenaData + } leggTilPaaPerson( personData, bestillingListe, From 302fad22dcb35e94e2e44f5bdba1389c2aaa5258 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Fri, 12 Apr 2024 13:51:08 +0200 Subject: [PATCH 03/13] Fikset miljoe-validering som ikke oppdaterte --- .../bestillingsveileder/stegVelger/steg/steg3/Steg3.tsx | 1 + .../src/main/js/src/components/miljoVelger/MiljoVelger.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg3/Steg3.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg3/Steg3.tsx index 760e86fc6d2..1015f43bd26 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg3/Steg3.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg3/Steg3.tsx @@ -81,6 +81,7 @@ export const Steg3 = () => { if (harRelatertPersonVedSivilstand || harEksisterendeNyIdent || harRelatertPersonBarn) { formMethods.setValue('malBestillingNavn', undefined) } + formMethods.trigger('environments') }, []) const visMiljoeVelger = formMethods.watch('environments') diff --git a/apps/dolly-frontend/src/main/js/src/components/miljoVelger/MiljoVelger.tsx b/apps/dolly-frontend/src/main/js/src/components/miljoVelger/MiljoVelger.tsx index 49067d80154..63d721634ed 100644 --- a/apps/dolly-frontend/src/main/js/src/components/miljoVelger/MiljoVelger.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/miljoVelger/MiljoVelger.tsx @@ -96,6 +96,7 @@ export const MiljoVelger = ({ isChecked(id) ? values.filter((value) => value !== id) : values.concat(id), ) } + formMethods.trigger('environments') } return ( @@ -110,7 +111,7 @@ export const MiljoVelger = ({ )}
- Miljøer + Miljøer
{filteredEnvironments.map((env) => ( Date: Fri, 12 Apr 2024 15:57:08 +0200 Subject: [PATCH 04/13] Update maler api --- .../src/main/js/src/service/services/dolly/DollyEndpoints.tsx | 4 ++-- apps/dolly-frontend/src/main/js/src/utils/hooks/useMaler.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx b/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx index ca892189c71..3b6e2486654 100644 --- a/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx @@ -182,11 +182,11 @@ export default class DollyEndpoints { } static malBestillingMedId(malId, malNavn) { - return `${bestillingBase}/malbestilling/${malId}?malNavn=${malNavn}` + return `${uri}/malbestilling/id/${malId}?malNavn=${malNavn}` } static malBestillingMedBestillingId(bestillingId, malNavn) { - return `${bestillingBase}/malbestilling?bestillingId=${bestillingId}&malNavn=${malNavn}` + return `${uri}/malbestilling?bestillingId=${bestillingId}&malNavn=${malNavn}` } static organisasjonMalBestillingMedBestillingId(bestillingId, malNavn) { diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useMaler.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useMaler.tsx index 446d00a8dbc..7ab0e019db1 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useMaler.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useMaler.tsx @@ -1,7 +1,7 @@ import useSWR from 'swr' import { fetcher } from '@/api' -const getMalerUrl = '/dolly-backend/api/v1/bestilling/malbestilling' +const getMalerUrl = '/dolly-backend/api/v1/malbestilling' const getOrganisasjonMalerUrl = '/dolly-backend/api/v1/organisasjon/bestilling/malbestilling' export type Mal = { From f33a88b7663effa192371fcd121fa675cce83b8f Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Mon, 15 Apr 2024 16:10:51 +0200 Subject: [PATCH 05/13] Fikset feil ved sletting av mal --- .../bestillingsveileder/options/malOptions.tsx | 6 ++---- .../bestillingsveileder/options/options.tsx | 10 ++++++++-- .../main/js/src/pages/minSide/maler/MalPanel.tsx | 14 ++++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx index 16e978bc026..8e6bded7274 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx @@ -14,11 +14,9 @@ import { SivilstandData, VergemaalValues, } from '@/components/fagsystem/pdlf/PdlTypes' -import { useDollyEnvironments } from '@/utils/hooks/useEnvironments' import { addMonths, isAfter, setDate } from 'date-fns' -export const initialValuesBasedOnMal = (mal: any) => { - const { dollyEnvironments } = useDollyEnvironments() +export const initialValuesBasedOnMal = (mal: any, environments: any) => { const initialValuesMal = Object.assign({}, mal.bestilling) if (initialValuesMal.aareg) { @@ -85,7 +83,7 @@ export const initialValuesBasedOnMal = (mal: any) => { delete initialValuesMal.tpsMessaging.utenlandskBankkonto } - initialValuesMal.environments = filterMiljoe(dollyEnvironments, mal.bestilling?.environments) + initialValuesMal.environments = filterMiljoe(environments, mal.bestilling?.environments) return initialValuesMal } diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx index d65dc99ee3f..bc6a04ed893 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/options.tsx @@ -1,4 +1,5 @@ import { initialValuesBasedOnMal } from '@/components/bestillingsveileder/options/malOptions' +import { useDollyEnvironments } from '@/utils/hooks/useEnvironments' const TYPE = Object.freeze({ NY_BESTILLING: 'NY_BESTILLING', @@ -28,6 +29,8 @@ export const BVOptions = ( } = {}, gruppeId, ) => { + const { dollyEnvironments } = useDollyEnvironments() + let initialValues = { antall: antall || 1, beskrivelse: null, @@ -98,7 +101,7 @@ export const BVOptions = ( if (mal) { bestType = TYPE.NY_BESTILLING_FRA_MAL - initialValues = Object.assign(initialValues, initialValuesBasedOnMal(mal)) + initialValues = Object.assign(initialValues, initialValuesBasedOnMal(mal, dollyEnvironments)) } if (opprettFraIdenter) { @@ -130,7 +133,10 @@ export const BVOptions = ( initialValues = initialValuesStandardOrganisasjon } else if (mal) { bestType = TYPE.NY_ORGANISASJON_FRA_MAL - initialValues = Object.assign(initialValuesOrganisasjon, initialValuesBasedOnMal(mal)) + initialValues = Object.assign( + initialValuesOrganisasjon, + initialValuesBasedOnMal(mal, dollyEnvironments), + ) } else { bestType = TYPE.NY_ORGANISASJON initialValues = initialValuesOrganisasjon diff --git a/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx b/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx index bf841644e8f..77b7d8a79b1 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx @@ -1,6 +1,6 @@ import React from 'react' import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary' -import { Button, Panel, Table } from '@navikt/ds-react' +import { Box, Button, Table } from '@navikt/ds-react' import { Mal } from '@/utils/hooks/useMaler' import { EndreMalnavn } from './EndreMalnavn' import { CypressSelector } from '../../../../cypress/mocks/Selectors' @@ -9,6 +9,7 @@ import StyledAlert from '@/components/ui/alert/StyledAlert' import { PencilWritingIcon } from '@navikt/aksel-icons' import { SlettMal } from '@/pages/minSide/maler/SlettMal' import { initialValuesBasedOnMal } from '@/components/bestillingsveileder/options/malOptions' +import { useDollyEnvironments } from '@/utils/hooks/useEnvironments' type Props = { antallEgneMaler: any @@ -29,6 +30,8 @@ export const MalPanel = ({ underRedigering, setUnderRedigering, }: Props) => { + const { dollyEnvironments } = useDollyEnvironments() + const erUnderRedigering = (id: number) => underRedigering.includes(id) const avsluttRedigering = (id: number) => { @@ -80,7 +83,7 @@ export const MalPanel = ({ ) return ( - + {antallEgneMaler > 0 ? ( malerFiltrert(malListe, searchText).length > 0 ? ( @@ -97,7 +100,10 @@ export const MalPanel = ({ {maler.map(({ malNavn, id, bestilling }) => { - const bestillingBasedOnMal = initialValuesBasedOnMal({ bestilling: bestilling }) + const bestillingBasedOnMal = initialValuesBasedOnMal( + { bestilling: bestilling }, + dollyEnvironments, + ) return ( )} - + ) } From c1cfca5f462020d21b933c13aad56cf9395dd725 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Mon, 15 Apr 2024 17:01:34 +0200 Subject: [PATCH 06/13] Fiks aapen fane paa valgte attributter --- .../stegVelger/steg/steg1/paneler/Pensjon.tsx | 9 ++++++++- .../src/components/fagsystem/alderspensjon/form/Form.tsx | 2 +- .../js/src/components/fagsystem/uforetrygd/form/Form.tsx | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Pensjon.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Pensjon.tsx index 0f2a326d61b..4e8409f8376 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Pensjon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Pensjon.tsx @@ -13,6 +13,8 @@ import { BestillingsveilederContext } from '@/components/bestillingsveileder/Bes import { initialUforetrygd } from '@/components/fagsystem/uforetrygd/initialValues' import { runningCypressE2E } from '@/service/services/Request' import _ from 'lodash' +import { alderspensjonPath } from '@/components/fagsystem/alderspensjon/form/Form' +import { uforetrygdPath } from '@/components/fagsystem/uforetrygd/form/Form' export const PensjonPanel = ({ stateModifier, formValues }: any) => { const sm = stateModifier(PensjonPanel.initialValues) @@ -80,7 +82,12 @@ export const PensjonPanel = ({ stateModifier, formValues }: any) => { }} uncheckAttributeArray={sm.batchRemove} iconType="pensjon" - startOpen={harValgtAttributt(formValues, [pensjonPath, tpPath])} + startOpen={harValgtAttributt(formValues, [ + pensjonPath, + tpPath, + alderspensjonPath, + uforetrygdPath, + ])} > diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/Form.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/Form.tsx index 52764cecfe6..373a7c68df8 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/Form.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/Form.tsx @@ -33,7 +33,7 @@ const StyledAlert = styled(Alert)` } ` -const alderspensjonPath = 'pensjonforvalter.alderspensjon' +export const alderspensjonPath = 'pensjonforvalter.alderspensjon' export const AlderspensjonForm = () => { const formMethods = useFormContext() 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 0e1225fba2f..af4576367ea 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 @@ -13,7 +13,7 @@ import { validation } from '@/components/fagsystem/uforetrygd/form/validation' import { Monthpicker } from '@/components/ui/form/inputs/monthpicker/Monthpicker' import { useFormContext } from 'react-hook-form' -const uforetrygdPath = 'pensjonforvalter.uforetrygd' +export const uforetrygdPath = 'pensjonforvalter.uforetrygd' export const UforetrygdForm = () => { const formMethods = useFormContext() From c323f5569b782ad29d981cb6c722b94accf3fb6f Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Tue, 16 Apr 2024 10:54:09 +0200 Subject: [PATCH 07/13] Fiks setting og fjerning av hjemmel paa cv --- .../bestillingsveileder/stateModifier.tsx | 6 +++++- .../steg/steg1/paneler/Arbeidsplassen.tsx | 18 +++++++++--------- .../main/js/src/utils/DisplayFormErrors.tsx | 2 +- .../src/main/js/src/utils/DisplayFormState.tsx | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stateModifier.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stateModifier.tsx index 78c9b364776..05fb3d88bbe 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stateModifier.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stateModifier.tsx @@ -11,6 +11,9 @@ export const useStateModifierFns = (formMethods: UseFormReturn) => { const has = (path) => { return formMethods.watch(path) !== undefined } + const values = (path) => { + return formMethods.watch(path) + } const del = (path) => { if (isArray(path)) { path.forEach((p) => { @@ -58,10 +61,11 @@ export const useStateModifierFns = (formMethods: UseFormReturn) => { opts: any del: (path: any) => void has: (path: any) => boolean + values: (path: any) => any methods: any }) => {}, ) => { - const attrs = fn({ set, setMulti, opts, del, has, methods: formMethods }) || {} + const attrs = fn({ set, setMulti, opts, del, has, values, methods: formMethods }) || {} const checked = allCheckedLabels(attrs) return { attrs, diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Arbeidsplassen.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Arbeidsplassen.tsx index bfd5e200ffb..89aef3229c2 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Arbeidsplassen.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Arbeidsplassen.tsx @@ -18,7 +18,6 @@ import { initialSpraakVerdier, initialUtdanningVerdier, } from '@/components/fagsystem/arbeidsplassen/form/initialValues' -import _get from 'lodash/get' import _has from 'lodash/has' import { isBoolean } from 'lodash' @@ -53,25 +52,26 @@ export const ArbeidsplassenPanel = ({ stateModifier, formValues }) => { ArbeidsplassenPanel.heading = 'Arbeidsplassen (CV)' -ArbeidsplassenPanel.initialValues = ({ setMulti, opts, del, has, initial }) => { +ArbeidsplassenPanel.initialValues = ({ setMulti, opts, del, has, values }) => { const { personFoerLeggTil } = opts const personFoerLeggTilHarHjemmel = personFoerLeggTil?.arbeidsplassenCV?.harHjemmel const hjemmel = () => { - if (_has(initial, 'arbeidsplassenCV.harHjemmel')) { - return _get(initial, 'arbeidsplassenCV.harHjemmel') + if (has('arbeidsplassenCV.harHjemmel')) { + return values('arbeidsplassenCV.harHjemmel') } else if (isBoolean(personFoerLeggTilHarHjemmel)) { return personFoerLeggTilHarHjemmel } return true } - const fjernHjemmelPath = (fjernPath) => { + const fjernHjemmelPath = (fjernPath: string) => { + const selected = values() if ( - initial?.arbeidsplassenCV && - Object.keys(initial.arbeidsplassenCV)?.length === 2 && - _has(initial, fjernPath) && - _has(initial, 'arbeidsplassenCV.harHjemmel') + selected?.arbeidsplassenCV && + Object.keys(selected?.arbeidsplassenCV)?.length === 2 && + _has(selected, fjernPath) && + _has(selected, 'arbeidsplassenCV.harHjemmel') ) { return [fjernPath, 'arbeidsplassenCV.harHjemmel'] } diff --git a/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx b/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx index 98d681fa138..be7f50edf33 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx @@ -25,7 +25,7 @@ export default function DisplayFormErrors({
Date: Tue, 16 Apr 2024 11:03:53 +0200 Subject: [PATCH 08/13] Fiks label paa fritekstfelt --- .../js/src/components/fagsystem/arbeidsplassen/form/styles.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/styles.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/styles.tsx index e9a351e58df..788cf1b7aff 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/styles.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/styles.tsx @@ -25,7 +25,6 @@ export const Fritekstfelt = styled(Textarea)` font-size: 0.75em; text-transform: uppercase; font-weight: 400; - margin-bottom: -8px; } } ` From ba6533a5992e995d4ff4e4e7aa4c1d2abba5443c Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Wed, 17 Apr 2024 16:37:45 +0200 Subject: [PATCH 09/13] Fix form state og utkast paa amelding mal-fix --- .../bestillingsveileder/options/malOptions.tsx | 10 ++++++++++ .../src/main/js/src/utils/DisplayFormErrors.tsx | 2 ++ .../src/main/js/src/utils/DisplayFormState.tsx | 2 ++ 3 files changed, 14 insertions(+) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx index 8e6bded7274..ce8be127ed1 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/options/malOptions.tsx @@ -138,7 +138,17 @@ const getUpdatedInntektstubData = (inntektstubData: any) => { const getUpdatedAaregData = (aaregData: any) => { return aaregData.map((data: any) => { + console.log('initialValues: ', initialValues) //TODO - SLETT MEG data = updateData(data, initialValues.aareg[0]) + // data = updateData(data, initialValues.aareg) + //TODO: Funker, men proev aa skriv bedre ved hjelp av initialvalues + //TODO: Og sjekk om det funker paa alle andre typer arb.forh. ogsaa + if (data.amelding && data.amelding.length > 0) { + data.ansettelsesPeriode = undefined + data.arbeidsgiver = undefined + data.arbeidsavtale = undefined + } + console.log('data: ', data) //TODO - SLETT MEG data.permisjon = data.permisjon?.map((permisjon: any) => updateData(permisjon, initialValues.permisjon), ) diff --git a/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx b/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx index be7f50edf33..b1d84e9f926 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/DisplayFormErrors.tsx @@ -26,6 +26,8 @@ export default function DisplayFormErrors({ onClick={toggleShowState} style={{ position: 'fixed', + maxHeight: '100%', + overflow: 'auto', top: 40, right: 0, background: '#f6f8fa', diff --git a/apps/dolly-frontend/src/main/js/src/utils/DisplayFormState.tsx b/apps/dolly-frontend/src/main/js/src/utils/DisplayFormState.tsx index 6b99f884c0d..891219a7062 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/DisplayFormState.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/DisplayFormState.tsx @@ -23,6 +23,8 @@ export default function DisplayFormState({ visState = false, label = 'Vis form' onClick={toggleShowState} style={{ position: 'fixed', + maxHeight: '100%', + overflow: 'auto', top: 0, right: 0, background: '#f6f8fa', From 46dc40eeb32c086b3e40da77159c703deb05eb9f Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Wed, 17 Apr 2024 17:26:02 +0200 Subject: [PATCH 10/13] Malpanel css-fix --- .../src/main/js/src/pages/minSide/maler/MalPanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx b/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx index 77b7d8a79b1..61f476cfa39 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/minSide/maler/MalPanel.tsx @@ -44,7 +44,7 @@ export const MalPanel = ({ const DataCells = ({ id, malNavn, bestilling }) => ( <> - + {erUnderRedigering(id) ? ( {malNavn} )} - + {erUnderRedigering(id) ? ( {isGjenopprettModalOpen && ( Date: Fri, 19 Apr 2024 10:24:27 +0200 Subject: [PATCH 13/13] Nullstill markerete personer ved soek change --- .../src/main/js/src/pages/tenorSoek/SoekForm.tsx | 4 +++- .../src/main/js/src/pages/tenorSoek/TenorSoekPage.tsx | 5 ++++- .../pages/tenorSoek/resultatVisning/TreffListe.tsx | 11 ++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/SoekForm.tsx b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/SoekForm.tsx index 3b7e25e1b9c..79d4e054955 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/SoekForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/SoekForm.tsx @@ -28,7 +28,7 @@ const Soekefelt = styled.div` padding: 20px 15px; ` -export const SoekForm = ({ setRequest, mutate }: any) => { +export const SoekForm = ({ setRequest, setMarkertePersoner, mutate }: any) => { const formMethods = useForm({ mode: 'onChange', defaultValues: {}, @@ -55,6 +55,7 @@ export const SoekForm = ({ setRequest, mutate }: any) => { setValue(path, value) const request = getUpdatedRequest(watch()) setRequest({ ...request }) + setMarkertePersoner([]) mutate() } @@ -63,6 +64,7 @@ export const SoekForm = ({ setRequest, mutate }: any) => { setValue(path, list) const request = getUpdatedRequest(watch()) setRequest({ ...request }) + setMarkertePersoner([]) mutate() } diff --git a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/TenorSoekPage.tsx b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/TenorSoekPage.tsx index b1078ffa61a..28acecbd0aa 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/TenorSoekPage.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/TenorSoekPage.tsx @@ -15,6 +15,7 @@ export default () => { const [request, setRequest] = useState({}) const [state, setState] = useState(initialState) const { response, loading, error, mutate } = useTenorOversikt(request, 10, state.side, state.seed) + const [markertePersoner, setMarkertePersoner] = useState([]) useEffect(() => { setState(initialState) @@ -76,10 +77,12 @@ export default () => {
</div> - <SoekForm setRequest={setRequest} mutate={mutate} /> + <SoekForm setRequest={setRequest} setMarkertePersoner={setMarkertePersoner} mutate={mutate} /> <TreffListe response={response?.data} personListe={state.personListe} + markertePersoner={markertePersoner} + setMarkertePersoner={setMarkertePersoner} loading={loading} error={error} /> diff --git a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/TreffListe.tsx b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/TreffListe.tsx index 813510cdf94..bf45cc6f679 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/TreffListe.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/TreffListe.tsx @@ -22,7 +22,14 @@ const TagsWrapper = styled.div` margin: 10px 0; ` -export const TreffListe = ({ response, personListe, loading, error }: any) => { +export const TreffListe = ({ + response, + personListe, + markertePersoner, + setMarkertePersoner, + loading, + error, +}: any) => { const [valgtPerson, setValgtPerson] = useState<any>(null) const { @@ -35,8 +42,6 @@ export const TreffListe = ({ response, personListe, loading, error }: any) => { setValgtPerson(personListe?.[0] || null) }, [personListe?.[0]]) - const [markertePersoner, setMarkertePersoner] = useState([]) - if ((!personListe || personListe?.length === 0) && loading) { return <Loading label="Laster treff ..." /> }