Skip to content

Commit

Permalink
henter varselsgrunnlag fra behovsmelding i stedet for sak
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbyfl committed Nov 4, 2024
1 parent 955c9c7 commit aba2ff5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions client/src/saksbilde/varsler/useVarselsregler.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Leveringsmåte as LeveringsmåteType, VarselFor } from '../../types/types.internal'
import { useSak } from '../useSak'
import { Utleveringsmåte } from '../../types/BehovsmeldingTypes'
import { VarselFor } from '../../types/types.internal'
import { useBehovsmelding } from '../useBehovsmelding'
import { useVarsler } from './useVarsler'

export function useVarselsregler() {
const { data: sak } = useSak()?.sak ?? { data: undefined }
const { behovsmelding } = useBehovsmelding()
const { varsler } = useVarsler()

const harVarsler = varsler && varsler.length > 0
Expand All @@ -12,13 +13,14 @@ export function useVarselsregler() {
harVarsler,
harLeveringsVarsel(): boolean {
return !!(
sak?.levering.leveringsmåte === LeveringsmåteType.ANNEN_ADRESSE &&
behovsmelding?.levering.utleveringsmåte === Utleveringsmåte.ANNEN_BRUKSADRESSE &&
varsler.find((varsel) => varsel?.varslerFor.includes(VarselFor.ANNEN_ADRESSE))
)
},
harBeskjedTilKommuneVarsel(): boolean {
return !!(
sak?.levering.merknad && varsler.find((varsel) => varsel?.varslerFor.includes(VarselFor.BESKJED_TIL_KOMMUNE))
behovsmelding?.levering.utleveringMerknad &&
varsler.find((varsel) => varsel?.varslerFor.includes(VarselFor.BESKJED_TIL_KOMMUNE))
)
},
harTilbakeleveringsVarsel(): boolean {
Expand Down

0 comments on commit aba2ff5

Please sign in to comment.