Skip to content

Commit

Permalink
Legger ut redesign av fakta beregning i Q (#5121)
Browse files Browse the repository at this point in the history
* Legger ut redesign av fakta beregning i Q

* yarn.lock

* La til manglende featureToggles

* fikser test

* Lurt å returnere komponenten
  • Loading branch information
hallvardastark authored Oct 16, 2023
1 parent 3174ee3 commit 3f12510
Show file tree
Hide file tree
Showing 23 changed files with 176 additions and 5 deletions.
2 changes: 2 additions & 0 deletions deploy/dev-fss-k9saksbehandling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ spec:
value: "true"
- name: OVERSTYR_BEREGNING
value: "true"
- name: FAKTA_BEREGNING_REDESIGN
value: "true"
2 changes: 2 additions & 0 deletions deploy/prod-fss-k9saksbehandling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ spec:
value: "true"
- name: OVERSTYR_BEREGNING
value: "false"
- name: FAKTA_BEREGNING_REDESIGN
value: "false"
4 changes: 4 additions & 0 deletions feature-toggles.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@
{
"key": "OVERSTYR_BEREGNING",
"value": "${OVERSTYR_BEREGNING}"
},
{
"key": "FAKTA_BEREGNING_REDESIGN",
"value": "${FAKTA_BEREGNING_REDESIGN}"
}
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"lint:fix": "eslint --fix --cache packages --ext .ts,.tsx,.js,.jsx",
"css:lint": "stylelint \"packages/**/*.css\"",
"dev": "yarn dev-env-variables cross-env NODE_ENV=development APP_URL_K9FORMIDLING=http://localhost:8060/rest/dummy webpack serve --config webpack/webpack.dev.ts",
"dev-env-variables": "cross-env KLAGE_KABAL=true VARSELTEKST=true DOKUMENTDATA=true UNNTAKSBEHANDLING=true UTENLANDSOPPHOLD=true SOKNADPERIODESTRIPE=false TYPE_MEDISINSKE_OPPLYSNINGER_BREV=true LOS_MARKER_BEHANDLING=true LOS_MARKER_BEHANDLING_SUBMIT=true AKSJONSPUNKT_9014=true AKSJONSPUNKT_9015=true FRITEKST_REDIGERING=true FIX_SOKNADSFRIST_KALENDER_OG_READONLY=true INKLUDER_KALENDER_PILS=true",
"dev-env-variables": "cross-env KLAGE_KABAL=true VARSELTEKST=true DOKUMENTDATA=true UNNTAKSBEHANDLING=true UTENLANDSOPPHOLD=true SOKNADPERIODESTRIPE=false TYPE_MEDISINSKE_OPPLYSNINGER_BREV=true LOS_MARKER_BEHANDLING=true LOS_MARKER_BEHANDLING_SUBMIT=true AKSJONSPUNKT_9014=true AKSJONSPUNKT_9015=true FRITEKST_REDIGERING=true FIX_SOKNADSFRIST_KALENDER_OG_READONLY=true INKLUDER_KALENDER_PILS=true FAKTA_BEREGNING_REDESIGN=true",
"dev-lokal": "cross-env NODE_ENV=development APP_URL_SAK=http://k9-sak:8080 APP_URL_K9OPPDRAG=http://k9-oppdrag:8070 APP_URL_K9FORMIDLING_DD=http://k9-formidling-dokumentdata:8294 APP_URL_K9FORMIDLING=http://k9-formidling:8290 SPLITTET_SAMMENLINGNING_BEREGNING=true webpack serve --config webpack/webpack.dev.ts",
"dev-med-formidling": "cross-env NODE_ENV=development webpack serve --config webpack/webpack.dev.ts",
"build": "cross-env NODE_ENV=production SENTRY_RELEASE=$(git rev-parse --short HEAD) webpack --config webpack/webpack.prod.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/behandling-frisinn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@k9-sak-web/rest-api-hooks": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning": "5.0.7",
"@navikt/ft-fakta-beregning-redesign": "1.0.4",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.11",
"react": "17.0.2",
"react-intl": "6.4.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ describe('<FrisinnFakta>', () => {
setApentFaktaPanel={sinon.spy()}
setBehandling={sinon.spy()}
arbeidsgiverOpplysningerPerId={arbeidsgiverOpplysningerPerId}
featureToggles={{ FAKTA_BEREGNING_REDESIGN: true }}
/>,
);

