Skip to content

Commit

Permalink
FAGSYSTEM-371156: Legger på simulering ved opphør (#7137)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikg authored Feb 26, 2025
1 parent 9a84b4a commit 0210aac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const BeregneBP = (props: { behandling: IBehandlingReducer }) => {
<>
{erOpphoer ? (
<Box paddingInline="18" paddingBlock="4">
<SimulerUtbetaling behandling={behandling} />
<Brevutfall behandling={behandling} resetBrevutfallvalidering={() => setManglerbrevutfall(false)} />
</Box>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const BeregneOMS = () => {
<>
{erOpphoer ? (
<Box paddingInline="18" paddingBlock="4">
<SimulerUtbetaling behandling={behandling} />
<Brevutfall behandling={behandling} resetBrevutfallvalidering={() => setManglerbrevutfall(false)} />
</Box>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { erFerdigBehandlet } from '~components/behandling/felles/utils'
import { useAppSelector } from '~store/Store'
import { compareDesc } from 'date-fns'
import { SakType } from '~shared/types/sak'
import { VilkaarsvurderingResultat } from '~shared/api/vilkaarsvurdering'

export const SimulerUtbetaling = (props: { behandling: IBehandlingReducer }) => {
const { behandling } = props
Expand All @@ -25,6 +26,8 @@ export const SimulerUtbetaling = (props: { behandling: IBehandlingReducer }) =>
// For OMS, lytte etter oppdatert beregning/avkorting
const avkorting = useAppSelector((state) => state.behandlingReducer.behandling?.avkorting)

const erOpphoer = behandling.vilkaarsvurdering?.resultat?.utfall == VilkaarsvurderingResultat.IKKE_OPPFYLT

function behandlingStatusFerdigEllerVedtakFattet() {
return erFerdigBehandlet(behandling.status) || behandling.status === IBehandlingStatus.FATTET_VEDTAK
}
Expand All @@ -42,7 +45,11 @@ export const SimulerUtbetaling = (props: { behandling: IBehandlingReducer }) =>
}, [behandling.status, avkorting])

const simuler = () => {
if (behandling.status === IBehandlingStatus.BEREGNET || behandling.status === IBehandlingStatus.AVKORTET) {
if (
behandling.status === IBehandlingStatus.BEREGNET ||
behandling.status === IBehandlingStatus.AVKORTET ||
erOpphoer
) {
simulerUtbetalingRequest(behandling.id)
}
}
Expand Down

0 comments on commit 0210aac

Please sign in to comment.