Skip to content

Commit

Permalink
Support new oppgave type: Ny behandling etter TR har opphevet
Browse files Browse the repository at this point in the history
  • Loading branch information
eriksson-daniel committed Sep 16, 2024
1 parent 5a2815c commit fb08b2f
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 14 deletions.
18 changes: 10 additions & 8 deletions frontend/src/components/behandling/behandling.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading, Skeleton } from '@navikt/ds-react';
import { BehandlingEtterTrOpphevetDetaljer } from '@app/components/behandling/behandlingsdetaljer/behandling-etter-tr-opphevet-detaljer';
import { BehandlingSection } from '@app/components/behandling/behandlingsdetaljer/behandling-section';
import { useOppgave } from '@app/hooks/oppgavebehandling/use-oppgave';
import { useBehandlingEnabled } from '@app/hooks/settings/use-setting';
Expand Down Expand Up @@ -67,13 +68,14 @@ const Behandlingsdetaljer = () => {
);
}

if (oppgave.typeId === SaksTypeEnum.KLAGE) {
return <Klagebehandlingsdetaljer oppgavebehandling={oppgave} />;
switch (oppgave.typeId) {
case SaksTypeEnum.KLAGE:
return <Klagebehandlingsdetaljer oppgavebehandling={oppgave} />;
case SaksTypeEnum.ANKE:
return <Ankebehandlingsdetaljer oppgavebehandling={oppgave} />;
case SaksTypeEnum.ANKE_I_TRYGDERETTEN:
return <Trygderettsankebehandlingsdetaljer oppgavebehandling={oppgave} />;
case SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET:
return <BehandlingEtterTrOpphevetDetaljer oppgavebehandling={oppgave} />;
}

if (oppgave.typeId === SaksTypeEnum.ANKE) {
return <Ankebehandlingsdetaljer oppgavebehandling={oppgave} />;
}

return <Trygderettsankebehandlingsdetaljer oppgavebehandling={oppgave} />;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { Heading } from '@navikt/ds-react';
import { ExtraUtfall } from '@app/components/behandling/behandlingsdetaljer/extra-utfall';
import { GosysBeskrivelse } from '@app/components/behandling/behandlingsdetaljer/gosys/beskrivelse';
import { ReadOnlyDate } from '@app/components/behandling/behandlingsdetaljer/read-only-date';
import { Saksnummer } from '@app/components/behandling/behandlingsdetaljer/saksnummer';
import { Type } from '@app/components/type/type';
import { isoDateToPretty } from '@app/domain/date';
import { useUpdateFullmektigMutation, useUpdateKlagerMutation } from '@app/redux-api/oppgaver/mutations/behandling';
import { IBehandlingEtterTryderettenOpphevet as IBehandlingEtterTrOpphevet } from '@app/types/oppgavebehandling/oppgavebehandling';
import { Part } from '../../part/part';
import { StyledBehandlingSection } from '../styled-components';
import { BehandlingSection } from './behandling-section';
import { Lovhjemmel } from './lovhjemmel/lovhjemmel';
import { MeldingFraVedtaksinstans } from './melding-fra-vedtaksinstans';
import { UtfallResultat } from './utfall-resultat';
import { Ytelse } from './ytelse';

interface Props {
oppgavebehandling: IBehandlingEtterTrOpphevet;
}

export const BehandlingEtterTrOpphevetDetaljer = ({ oppgavebehandling }: Props) => {
const [updateFullmektig, { isLoading: fullmektigIsLoading }] = useUpdateFullmektigMutation();
const [updateKlager, { isLoading: klagerIsLoading }] = useUpdateKlagerMutation();

const {
typeId,
fraNAVEnhetNavn,
fraNAVEnhet,
mottattKlageinstans,
kommentarFraVedtaksinstans,
oppgavebeskrivelse,
resultat,
ytelseId,
prosessfullmektig,
saksnummer,
varsletFrist,
kjennelseMottatt,
created,
} = oppgavebehandling;

return (
<StyledBehandlingSection>
<Heading level="1" size="medium" spacing>
Behandling
</Heading>

<Part
isDeletable={false}
label="Opprinnelig klager / ankende part"
part={oppgavebehandling.klager}
onChange={(klager) => updateKlager({ klager, oppgaveId: oppgavebehandling.id })}
isLoading={klagerIsLoading}
/>

<Part
isDeletable
label="Fullmektig"
part={prosessfullmektig}
onChange={(fullmektig) => updateFullmektig({ fullmektig, oppgaveId: oppgavebehandling.id })}
isLoading={fullmektigIsLoading}
/>

<BehandlingSection label="Type">
<Type type={typeId} />
</BehandlingSection>

<BehandlingSection label="Ytelse">
<Ytelse ytelseId={ytelseId} />
</BehandlingSection>

<Saksnummer saksnummer={saksnummer} />

<ReadOnlyDate
date={kjennelseMottatt}
id="dato-for-kjennelse-fra-trygderetten-med-utfall-opphevet"
label="Dato for kjennelse fra Trygderetten med utfall opphevet"
/>

<ReadOnlyDate
date={created}
id="dato-for-ny-behandling-opprettet-i-kabal"
label="Dato for ny behandling opprettet i Kabal"
/>

<BehandlingSection label="Varslet frist">
{varsletFrist === null ? 'Ikke satt' : isoDateToPretty(varsletFrist)}
</BehandlingSection>

<BehandlingSection label="Fra NAV-enhet">
{fraNAVEnhetNavn} - {fraNAVEnhet}
</BehandlingSection>

<BehandlingSection label="Mottatt klageinstans">{isoDateToPretty(mottattKlageinstans)}</BehandlingSection>

<MeldingFraVedtaksinstans kommentarFraVedtaksinstans={kommentarFraVedtaksinstans} />

<GosysBeskrivelse oppgavebeskrivelse={oppgavebeskrivelse} />

<UtfallResultat utfall={resultat.utfallId} oppgaveId={oppgavebehandling.id} />

<ExtraUtfall
utfallIdSet={resultat.extraUtfallIdSet}
mainUtfall={resultat.utfallId}
oppgaveId={oppgavebehandling.id}
/>

<Lovhjemmel />
</StyledBehandlingSection>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const useHideKvalitetsvurdering = (): boolean => {

const { typeId, resultat } = oppgave;

if (typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) {
if (typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN || typeId === SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ interface FinishProps {
const getFinishText = (isOpphevetAnkeInTrygderettern: boolean, isModernized: boolean) => {
if (isOpphevetAnkeInTrygderettern) {
return isModernized
? 'Nei, fullfør uten å opprette ny oppgave i Kabal.'
: 'Nei, fullfør uten å opprette ny oppgave i Kabal. Husk å sende oppgave i Gosys.';
? 'Nei, fullfør uten å opprette ny behandling i Kabal.'
: 'Nei, fullfør uten å opprette ny behandling i Kabal. Husk å sende oppgave i Gosys.';
}

return 'Fullfør';
Expand All @@ -47,6 +47,7 @@ export const ConfirmFinish = ({ cancel, show }: FinishProps) => {
{isOpphevetInTrygderetten ? <FinishOpphevetTRWithNyBehandling /> : null}
<FinishButton>{finishText}</FinishButton>
<Button
style={{ flexShrink: 0 }}
variant="secondary"
type="button"
size="small"
Expand Down Expand Up @@ -129,7 +130,7 @@ const useText = (): string => {
};

const FinishOpphevetTRWithNyBehandling = () => (
<FinishButton nyBehandling>Ja, fullfør og opprett ny ankeoppgave i Kabal.</FinishButton>
<FinishButton nyBehandling>Ja, fullfør og opprett ny behandling i Kabal</FinishButton>
);

interface FinishButtonProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { useIsFeilregistrert } from '@app/hooks/use-is-feilregistrert';
import { useIsRol } from '@app/hooks/use-is-rol';
import { useIsSaksbehandler } from '@app/hooks/use-is-saksbehandler';
import { GENERELT_BREV_TEMPLATE, NOTAT_TEMPLATE } from '@app/plate/templates/simple-templates';
import { ANKE_I_TRYGDERETTEN_TEMPLATES, ANKE_TEMPLATES, KLAGE_TEMPLATES } from '@app/plate/templates/templates';
import {
ANKE_I_TRYGDERETTEN_TEMPLATES,
ANKE_TEMPLATES,
BEHANDLING_ETTER_TR_OPPHEVET_TEMPLATES,
KLAGE_TEMPLATES,
} from '@app/plate/templates/templates';
import { useCreateSmartDocumentMutation } from '@app/redux-api/oppgaver/mutations/smart-document';
import { useGetDocumentsQuery } from '@app/redux-api/oppgaver/queries/documents';
import { Role } from '@app/types/bruker';
Expand Down Expand Up @@ -115,6 +120,8 @@ const useTemplates = (oppgave: IOppgavebehandling | undefined) => {
return ANKE_TEMPLATES;
case SaksTypeEnum.ANKE_I_TRYGDERETTEN:
return ANKE_I_TRYGDERETTEN_TEMPLATES;
case SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET:
return BEHANDLING_ETTER_TR_OPPHEVET_TEMPLATES;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { ELEMENT_PARAGRAPH } from '@udecode/plate-paragraph';
import { deepFreeze } from '@app/functions/deep-freeze';
import { Source } from '@app/plate/components/label-content';
import { EditorValue, TextAlign } from '@app/plate/types';
import { DistribusjonsType } from '@app/types/documents/documents';
import { IMutableSmartEditorTemplate } from '@app/types/smart-editor/smart-editor';
import { TemplateIdEnum } from '@app/types/smart-editor/template-enums';
import { TemplateSections } from '../template-sections';
import {
createCurrentDate,
createFooter,
createHeader,
createLabelContent,
createMaltekstseksjon,
createRegelverk,
createSignature,
} from './helpers';

const INITIAL_SLATE_VALUE: EditorValue = [
createCurrentDate(),
createHeader(),

createMaltekstseksjon(TemplateSections.TITLE),

{
type: ELEMENT_PARAGRAPH,
align: TextAlign.LEFT,
children: [
createLabelContent(Source.KLAGER_IF_EQUAL_TO_SAKEN_GJELDER_NAME, 'Ankende part'),
createLabelContent(Source.SAKEN_GJELDER_IF_DIFFERENT_FROM_KLAGER_NAME, 'Saken gjelder'),
createLabelContent(Source.SAKEN_GJELDER_FNR, 'Fødselsnummer'),
createLabelContent(Source.KLAGER_IF_DIFFERENT_FROM_SAKEN_GJELDER_NAME, 'Ankende part'),
createLabelContent(Source.SAKSNUMMER, 'Saksnummer'),
],
},

createMaltekstseksjon(TemplateSections.INTRODUCTION),
createMaltekstseksjon(TemplateSections.AVGJOERELSE),
createMaltekstseksjon(TemplateSections.ANFOERSLER),
createMaltekstseksjon(TemplateSections.OPPLYSNINGER),
createMaltekstseksjon(TemplateSections.VURDERINGEN),
createMaltekstseksjon(TemplateSections.KONKLUSJON),
createMaltekstseksjon(TemplateSections.ANKEINFO),
createMaltekstseksjon(TemplateSections.SAKSKOSTNADER),
createMaltekstseksjon(TemplateSections.GENERELL_INFO),

createSignature(),
createFooter(),
createRegelverk(),
];

export const BEHANDLING_ETTER_TR_OPPHEVET_TEMPLATE = deepFreeze<IMutableSmartEditorTemplate>({
templateId: TemplateIdEnum.BEHANDLING_ETTER_TR_OPPHEVET_VEDTAK,
tittel: 'Vedtak/beslutning (ny behandling)',
richText: INITIAL_SLATE_VALUE,
dokumentTypeId: DistribusjonsType.VEDTAKSBREV,
});
9 changes: 9 additions & 0 deletions frontend/src/plate/templates/templates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ANKEVEDTAK_TEMPLATE } from '@app/plate/templates/ankevedtak';
import { BEHANDLING_ETTER_TR_OPPHEVET_TEMPLATE } from '@app/plate/templates/behandling-etter-tr-opphevet-vedtak';
import { KLAGEVEDTAK_TEMPLATE } from '@app/plate/templates/klagevedtak';
import { ORIENTERING_OM_TILSVAR_TEMPLATE } from '@app/plate/templates/orientering-om-tilsvar-direkte-til-trygderetten';
import { OVERSENDELSESBREV_TEMPLATE } from '@app/plate/templates/oversendelsesbrev';
Expand Down Expand Up @@ -43,3 +44,11 @@ export const ANKE_TEMPLATES = [
];

export const ANKE_I_TRYGDERETTEN_TEMPLATES = [GENERELT_BREV_TEMPLATE, NOTAT_TEMPLATE, ORIENTERING_OM_TILSVAR_TEMPLATE];

export const BEHANDLING_ETTER_TR_OPPHEVET_TEMPLATES = [
BEHANDLING_ETTER_TR_OPPHEVET_TEMPLATE,
GENERELT_BREV_TEMPLATE,
NOTAT_TEMPLATE,
ROL_QUESTIONS_TEMPLATE,
ROL_TILSVARSBREV_TEMPLATE,
];
1 change: 1 addition & 0 deletions frontend/src/types/field-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const FIELD_NAMES = {
[SaksTypeEnum.KLAGE]: DEFAULT_FIELD_NAMES,
[SaksTypeEnum.ANKE]: { ...DEFAULT_FIELD_NAMES, ...ANKE_FIELD_NAMES },
[SaksTypeEnum.ANKE_I_TRYGDERETTEN]: { ...DEFAULT_FIELD_NAMES, ...ANKE_I_TRYGDERETTEN_FIELD_NAMES },
[SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET]: DEFAULT_FIELD_NAMES,
};

export type Field = keyof typeof DEFAULT_FIELD_NAMES;
1 change: 1 addition & 0 deletions frontend/src/types/kodeverk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum SaksTypeEnum {
KLAGE = '1',
ANKE = '2',
ANKE_I_TRYGDERETTEN = '3',
BEHANDLING_ETTER_TR_OPPHEVET = '4',
}

export enum UtfallEnum {
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/types/oppgavebehandling/oppgavebehandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,17 @@ export interface ITrygderettsankebehandling extends IOppgavebehandlingBase {
sendtTilTrygderetten: string | null; // LocalDate
}

export type IOppgavebehandling = IKlagebehandling | IAnkebehandling | ITrygderettsankebehandling;
export interface IBehandlingEtterTryderettenOpphevet extends IOppgavebehandlingBase {
typeId: SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET;
rol: IMedunderskriverRol;
kjennelseMottatt: string | null;
}

export type IOppgavebehandling =
| IKlagebehandling
| IAnkebehandling
| ITrygderettsankebehandling
| IBehandlingEtterTryderettenOpphevet;

interface Resultat {
file: IVedlegg | null;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/smart-editor/template-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export enum TemplateIdEnum {
ROL_TILSVARSBREV = 'rol-tilsvarsbrev',
OVERSENDELSESBREV = 'oversendelsesbrev',
ORIENTERING_OM_TILSVAR = 'orientering-om-tilsvar',
BEHANDLING_ETTER_TR_OPPHEVET_VEDTAK = 'behandling-etter-tr-opphevet',
}

0 comments on commit fb08b2f

Please sign in to comment.