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 17, 2024
1 parent 5a2815c commit a956523
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 59 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/app/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ModalEnum } from '@app/components/svarbrev/row/row';
import { AccessRightsPage } from '@app/pages/access-rights/access-rights';
import { AdminPage } from '@app/pages/admin/admin';
import { AnkebehandlingPage } from '@app/pages/ankebehandling/ankebehandling';
import { BehandlingEtterTrOpphevetPage } from '@app/pages/behandling-etter-tr-opphevet/behandling-etter-tr-opphevet';
import { BunnteksterPage } from '@app/pages/bunntekster/bunntekster';
import { GodeFormuleringerPage } from '@app/pages/gode-formuleringer/gode-formuleringer';
import { KlagebehandlingPage } from '@app/pages/klagebehandling/klagebehandling';
Expand Down Expand Up @@ -33,6 +34,7 @@ export const Router = () => (
<Route path="klagebehandling/:id" element={<KlagebehandlingPage />} />
<Route path="ankebehandling/:id" element={<AnkebehandlingPage />} />
<Route path="trygderettsankebehandling/:id" element={<TrygderettsankebehandlingPage />} />
<Route path="behandling-etter-tr-opphevet/:id" element={<BehandlingEtterTrOpphevetPage />} />
</Route>

<Route element={<ProtectedRoute roles={[Role.KABAL_INNSYN_EGEN_ENHET, Role.KABAL_KROL]} />}>
Expand Down
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,115 @@
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={mottattKlageinstans}
id="dato-for-kjennelse-mottatt-klageinstans"
label="Dato for kjennelse mottatt klageinstans"
/>

<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="Anke behandlet av">
{fraNAVEnhetNavn} - {fraNAVEnhet}
</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>
);
};
81 changes: 38 additions & 43 deletions frontend/src/components/common-table-components/open.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,49 +45,44 @@ export const OpenOppgavebehandling = ({
return null;
}

if (typeId === SaksTypeEnum.KLAGE) {
return (
<Button
as={Link}
variant={variant}
size={size}
to={`/klagebehandling/${id}`}
data-testid="klagebehandling-open-link"
data-klagebehandlingid={id}
data-oppgavebehandlingid={id}
>
{children}
</Button>
);
}
const commonProps = { as: Link, variant, size, children, 'data-oppgavebehandlingid': id };

if (typeId === SaksTypeEnum.ANKE) {
return (
<Button
as={Link}
variant={variant}
size={size}
to={`/ankebehandling/${id}`}
data-testid="ankebehandling-open-link"
data-ankebehandlingid={id}
data-oppgavebehandlingid={id}
>
{children}
</Button>
);
switch (typeId) {
case SaksTypeEnum.KLAGE:
return (
<Button
{...commonProps}
to={`/klagebehandling/${id}`}
data-testid="klagebehandling-open-link"
data-klagebehandlingid={id}
/>
);
case SaksTypeEnum.ANKE:
return (
<Button
{...commonProps}
to={`/ankebehandling/${id}`}
data-testid="ankebehandling-open-link"
data-ankebehandlingid={id}
/>
);
case SaksTypeEnum.ANKE_I_TRYGDERETTEN:
return (
<Button
{...commonProps}
to={`/trygderettsankebehandling/${id}`}
data-testid="trygderettsankebehandling-open-link"
data-trygderettsankebehandlingid={id}
/>
);
case SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET:
return (
<Button
{...commonProps}
to={`/behandling-etter-tr-opphevet/${id}`}
data-testid="behandling-etter-tr-opphevet-open-link"
data-behandling-etter-tr-opphevet-id={id}
/>
);
}

return (
<Button
as={Link}
variant={variant}
size={size}
to={`/trygderettsankebehandling/${id}`}
data-testid="trygderettsankebehandling-open-link"
data-trygderettsankebehandlingid={id}
data-oppgavebehandlingid={id}
>
{children}
</Button>
);
};
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 @@ -31,7 +31,13 @@ export const DeassignOppgave = ({ oppgave }: Props) => {

useOnClickOutside(ref, () => setIsOpen(false), true);

if (!canEdit || oppgave === undefined || oppgave.feilregistrering !== null) {
if (
!canEdit ||
oppgave === undefined ||
oppgave.feilregistrering !== null ||
oppgave.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN ||
oppgave.typeId === SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET
) {
return null;
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/oppgavestyring/fradel-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useFradel } from '@app/components/oppgavestyring/use-tildel';
import { useOnClickOutside } from '@app/hooks/use-on-click-outside';
import { useOppgaveActions } from '@app/hooks/use-oppgave-actions';
import { useTildelSaksbehandlerMutation } from '@app/redux-api/oppgaver/mutations/tildeling';
import { SaksTypeEnum } from '@app/types/kodeverk';
import { FradelReason, IOppgave } from '@app/types/oppgaver';

const KABAL_HEADER_HEIGHT = 48;
Expand Down Expand Up @@ -62,7 +63,7 @@ export const FradelButton = (props: IOppgave) => {
ytelseId,
);

if (isAccessLoading || isAvsluttetAvSaksbehandler) {
if (isAccessLoading || isAvsluttetAvSaksbehandler || typeId === SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET) {
return null;
}

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,3 @@
import { Oppgavebehandling } from '@app/components/oppgavebehandling/oppgavebehandling';

export const BehandlingEtterTrOpphevetPage = () => <Oppgavebehandling />;
Loading

0 comments on commit a956523

Please sign in to comment.