From ed6e39ab6abb615f575793687f7f897096c91e78 Mon Sep 17 00:00:00 2001 From: Daniel Eriksson Date: Thu, 13 Feb 2025 13:34:12 +0100 Subject: [PATCH] Enable ROL for anke i Trygderetten --- .../behandling/behandlingsdialog/rol/rol.tsx | 9 ++------ .../rol/send-to-saksbehandler.tsx | 10 ++------- .../rol/take-from-saksbehandler.tsx | 10 ++------- .../oppgave-rows/oppgave-row.tsx | 5 +---- .../new-documents/modal/finish-button.tsx | 7 ------- .../src/components/header/user-menu/debug.tsx | 3 +-- .../deassign/deassign-oppgave.tsx | 2 +- .../hooks/use-can-edit-document.ts | 19 ++++------------- .../hooks/oppgavebehandling/use-has-access.ts | 21 ++++++++----------- .../use-can-drop-on-document.ts | 7 +------ .../use-can-edit-document.test.ts | 2 +- .../use-can-document/use-can-edit-document.ts | 5 ++--- frontend/src/hooks/use-is-rol.ts | 13 ++---------- frontend/src/hooks/use-oppgave-actions.ts | 4 ++-- .../src/plate/components/signature/hooks.ts | 4 +--- frontend/src/plate/templates/templates.ts | 2 ++ .../oppgaver/mutations/set-rol-flowstate.ts | 13 ------------ .../redux-api/oppgaver/mutations/set-rol.ts | 13 ------------ .../queries/behandling/event-handlers/rol.tsx | 3 +-- .../oppgavebehandling/oppgavebehandling.ts | 5 +---- 20 files changed, 35 insertions(+), 122 deletions(-) diff --git a/frontend/src/components/behandling/behandlingsdialog/rol/rol.tsx b/frontend/src/components/behandling/behandlingsdialog/rol/rol.tsx index 35ba3157e..476232889 100644 --- a/frontend/src/components/behandling/behandlingsdialog/rol/rol.tsx +++ b/frontend/src/components/behandling/behandlingsdialog/rol/rol.tsx @@ -12,8 +12,7 @@ import { useIsFullfoert } from '@app/hooks/use-is-fullfoert'; import { useIsRol } from '@app/hooks/use-is-rol'; import { useIsSaksbehandler } from '@app/hooks/use-is-saksbehandler'; import { Role } from '@app/types/bruker'; -import { SaksTypeEnum } from '@app/types/kodeverk'; -import type { IAnkebehandling, IKlagebehandling } from '@app/types/oppgavebehandling/oppgavebehandling'; +import type { IOppgavebehandling } from '@app/types/oppgavebehandling/oppgavebehandling'; import { styled } from 'styled-components'; import { RolReadOnly } from './read-only'; @@ -24,15 +23,11 @@ export const Rol = () => { return SKELETON; } - if (oppgave.typeId !== SaksTypeEnum.KLAGE && oppgave.typeId !== SaksTypeEnum.ANKE) { - return null; - } - return ; }; interface Props { - oppgave: IKlagebehandling | IAnkebehandling; + oppgave: IOppgavebehandling; } const RolInternal = ({ oppgave }: Props) => { diff --git a/frontend/src/components/behandling/behandlingsdialog/rol/send-to-saksbehandler.tsx b/frontend/src/components/behandling/behandlingsdialog/rol/send-to-saksbehandler.tsx index bdddb3ab4..14491752d 100644 --- a/frontend/src/components/behandling/behandlingsdialog/rol/send-to-saksbehandler.tsx +++ b/frontend/src/components/behandling/behandlingsdialog/rol/send-to-saksbehandler.tsx @@ -2,7 +2,6 @@ import { StaticDataContext } from '@app/components/app/static-data-context'; import { getFixedCacheKey } from '@app/components/behandling/behandlingsdialog/rol/helpers'; import { useOppgave } from '@app/hooks/oppgavebehandling/use-oppgave'; import { useSetRolStateMutation } from '@app/redux-api/oppgaver/mutations/set-rol-flowstate'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import { PaperplaneIcon } from '@navikt/aksel-icons'; import { Button } from '@navikt/ds-react'; @@ -15,15 +14,10 @@ interface Props { export const SendToSaksbehandler = ({ oppgaveId, isSaksbehandler }: Props) => { const [setRolState, { isLoading }] = useSetRolStateMutation({ fixedCacheKey: getFixedCacheKey(oppgaveId) }); - const { data: oppgave, isLoading: oppgaveIsLoading } = useOppgave(); + const { data: oppgave, isSuccess } = useOppgave(); const { user } = useContext(StaticDataContext); - if ( - isSaksbehandler || - oppgaveIsLoading || - oppgave === undefined || - (oppgave.typeId !== SaksTypeEnum.KLAGE && oppgave.typeId !== SaksTypeEnum.ANKE) - ) { + if (isSaksbehandler || !isSuccess) { return null; } diff --git a/frontend/src/components/behandling/behandlingsdialog/rol/take-from-saksbehandler.tsx b/frontend/src/components/behandling/behandlingsdialog/rol/take-from-saksbehandler.tsx index 5fd753791..827eaedd1 100644 --- a/frontend/src/components/behandling/behandlingsdialog/rol/take-from-saksbehandler.tsx +++ b/frontend/src/components/behandling/behandlingsdialog/rol/take-from-saksbehandler.tsx @@ -1,7 +1,6 @@ import { useOppgave } from '@app/hooks/oppgavebehandling/use-oppgave'; import { useIsRol } from '@app/hooks/use-is-rol'; import { useSetRolStateMutation } from '@app/redux-api/oppgaver/mutations/set-rol-flowstate'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import { ArrowRedoIcon } from '@navikt/aksel-icons'; import { Button, type ButtonProps } from '@navikt/ds-react'; @@ -15,14 +14,9 @@ interface Props { export const TakeFromSaksbehandler = ({ oppgaveId, variant = 'primary' }: Props) => { const isRol = useIsRol(); const [setRolState, { isLoading }] = useSetRolStateMutation({ fixedCacheKey: getFixedCacheKey(oppgaveId) }); - const { data: oppgave, isLoading: oppgaveIsLoading } = useOppgave(); + const { data: oppgave, isSuccess } = useOppgave(); - if ( - oppgaveIsLoading || - oppgave === undefined || - (oppgave.typeId !== SaksTypeEnum.KLAGE && oppgave.typeId !== SaksTypeEnum.ANKE) || - !isRol - ) { + if (!isSuccess || !isRol) { return null; } diff --git a/frontend/src/components/common-table-components/oppgave-rows/oppgave-row.tsx b/frontend/src/components/common-table-components/oppgave-rows/oppgave-row.tsx index 8084afc0a..638d93a83 100644 --- a/frontend/src/components/common-table-components/oppgave-rows/oppgave-row.tsx +++ b/frontend/src/components/common-table-components/oppgave-rows/oppgave-row.tsx @@ -24,7 +24,6 @@ import { RelevantOppgaver } from '@app/components/relevant-oppgaver/relevant-opp import { Type } from '@app/components/type/type'; import { isoDateToPretty } from '@app/domain/date'; import { useGetOppgaveQuery } from '@app/redux-api/oppgaver/queries/oppgave-data'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import type { IOppgave } from '@app/types/oppgaver'; import { Table } from '@navikt/ds-react'; @@ -129,9 +128,7 @@ const getColumns = (columnKeys: ColumnKeyEnum[], oppgave: IOppgave) => - {oppgave.typeId === SaksTypeEnum.KLAGE || oppgave.typeId === SaksTypeEnum.ANKE ? ( - - ) : null} + ); diff --git a/frontend/src/components/documents/new-documents/modal/finish-button.tsx b/frontend/src/components/documents/new-documents/modal/finish-button.tsx index 6a7e94945..534623c9f 100644 --- a/frontend/src/components/documents/new-documents/modal/finish-button.tsx +++ b/frontend/src/components/documents/new-documents/modal/finish-button.tsx @@ -13,7 +13,6 @@ import { type ISmartDocument, type JournalfoertDokument, } from '@app/types/documents/documents'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import type { IOppgavebehandling } from '@app/types/oppgavebehandling/oppgavebehandling'; import { Alert } from '@navikt/ds-react'; @@ -67,12 +66,6 @@ const getMustWaitForRolToReturn = ( document: IMainDocument, containsRolAttachments: boolean, ) => { - const isOppgaveTypeRelevantToRol = oppgave.typeId === SaksTypeEnum.KLAGE || oppgave.typeId === SaksTypeEnum.ANKE; - - if (!isOppgaveTypeRelevantToRol) { - return false; - } - if (getIsRolQuestions(document)) { return !(containsRolAttachments && oppgave.rol.flowState === FlowState.RETURNED); } diff --git a/frontend/src/components/header/user-menu/debug.tsx b/frontend/src/components/header/user-menu/debug.tsx index 936db8c25..8244d5b23 100644 --- a/frontend/src/components/header/user-menu/debug.tsx +++ b/frontend/src/components/header/user-menu/debug.tsx @@ -6,7 +6,6 @@ import { useGetDocumentsQuery } from '@app/redux-api/oppgaver/queries/documents' import { useUtfall, useYtelserAll } from '@app/simple-api-state/use-kodeverk'; import { user } from '@app/static-data/static-data'; import type { INavEmployee } from '@app/types/bruker'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { BugIcon } from '@navikt/aksel-icons'; import { Button, Dropdown, Tooltip } from '@navikt/ds-react'; import { skipToken } from '@reduxjs/toolkit/query'; @@ -61,7 +60,7 @@ export const BehandlingDebug = () => { } const medunderskriver = oppgave.medunderskriver.employee; - const rol = oppgave.typeId !== SaksTypeEnum.ANKE_I_TRYGDERETTEN ? oppgave.rol : null; + const { rol } = oppgave; const body = JSON.stringify( { diff --git a/frontend/src/components/oppgavebehandling-footer/deassign/deassign-oppgave.tsx b/frontend/src/components/oppgavebehandling-footer/deassign/deassign-oppgave.tsx index c8688ef84..4eba7a7a7 100644 --- a/frontend/src/components/oppgavebehandling-footer/deassign/deassign-oppgave.tsx +++ b/frontend/src/components/oppgavebehandling-footer/deassign/deassign-oppgave.tsx @@ -26,7 +26,7 @@ export const DeassignOppgave = ({ oppgave }: Props) => { oppgave.saksbehandler?.navIdent ?? null, oppgave.medunderskriver.employee?.navIdent ?? null, oppgave.medunderskriver.flowState, - oppgave.typeId === SaksTypeEnum.KLAGE || oppgave.typeId === SaksTypeEnum.ANKE ? oppgave.rol.flowState : null, + oppgave.rol.flowState, ); useOnClickOutside(ref, () => setIsOpen(false), true); diff --git a/frontend/src/components/smart-editor/hooks/use-can-edit-document.ts b/frontend/src/components/smart-editor/hooks/use-can-edit-document.ts index ac5f07b4c..876a37801 100644 --- a/frontend/src/components/smart-editor/hooks/use-can-edit-document.ts +++ b/frontend/src/components/smart-editor/hooks/use-can-edit-document.ts @@ -1,19 +1,11 @@ import { StaticDataContext } from '@app/components/app/static-data-context'; import { useOppgave } from '@app/hooks/oppgavebehandling/use-oppgave'; import { type IUserData, Role } from '@app/types/bruker'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; -import type { - IAnkebehandling, - IKlagebehandling, - IOppgavebehandling, -} from '@app/types/oppgavebehandling/oppgavebehandling'; +import type { IOppgavebehandling } from '@app/types/oppgavebehandling/oppgavebehandling'; import { TemplateIdEnum } from '@app/types/smart-editor/template-enums'; import { useContext, useMemo } from 'react'; -const supportsRol = (oppgave: IOppgavebehandling): oppgave is IKlagebehandling | IAnkebehandling => - oppgave.typeId === SaksTypeEnum.KLAGE || oppgave.typeId === SaksTypeEnum.ANKE; - export const useCanManageDocument = (templateId: TemplateIdEnum): boolean => { const { data: oppgave, isSuccess } = useOppgave(); const { user } = useContext(StaticDataContext); @@ -35,13 +27,10 @@ export const useCanEditDocument = (templateId: TemplateIdEnum): boolean => { }; const isRol = (oppgave: IOppgavebehandling, user: IUserData): boolean => - supportsRol(oppgave) && oppgave.rol.employee?.navIdent === user.navIdent; + oppgave.rol.employee?.navIdent === user.navIdent; const rolCanEdit = (oppgave: IOppgavebehandling, user: IUserData): boolean => - supportsRol(oppgave) && - isRol(oppgave, user) && - oppgave.avsluttetAvSaksbehandlerDate === null && - oppgave.rol?.flowState === FlowState.SENT; + isRol(oppgave, user) && oppgave.avsluttetAvSaksbehandlerDate === null && oppgave.rol?.flowState === FlowState.SENT; export const canEditDocument = (templateId: TemplateIdEnum, oppgave: IOppgavebehandling, user: IUserData): boolean => { if (templateId === TemplateIdEnum.ROL_ANSWERS) { @@ -58,7 +47,7 @@ export const canEditDocument = (templateId: TemplateIdEnum, oppgave: IOppgavebeh const isMu = oppgave.medunderskriver?.employee?.navIdent === user.navIdent; const sentToMu = oppgave.medunderskriver.flowState === FlowState.SENT; - if (templateId === TemplateIdEnum.ROL_QUESTIONS && supportsRol(oppgave)) { + if (templateId === TemplateIdEnum.ROL_QUESTIONS) { if (isRol(oppgave, user)) { return false; } diff --git a/frontend/src/hooks/oppgavebehandling/use-has-access.ts b/frontend/src/hooks/oppgavebehandling/use-has-access.ts index 8c00f0ff2..b87b1dcc4 100644 --- a/frontend/src/hooks/oppgavebehandling/use-has-access.ts +++ b/frontend/src/hooks/oppgavebehandling/use-has-access.ts @@ -3,7 +3,6 @@ import { useOppgave } from '@app/hooks/oppgavebehandling/use-oppgave'; import { useHasRole } from '@app/hooks/use-has-role'; import { useHasYtelseAccess } from '@app/hooks/use-has-ytelse-access'; import { Role } from '@app/types/bruker'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import { useContext } from 'react'; @@ -29,20 +28,18 @@ export const useHasBehandlingAccess = (): boolean => { return true; } - if (data.typeId === SaksTypeEnum.KLAGE || data.typeId === SaksTypeEnum.ANKE) { - const { rol } = data; + const { rol } = data; - if (rol.employee === null) { - return false; - } + if (rol.employee === null) { + return false; + } - if (user.navIdent === rol.employee.navIdent) { - return true; - } + if (user.navIdent === rol.employee.navIdent) { + return true; + } - if (rol.flowState === FlowState.SENT) { - return isKrol; - } + if (rol.flowState === FlowState.SENT) { + return isKrol; } return false; diff --git a/frontend/src/hooks/use-can-document/use-can-drop-on-document.ts b/frontend/src/hooks/use-can-document/use-can-drop-on-document.ts index 256086665..f0ff47558 100644 --- a/frontend/src/hooks/use-can-document/use-can-drop-on-document.ts +++ b/frontend/src/hooks/use-can-document/use-can-drop-on-document.ts @@ -9,7 +9,6 @@ import { useIsRol } from '@app/hooks/use-is-rol'; import { useIsSaksbehandler } from '@app/hooks/use-is-saksbehandler'; import { Role } from '@app/types/bruker'; import { DocumentTypeEnum, type IMainDocument } from '@app/types/documents/documents'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import type { IOppgavebehandling } from '@app/types/oppgavebehandling/oppgavebehandling'; import { useContext } from 'react'; @@ -76,8 +75,4 @@ const isDroppableNewDocument = (dragged: IMainDocument | null, documentId: strin !getIsRolQuestions(dragged); const canRolActOnDocument = (document: IMainDocument, oppgave: IOppgavebehandling) => - getIsRolQuestions(document) && isSentToRol(oppgave); - -const isSentToRol = (oppgave: IOppgavebehandling) => - (oppgave.typeId === SaksTypeEnum.KLAGE || oppgave.typeId === SaksTypeEnum.ANKE) && - oppgave.rol.flowState === FlowState.SENT; + getIsRolQuestions(document) && oppgave.rol.flowState === FlowState.SENT; diff --git a/frontend/src/hooks/use-can-document/use-can-edit-document.test.ts b/frontend/src/hooks/use-can-document/use-can-edit-document.test.ts index 770d4d3e7..4c88f1123 100644 --- a/frontend/src/hooks/use-can-document/use-can-edit-document.test.ts +++ b/frontend/src/hooks/use-can-document/use-can-edit-document.test.ts @@ -67,7 +67,7 @@ const BASE_PARAMS: CanEditDocumentParams = { hasKrolRole: false, isRol: false, isTildeltSaksbehandler: false, - rolFlowState: null, + rolFlowState: FlowState.NOT_SENT, }; describe('canEditDocument', () => { diff --git a/frontend/src/hooks/use-can-document/use-can-edit-document.ts b/frontend/src/hooks/use-can-document/use-can-edit-document.ts index 1a678c099..1eed77399 100644 --- a/frontend/src/hooks/use-can-document/use-can-edit-document.ts +++ b/frontend/src/hooks/use-can-document/use-can-edit-document.ts @@ -7,7 +7,6 @@ import { useIsRol } from '@app/hooks/use-is-rol'; import { useIsSaksbehandler } from '@app/hooks/use-is-saksbehandler'; import { Role } from '@app/types/bruker'; import { CreatorRole, DocumentTypeEnum, type IMainDocument } from '@app/types/documents/documents'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import { TemplateIdEnum } from '@app/types/smart-editor/template-enums'; @@ -38,7 +37,7 @@ export const useCanEditDocument = (document: IMainDocument | null, parentDocumen isTildeltSaksbehandler, parentIsMarkertAvsluttet, medunderskriverFlowState: oppgave.medunderskriver.flowState, - rolFlowState: oppgave.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN ? null : oppgave.rol.flowState, + rolFlowState: oppgave.rol.flowState, }); }; @@ -46,7 +45,7 @@ export interface CanEditDocumentParams { medunderskriverFlowState: FlowState; parentIsMarkertAvsluttet: boolean; document: IMainDocument | null; - rolFlowState: FlowState | null; + rolFlowState: FlowState; isTildeltSaksbehandler: boolean; hasSaksbehandlerRole: boolean; hasMerkantilRole: boolean; diff --git a/frontend/src/hooks/use-is-rol.ts b/frontend/src/hooks/use-is-rol.ts index 61a946b16..440e74c58 100644 --- a/frontend/src/hooks/use-is-rol.ts +++ b/frontend/src/hooks/use-is-rol.ts @@ -1,5 +1,4 @@ import { StaticDataContext } from '@app/components/app/static-data-context'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import { useContext, useMemo } from 'react'; import { useOppgave } from './oppgavebehandling/use-oppgave'; @@ -13,11 +12,7 @@ export const useIsRol = () => { return false; } - return ( - isRolWithAnyFlowState && - oppgave.typeId !== SaksTypeEnum.ANKE_I_TRYGDERETTEN && - oppgave.rol.flowState !== FlowState.NOT_SENT - ); + return isRolWithAnyFlowState && oppgave.rol.flowState !== FlowState.NOT_SENT; }, [oppgave, isSuccess, isRolWithAnyFlowState]); }; @@ -31,10 +26,6 @@ export const useIsRolWithAnyFlowState = () => { return false; } - return ( - oppgave.typeId !== SaksTypeEnum.ANKE_I_TRYGDERETTEN && - oppgave.rol.employee !== null && - oppgave.rol.employee.navIdent === user.navIdent - ); + return oppgave.rol.employee !== null && oppgave.rol.employee.navIdent === user.navIdent; }, [oppgave, isSuccess, user]); }; diff --git a/frontend/src/hooks/use-oppgave-actions.ts b/frontend/src/hooks/use-oppgave-actions.ts index 52a5c760e..9e91306c3 100644 --- a/frontend/src/hooks/use-oppgave-actions.ts +++ b/frontend/src/hooks/use-oppgave-actions.ts @@ -18,7 +18,7 @@ export const useOppgaveActions = ( tildeltSaksbehandler: string | null, medunderskriver: string | null, medunderskriverFlowState: FlowState | null, - rolFlowState: FlowState | null, + rolFlowState: FlowState, ytelse?: string, ): ReturnType => { const { user } = useContext(StaticDataContext); @@ -27,7 +27,7 @@ export const useOppgaveActions = ( return useMemo(() => { const medunderskriverInvolved = medunderskriverFlowState !== null && medunderskriverFlowState !== FlowState.NOT_SENT; - const rolInvolved = rolFlowState !== null && rolFlowState !== FlowState.NOT_SENT; + const rolInvolved = rolFlowState !== FlowState.NOT_SENT; const isAssigned = tildeltSaksbehandler !== null; const isAssignedToSelf = isAssigned && user.navIdent === tildeltSaksbehandler; diff --git a/frontend/src/plate/components/signature/hooks.ts b/frontend/src/plate/components/signature/hooks.ts index 86166f452..1e786d448 100644 --- a/frontend/src/plate/components/signature/hooks.ts +++ b/frontend/src/plate/components/signature/hooks.ts @@ -6,7 +6,6 @@ import { MISSING_TITLE } from '@app/plate/components/signature/title'; import type { ISignature, SignatureElement } from '@app/plate/types'; import { useGetSignatureQuery } from '@app/redux-api/bruker'; import type { ISignatureResponse } from '@app/types/bruker'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { TemplateIdEnum } from '@app/types/smart-editor/template-enums'; import { skipToken } from '@reduxjs/toolkit/query'; import { useContext } from 'react'; @@ -31,7 +30,6 @@ export const useMainSignature = (element: SignatureElement): ISignature | undefi const { templateId, creator } = useContext(SmartEditorContext); const isRolAnswers = templateId === TemplateIdEnum.ROL_ANSWERS; - const isRolSakstype = oppgave?.typeId === SaksTypeEnum.KLAGE || oppgave?.typeId === SaksTypeEnum.ANKE; const isFinished = useIsFullfoert(); const isOverridden = element.overriddenSaksbehandler !== undefined; @@ -44,7 +42,7 @@ export const useMainSignature = (element: SignatureElement): ISignature | undefi ); const { data: overrideSignature } = useGetSignatureQuery(element.overriddenSaksbehandler ?? skipToken); const { data: rolSignature } = useGetSignatureQuery( - !isOverridden && isRolAnswers && isRolSakstype ? (oppgave.rol.employee?.navIdent ?? skipToken) : skipToken, + !isOverridden && isRolAnswers ? (oppgave?.rol.employee?.navIdent ?? skipToken) : skipToken, ); const suffix = templateId !== TemplateIdEnum.ROL_ANSWERS && element.useSuffix ? 'saksbehandler' : undefined; diff --git a/frontend/src/plate/templates/templates.ts b/frontend/src/plate/templates/templates.ts index a8b38650d..c7f054e45 100644 --- a/frontend/src/plate/templates/templates.ts +++ b/frontend/src/plate/templates/templates.ts @@ -60,6 +60,8 @@ export const ANKE_I_TRYGDERETTEN_TEMPLATES = [ GENERELT_BREV_TEMPLATE, NOTAT_TEMPLATE, ORIENTERING_OM_TILSVAR_TEMPLATE, + ROL_QUESTIONS_TEMPLATE, + ROL_TILSVARSBREV_TEMPLATE, SVAR_PÅ_INNSYNSBEGJÆRING_TEMPLATE, ]; diff --git a/frontend/src/redux-api/oppgaver/mutations/set-rol-flowstate.ts b/frontend/src/redux-api/oppgaver/mutations/set-rol-flowstate.ts index 34479d05e..e9c9c0511 100644 --- a/frontend/src/redux-api/oppgaver/mutations/set-rol-flowstate.ts +++ b/frontend/src/redux-api/oppgaver/mutations/set-rol-flowstate.ts @@ -2,7 +2,6 @@ import { toast } from '@app/components/toast/store'; import { apiErrorToast } from '@app/components/toast/toast-content/fetch-error-toast'; import { oppgaveDataQuerySlice } from '@app/redux-api/oppgaver/queries/oppgave-data'; import { isApiRejectionError } from '@app/types/errors'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import type { ISetFlowStateParams } from '@app/types/oppgavebehandling/params'; import type { ISetFlowStateResponse } from '@app/types/oppgavebehandling/response'; @@ -22,10 +21,6 @@ const setRolStateMutationSlice = oppgaverApi.injectEndpoints({ onQueryStarted: async ({ oppgaveId, flowState }, { dispatch, queryFulfilled }) => { const oppgavePatchResult = dispatch( behandlingerQuerySlice.util.updateQueryData('getOppgavebehandling', oppgaveId, (draft) => { - if (draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { - return draft; - } - draft.rol.flowState = flowState; }), ); @@ -35,10 +30,6 @@ const setRolStateMutationSlice = oppgaverApi.injectEndpoints({ dispatch( behandlingerQuerySlice.util.updateQueryData('getOppgavebehandling', oppgaveId, (draft) => { - if (draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { - return draft; - } - draft.modified = data.modified; draft.rol.flowState = data.flowState; draft.rol.employee = data.employee; @@ -47,10 +38,6 @@ const setRolStateMutationSlice = oppgaverApi.injectEndpoints({ dispatch( oppgaveDataQuerySlice.util.updateQueryData('getOppgave', oppgaveId, (draft) => { - if (draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { - return draft; - } - draft.rol.flowState = data.flowState; draft.rol.employee = data.employee; draft.rol.returnertDate = null; diff --git a/frontend/src/redux-api/oppgaver/mutations/set-rol.ts b/frontend/src/redux-api/oppgaver/mutations/set-rol.ts index b74b6a1d8..682badc64 100644 --- a/frontend/src/redux-api/oppgaver/mutations/set-rol.ts +++ b/frontend/src/redux-api/oppgaver/mutations/set-rol.ts @@ -2,7 +2,6 @@ import { toast } from '@app/components/toast/store'; import { apiErrorToast } from '@app/components/toast/toast-content/fetch-error-toast'; import { oppgaveDataQuerySlice } from '@app/redux-api/oppgaver/queries/oppgave-data'; import { isApiRejectionError } from '@app/types/errors'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import type { ISetRolParams } from '@app/types/oppgavebehandling/params'; import type { ISetRolResponse } from '@app/types/oppgavebehandling/response'; @@ -22,10 +21,6 @@ const setRolMutationSlice = oppgaverApi.injectEndpoints({ onQueryStarted: async ({ oppgaveId, employee }, { dispatch, queryFulfilled }) => { const patchResult = dispatch( behandlingerQuerySlice.util.updateQueryData('getOppgavebehandling', oppgaveId, (draft) => { - if (draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { - return draft; - } - if (draft.rol.employee?.navIdent === employee?.navIdent) { return draft; } @@ -43,10 +38,6 @@ const setRolMutationSlice = oppgaverApi.injectEndpoints({ dispatch( behandlingerQuerySlice.util.updateQueryData('getOppgavebehandling', oppgaveId, (draft) => { - if (draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { - return draft; - } - draft.modified = data.modified; draft.rol.flowState = data.flowState; draft.rol.employee = data.employee; @@ -55,10 +46,6 @@ const setRolMutationSlice = oppgaverApi.injectEndpoints({ dispatch( oppgaveDataQuerySlice.util.updateQueryData('getOppgave', oppgaveId, (draft) => { - if (draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { - return draft; - } - draft.rol.flowState = data.flowState; draft.rol.employee = data.employee; draft.rol.returnertDate = null; diff --git a/frontend/src/redux-api/oppgaver/queries/behandling/event-handlers/rol.tsx b/frontend/src/redux-api/oppgaver/queries/behandling/event-handlers/rol.tsx index 591ffd55e..79d6a83ff 100644 --- a/frontend/src/redux-api/oppgaver/queries/behandling/event-handlers/rol.tsx +++ b/frontend/src/redux-api/oppgaver/queries/behandling/event-handlers/rol.tsx @@ -4,7 +4,6 @@ import type { UpdateFn } from '@app/redux-api/oppgaver/queries/behandling/types' import { historyQuerySlice } from '@app/redux-api/oppgaver/queries/history'; import type { RolEvent } from '@app/redux-api/server-sent-events/types'; import { reduxStore } from '@app/redux/configure-store'; -import { SaksTypeEnum } from '@app/types/kodeverk'; import { FlowState } from '@app/types/oppgave-common'; import type { IOppgavebehandling } from '@app/types/oppgavebehandling/oppgavebehandling'; import { HistoryEventTypes } from '@app/types/oppgavebehandling/response'; @@ -18,7 +17,7 @@ export const handleRolEvent = let previousFlow = FlowState.NOT_SENT; updateCachedData((draft) => { - if (draft === undefined || draft.typeId === SaksTypeEnum.ANKE_I_TRYGDERETTEN) { + if (draft === undefined) { return draft; } diff --git a/frontend/src/types/oppgavebehandling/oppgavebehandling.ts b/frontend/src/types/oppgavebehandling/oppgavebehandling.ts index 6b8fb5e62..4eb70fb2c 100644 --- a/frontend/src/types/oppgavebehandling/oppgavebehandling.ts +++ b/frontend/src/types/oppgavebehandling/oppgavebehandling.ts @@ -92,6 +92,7 @@ export interface IOppgavebehandlingBase { prosessfullmektig: IPart | null; raadfoertMedLege: string | null; resultat: Resultat; + rol: IMedunderskriverRol; sakenGjelder: ISakenGjelder; sattPaaVent: IVenteperiode | null; sendTilbakemelding: boolean | null; @@ -114,12 +115,10 @@ export interface IOppgavebehandlingBase { export interface IKlagebehandling extends IOppgavebehandlingBase { typeId: SaksTypeEnum.KLAGE; - rol: IMedunderskriverRol; } export interface IAnkebehandling extends IOppgavebehandlingBase { typeId: SaksTypeEnum.ANKE; - rol: IMedunderskriverRol; } export interface ITrygderettsankebehandling extends IOppgavebehandlingBase { @@ -130,13 +129,11 @@ export interface ITrygderettsankebehandling extends IOppgavebehandlingBase { export interface IBehandlingEtterTryderettenOpphevet extends IOppgavebehandlingBase { typeId: SaksTypeEnum.BEHANDLING_ETTER_TR_OPPHEVET; - rol: IMedunderskriverRol; kjennelseMottatt: string | null; } export interface IOmgjøringskravbehandling extends IOppgavebehandlingBase { typeId: SaksTypeEnum.OMGJØRINGSKRAV; - rol: IMedunderskriverRol; } export type IOppgavebehandling =