Skip to content

Commit

Permalink
TSFF-633 - fikser typing og skriver bort redux-form i prosess-søknads…
Browse files Browse the repository at this point in the history
…frist (#6349)

* TSFF-633 - fikser typing og skriver bort redux-form
Legger til knapp som muligjør endring av vurdering

* Fikser i stories

* Gjenoppretter story

* La til tester
Fikset resetting av form
Skrevet bort siste rest av redux-form

* Retter tester

* Justerer css

* Sjekker på om begrunnelse finnes før man kan redigere den

* Flytter avbrytknapp til mer logisk sted
Liten oppdatering av story

* Fjerner bruk av react-intl, må beholde RawIntlProvider pga felleskomponenter som trenger

* Fikser paneltittel

* Fikser visning av løst aksjonspunkt

* prettier av package.json
  • Loading branch information
hallvardastark authored Aug 21, 2024
1 parent b061dc8 commit 23c23c7
Show file tree
Hide file tree
Showing 24 changed files with 811 additions and 800 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@
"workerDirectory": "public"
},
"lint-staged": {
"packages/**/!(*.module.d.css).(ts|tsx|js|jsx)": ["eslint --cache --fix", "prettier --write"],
"packages/**/*.css": ["stylelint --fix", "prettier --write"]
"packages/**/!(*.module.d.css).(ts|tsx|js|jsx)": [
"eslint --cache --fix",
"prettier --write"
],
"packages/**/*.css": [
"stylelint --fix",
"prettier --write"
]
},
"packageManager": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';

import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import aksjonspunktCodes from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { ProsessStegPanelDef } from '@k9-sak-web/behandling-felles';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import { OmsorgspengerBehandlingApiKeys } from '../../../data/omsorgspengerBehandlingApi';

class SoknadsfristPanelDef extends ProsessStegPanelDef {
getId = () => 'SOKNADSFRIST';

getTekstKode = () => 'Inngangsvilkar.Soknadsfrist';
getTekstKode = () => 'Søknadsfrist';

getKomponent = props => <SoknadsfristVilkarProsessIndex {...props} />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';

import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import aksjonspunktCodes from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { ProsessStegPanelDef } from '@k9-sak-web/behandling-felles';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import { OpplaeringspengerBehandlingApiKeys } from '../../../data/opplaeringspengerBehandlingApi';

class SoknadsfristPanelDef extends ProsessStegPanelDef {
getId = () => 'SOKNADSFRIST';

getTekstKode = () => 'Inngangsvilkar.Soknadsfrist';
getTekstKode = () => 'Søknadsfrist';

getKomponent = props => <SoknadsfristVilkarProsessIndex {...props} />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';

import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import aksjonspunktCodes from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { ProsessStegPanelDef } from '@k9-sak-web/behandling-felles';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import { PleiepengerSluttfaseBehandlingApiKeys } from '../../../data/pleiepengerSluttfaseBehandlingApi';

class SoknadsfristPanelDef extends ProsessStegPanelDef {
getId = () => 'SOKNADSFRIST';

getTekstKode = () => 'Inngangsvilkar.Soknadsfrist';
getTekstKode = () => 'Søknadsfrist';

getKomponent = props => <SoknadsfristVilkarProsessIndex {...props} />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';

import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import aksjonspunktCodes from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import kodeverkTyper from '@fpsak-frontend/kodeverk/src/kodeverkTyper';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { ProsessStegPanelDef } from '@k9-sak-web/behandling-felles';
import SoknadsfristVilkarProsessIndex from '@k9-sak-web/prosess-vilkar-soknadsfrist';
import { PleiepengerBehandlingApiKeys } from '../../../data/pleiepengerBehandlingApi';

class SoknadsfristPanelDef extends ProsessStegPanelDef {
getId = () => 'SOKNADSFRIST';

getTekstKode = () => 'Inngangsvilkar.Soknadsfrist';
getTekstKode = () => 'Søknadsfrist';

getKomponent = props => <SoknadsfristVilkarProsessIndex {...props} />;

Expand Down
55 changes: 34 additions & 21 deletions packages/form/src/hook-form/RadioGroupPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { ErrorMessage } from '@hookform/error-message';
import { Radio, RadioGroup } from '@navikt/ds-react';
import React from 'react';
import React, { ReactElement } from 'react';
import { Controller, useFormContext } from 'react-hook-form';
import { getError } from './formUtils';

interface RadioProps {
value: string;
label: React.ReactNode;
id?: string;
element?: ReactElement;
}

interface RadioGroupPanelProps {
Expand All @@ -17,47 +18,59 @@ interface RadioGroupPanelProps {
validators?: { [key: string]: (v: any) => string | boolean | undefined };
onChange?: (value) => void;
disabled?: boolean;
readOnly?: boolean;
}

const RadioGroupPanel = ({ question, name, validators, radios, onChange, disabled }: RadioGroupPanelProps) => {
const RadioGroupPanel = ({
question,
name,
validators,
radios,
onChange,
disabled,
readOnly,
}: RadioGroupPanelProps) => {
const { control, formState } = useFormContext();
const { errors } = formState;
const customOnChange = onChange;
return (
<Controller
control={control}
defaultValue={null}
name={name}
rules={{
validate: {
...validators,
},
}}
render={props => {
const reactHookFormOnChange = props.field.onChange;
render={({ field }) => {
const reactHookFormOnChange = field.onChange;
const valueToString = `${field.value}`;
return (
<RadioGroup
legend={question}
error={getError(errors, name) && <ErrorMessage errors={errors} name={name} />}
size="small"
readOnly={readOnly}
value={valueToString}
>
{radios.map(radio => (
<Radio
key={radio.value}
id={radio.id || radio.value}
name={name}
onChange={() => {
if (customOnChange) {
customOnChange(radio.value);
}
reactHookFormOnChange(radio.value);
}}
checked={radio.value === props.field.value}
disabled={disabled}
value={radio.value}
>
{radio.label}
</Radio>
<React.Fragment key={radio.value}>
<Radio
id={radio.id || radio.value}
name={name}
onChange={() => {
if (customOnChange) {
customOnChange(radio.value);
}
reactHookFormOnChange(radio.value);
}}
disabled={disabled}
value={radio.value}
>
{radio.label}
</Radio>
{radio.value === field.value && radio.element}
</React.Fragment>
))}
</RadioGroup>
);
Expand Down
106 changes: 0 additions & 106 deletions packages/prosess-vilkar-soknadsfrist/i18n/nb_NO.json

This file was deleted.

10 changes: 4 additions & 6 deletions packages/prosess-vilkar-soknadsfrist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
"@fpsak-frontend/utils": "1.0.0",
"@k9-sak-web/sak-app": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-form-hooks": "4.4.19",
"@navikt/ft-form-validators": "2.3.17",
"@navikt/ft-plattform-komponenter": "3.0.4",
"classnames": "2.5.1",
"moment": "2.30.1",
"object-hash": "3.0.0",
"react": "18.3.1",
"react-intl": "6.6.8",
"react-redux": "9.1.2",
"redux": "5.0.1",
"redux-form": "8.3.10",
"reselect": "5.1.1"
"react-hook-form": "7.52.2",
"react-intl": "6.6.8"
},
"devDependencies": {
"@fpsak-frontend/utils-test": "1.0.0"
Expand Down
Loading

0 comments on commit 23c23c7

Please sign in to comment.