Expand Down Expand Up @@ -187,6 +188,7 @@ describe('<FrisinnFakta>', () => {
setApentFaktaPanel={sinon.spy()}
setBehandling={sinon.spy()}
arbeidsgiverOpplysningerPerId={arbeidsgiverOpplysningerPerId}
featureToggles={{ FAKTA_BEREGNING_REDESIGN: true }}
/>,
);

Expand Down
12 changes: 11 additions & 1 deletion packages/behandling-frisinn/src/components/FrisinnFakta.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { useEffect, useState } from 'react';

import { Rettigheter, SideMenuWrapper, faktaHooks, useSetBehandlingVedEndring } from '@k9-sak-web/behandling-felles';
import { KodeverkMedNavn, Behandling, Fagsak, FagsakPerson, ArbeidsgiverOpplysningerPerId } from '@k9-sak-web/types';
import {
KodeverkMedNavn,
Behandling,
Fagsak,
FagsakPerson,
ArbeidsgiverOpplysningerPerId,
FeatureToggles,
} from '@k9-sak-web/types';
import { RestApiState, useRestApiErrorDispatcher } from '@k9-sak-web/rest-api-hooks';
import ErrorBoundary from '@k9-sak-web/sak-app/src/app/ErrorBoundary';
import ac from '@fpsak-frontend/kodeverk/src/aksjonspunktCodes';
Expand All @@ -27,6 +34,7 @@ interface OwnProps {
setApentFaktaPanel: (faktaPanelInfo: { urlCode: string; textCode: string }) => void;
setBehandling: (behandling: Behandling) => void;
arbeidsgiverOpplysningerPerId: ArbeidsgiverOpplysningerPerId;
featureToggles: FeatureToggles;
}

const FrisinnFakta = ({
Expand All @@ -43,6 +51,7 @@ const FrisinnFakta = ({
setApentFaktaPanel,
setBehandling,
arbeidsgiverOpplysningerPerId,
featureToggles,
}: OwnProps) => {
const { aksjonspunkter, ...rest } = data;
const { addErrorMessage } = useRestApiErrorDispatcher();
Expand Down Expand Up @@ -72,6 +81,7 @@ const FrisinnFakta = ({
rettigheter,
aksjonspunkter,
valgtFaktaSteg,
featureToggles,
);

faktaHooks.useFaktaAksjonspunktNotifikator(faktaPaneler, setApentFaktaPanel, behandling.versjon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const FrisinnPaneler = ({
setApentFaktaPanel={setApentFaktaPanel}
setBehandling={setBehandling}
arbeidsgiverOpplysningerPerId={arbeidsgiverOpplysningerPerId}
featureToggles={featureToggles}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FaktaPanelDef } from '@k9-sak-web/behandling-felles';
import { konverterKodeverkTilKode, mapVilkar, transformBeregningValues } from '@fpsak-frontend/utils';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { BeregningFaktaIndex } from '@navikt/ft-fakta-beregning';
import { BeregningFaktaIndex as BeregningFaktaIndexRedesign } from '@navikt/ft-fakta-beregning-redesign';

class BeregningFaktaPanelDef extends FaktaPanelDef {
getUrlKode = () => faktaPanelCodes.BEREGNING;
Expand All @@ -18,6 +19,23 @@ class BeregningFaktaPanelDef extends FaktaPanelDef {
const deepCopyProps = JSON.parse(JSON.stringify(props));
konverterKodeverkTilKode(deepCopyProps);
const bgVilkaret = deepCopyProps.vilkar.find(v => v.vilkarType === vilkarType.BEREGNINGSGRUNNLAGVILKARET);
if (props.featureToggles?.FAKTA_BEREGNING_REDESIGN) {
return (
<BeregningFaktaIndexRedesign
arbeidsgiverOpplysningerPerId={deepCopyProps.arbeidsgiverOpplysningerPerId}
submitCallback={aksjonspunktData => props.submitCallback(transformBeregningValues(aksjonspunktData))}
formData={props.formData}
setFormData={props.setFormData}
vilkar={mapVilkar(bgVilkaret, props.beregningreferanserTilVurdering)}
kodeverkSamling={deepCopyProps.alleKodeverk}
erOverstyrer={false}
submittable={deepCopyProps.submittable}
readOnly={deepCopyProps.isReadOnly}
skalKunneOverstyreAktiviteter={false}
skalKunneAvbryteOverstyring
/>
);
}
return (
<BeregningFaktaIndex
arbeidsgiverOpplysningerPerId={deepCopyProps.arbeidsgiverOpplysningerPerId}
Expand Down
1 change: 1 addition & 0 deletions packages/behandling-omsorgspenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@k9-sak-web/rest-api-hooks": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning": "5.0.7",
"@navikt/ft-fakta-beregning-redesign": "1.0.4",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.9",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.11",
"nav-frontend-popover": "2.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ const overstyringApCodes = [ac.OVERSTYRING_AV_BEREGNINGSAKTIVITETER, ac.OVERSTYR
*/
const skalSkjuleOmsorgenFor = (data: FetchedData): boolean => {
if (data?.behandlingPerioderårsakMedVilkår?.perioderMedÅrsak?.perioderTilVurdering) {
return data.behandlingPerioderårsakMedVilkår.perioderMedÅrsak.perioderTilVurdering.filter(periode =>
isBefore(parse(periode.tom, 'yyyy-MM-dd', new Date()), parse('2023-01-01', 'yyyy-MM-dd', new Date())),
).length > 0;
return (
data.behandlingPerioderårsakMedVilkår.perioderMedÅrsak.perioderTilVurdering.filter(periode =>
isBefore(parse(periode.tom, 'yyyy-MM-dd', new Date()), parse('2023-01-01', 'yyyy-MM-dd', new Date())),
).length > 0
);
}
return false;
};
Expand Down Expand Up @@ -98,6 +100,7 @@ const OmsorgspengerFakta = ({
rettigheter,
aksjonspunkter,
valgtFaktaSteg,
featureToggles,
);

faktaHooks.useFaktaAksjonspunktNotifikator(faktaPaneler, setApentFaktaPanel, behandling.versjon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FaktaPanelDef } from '@k9-sak-web/behandling-felles';
import { konverterKodeverkTilKode, mapVilkar, transformBeregningValues } from '@fpsak-frontend/utils';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { BeregningFaktaIndex } from '@navikt/ft-fakta-beregning';
import { BeregningFaktaIndex as BeregningFaktaIndexRedesign } from '@navikt/ft-fakta-beregning-redesign';

class BeregningFaktaPanelDef extends FaktaPanelDef {
getUrlKode = () => faktaPanelCodes.BEREGNING;
Expand All @@ -23,6 +24,22 @@ class BeregningFaktaPanelDef extends FaktaPanelDef {
const deepCopyProps = JSON.parse(JSON.stringify(props));
konverterKodeverkTilKode(deepCopyProps);
const bgVilkaret = deepCopyProps.vilkar.find(v => v.vilkarType === vilkarType.BEREGNINGSGRUNNLAGVILKARET);
if (props.featureToggles?.FAKTA_BEREGNING_REDESIGN) {
return (
<BeregningFaktaIndexRedesign
{...deepCopyProps}
kodeverkSamling={deepCopyProps.alleKodeverk}
beregningsgrunnlag={deepCopyProps.beregningsgrunnlag}
arbeidsgiverOpplysningerPerId={deepCopyProps.arbeidsgiverOpplysningerPerId}
submitCallback={aksjonspunktData => props.submitCallback(transformBeregningValues(aksjonspunktData))}
formData={props.formData}
setFormData={props.setFormData}
vilkar={mapVilkar(bgVilkaret, props.beregningreferanserTilVurdering)}
skalKunneOverstyreAktiviteter={false}
skalKunneAvbryteOverstyring
/>
);
}
return (
<BeregningFaktaIndex
{...deepCopyProps}
Expand Down
1 change: 1 addition & 0 deletions packages/behandling-opplaeringspenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@k9-sak-web/sak-app": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning": "5.0.7",
"@navikt/ft-fakta-beregning-redesign": "1.0.4",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.9",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.11",
"axios": "0.27.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FaktaPanelDef } from '@k9-sak-web/behandling-felles';
import { konverterKodeverkTilKode, mapVilkar, transformBeregningValues } from '@fpsak-frontend/utils';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { BeregningFaktaIndex } from '@navikt/ft-fakta-beregning';
import { BeregningFaktaIndex as BeregningFaktaIndexRedesign } from '@navikt/ft-fakta-beregning-redesign';

class BeregningFaktaPanelDef extends FaktaPanelDef {
// eslint-disable-next-line class-methods-use-this
Expand All @@ -27,6 +28,22 @@ class BeregningFaktaPanelDef extends FaktaPanelDef {
const deepCopyProps = JSON.parse(JSON.stringify(props));
konverterKodeverkTilKode(deepCopyProps);
const bgVilkaret = deepCopyProps.vilkar.find(v => v.vilkarType === vilkarType.BEREGNINGSGRUNNLAGVILKARET);
if (props.featureToggles?.FAKTA_BEREGNING_REDESIGN) {
return (
<BeregningFaktaIndexRedesign
{...deepCopyProps}
kodeverkSamling={deepCopyProps.alleKodeverk}
beregningsgrunnlag={deepCopyProps.beregningsgrunnlag}
arbeidsgiverOpplysningerPerId={deepCopyProps.arbeidsgiverOpplysningerPerId}
submitCallback={aksjonspunktData => props.submitCallback(transformBeregningValues(aksjonspunktData))}
formData={props.formData}
setFormData={props.setFormData}
vilkar={mapVilkar(bgVilkaret, props.beregningreferanserTilVurdering)}
skalKunneOverstyreAktiviteter={false}
skalKunneAvbryteOverstyring
/>
);
}
return (
<BeregningFaktaIndex
{...deepCopyProps}
Expand Down
1 change: 1 addition & 0 deletions packages/behandling-pleiepenger-sluttfase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@k9-sak-web/sak-app": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning": "5.0.7",
"@navikt/ft-fakta-beregning-redesign": "1.0.4",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.9",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.11",
"axios": "0.27.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const PleiepengerSluttfaseFakta = ({
rettigheter,
aksjonspunkter,
valgtFaktaSteg,
featureToggles,
);

faktaHooks.useFaktaAksjonspunktNotifikator(faktaPaneler, setApentFaktaPanel, behandling.versjon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FaktaPanelDef } from '@k9-sak-web/behandling-felles';
import { konverterKodeverkTilKode, mapVilkar, transformBeregningValues } from '@fpsak-frontend/utils';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { BeregningFaktaIndex } from '@navikt/ft-fakta-beregning';
import { BeregningFaktaIndex as BeregningFaktaIndexRedesign } from '@navikt/ft-fakta-beregning-redesign';

class BeregningFaktaPanelDef extends FaktaPanelDef {
getUrlKode = () => faktaPanelCodes.BEREGNING;
Expand All @@ -23,6 +24,22 @@ class BeregningFaktaPanelDef extends FaktaPanelDef {
const deepCopyProps = JSON.parse(JSON.stringify(props));
konverterKodeverkTilKode(deepCopyProps);
const bgVilkaret = deepCopyProps.vilkar.find(v => v.vilkarType === vilkarType.BEREGNINGSGRUNNLAGVILKARET);
if (props.featureToggles?.FAKTA_BEREGNING_REDESIGN) {
return (
<BeregningFaktaIndexRedesign
{...deepCopyProps}
kodeverkSamling={deepCopyProps.alleKodeverk}
beregningsgrunnlag={deepCopyProps.beregningsgrunnlag}
arbeidsgiverOpplysningerPerId={deepCopyProps.arbeidsgiverOpplysningerPerId}
submitCallback={aksjonspunktData => props.submitCallback(transformBeregningValues(aksjonspunktData))}
formData={props.formData}
setFormData={props.setFormData}
vilkar={mapVilkar(bgVilkaret, props.beregningreferanserTilVurdering)}
skalKunneOverstyreAktiviteter={false}
skalKunneAvbryteOverstyring
/>
);
}
return (
<BeregningFaktaIndex
{...deepCopyProps}
Expand Down
1 change: 1 addition & 0 deletions packages/behandling-pleiepenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@k9-sak-web/sak-app": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning": "5.0.7",
"@navikt/ft-fakta-beregning-redesign": "1.0.4",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.9",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.11",
"axios": "0.27.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FaktaPanelDef } from '@k9-sak-web/behandling-felles';
import { konverterKodeverkTilKode, mapVilkar, transformBeregningValues } from '@fpsak-frontend/utils';
import vilkarType from '@fpsak-frontend/kodeverk/src/vilkarType';
import { BeregningFaktaIndex } from '@navikt/ft-fakta-beregning';
import { BeregningFaktaIndex as BeregningFaktaIndexRedesign } from '@navikt/ft-fakta-beregning-redesign';

class BeregningFaktaPanelDef extends FaktaPanelDef {
// eslint-disable-next-line class-methods-use-this
Expand All @@ -27,6 +28,22 @@ class BeregningFaktaPanelDef extends FaktaPanelDef {
const deepCopyProps = JSON.parse(JSON.stringify(props));
konverterKodeverkTilKode(deepCopyProps);
const bgVilkaret = deepCopyProps.vilkar.find(v => v.vilkarType === vilkarType.BEREGNINGSGRUNNLAGVILKARET);
if (props.featureToggles?.FAKTA_BEREGNING_REDESIGN) {
return (
<BeregningFaktaIndexRedesign
{...deepCopyProps}
kodeverkSamling={deepCopyProps.alleKodeverk}
beregningsgrunnlag={deepCopyProps.beregningsgrunnlag}
arbeidsgiverOpplysningerPerId={deepCopyProps.arbeidsgiverOpplysningerPerId}
submitCallback={aksjonspunktData => props.submitCallback(transformBeregningValues(aksjonspunktData))}
formData={props.formData}
setFormData={props.setFormData}
vilkar={mapVilkar(bgVilkaret, props.beregningreferanserTilVurdering)}
skalKunneOverstyreAktiviteter={props.featureToggles && props.featureToggles.OVERSTYR_BEREGNING}
skalKunneAvbryteOverstyring
/>
);
}
return (
<BeregningFaktaIndex
{...deepCopyProps}
Expand Down
1 change: 1 addition & 0 deletions packages/sak-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@k9-sak-web/types": "1.0.0",
"@navikt/ds-react": "5.6.1",
"@navikt/ft-fakta-beregning": "5.0.7",
"@navikt/ft-fakta-beregning-redesign": "1.0.4",
"@navikt/ft-form-hooks": "4.2.9",
"@navikt/ft-plattform-komponenter": "2.3.5",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.11",
Expand Down
1 change: 1 addition & 0 deletions packages/sak-app/src/app/AppIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Home from './components/Home';

import '@fpsak-frontend/assets/styles/global.css';
import '@navikt/ft-fakta-beregning/dist/style.css';
import '@navikt/ft-fakta-beregning-redesign/dist/style.css';
import '@navikt/ft-form-hooks/dist/style.css';
import '@navikt/ft-plattform-komponenter/dist/style.css';
import '@navikt/ft-prosess-beregningsgrunnlag/dist/style.css';
Expand Down
4 changes: 4 additions & 0 deletions webpack/mocks/feature-toggles.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const featureToggles = [
key: 'OVERSTYR_BEREGNING',
value: process.env.OVERSTYR_BEREGNING,
},
{
key: 'FAKTA_BEREGNING_REDESIGN',
value: process.env.FAKTA_BEREGNING_REDESIGN,
},
];

module.exports = function (app) {
Expand Down
Loading

0 comments on commit 3f12510

Please sign in to comment.