Skip to content

Commit

Permalink
Opnar også i frontend for å kunne redigere
Browse files Browse the repository at this point in the history
  • Loading branch information
madsop-nav committed Jul 25, 2023
1 parent 990f20c commit 1b0f933
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import ForhaandsvisningBrev from '~components/behandling/brev/ForhaandsvisningBr
import Spinner from '~shared/Spinner'
import { BrevProsessType } from '~shared/types/Brev'
import RedigerbartBrev from '~components/behandling/brev/RedigerbartBrev'
import { Revurderingsaarsak } from '~shared/types/Revurderingsaarsak'

export const Vedtaksbrev = (props: { behandling: IDetaljertBehandling }) => {
const { behandlingId } = useParams()
Expand Down Expand Up @@ -55,6 +56,13 @@ export const Vedtaksbrev = (props: { behandling: IDetaljertBehandling }) => {
fetchVedtaksbrev()
}, [behandlingId, sakId])

const erReadOnly = () => {
return (
vedtaksbrev.prosessType === BrevProsessType.AUTOMATISK &&
props.behandling.revurderingsaarsak! in [Revurderingsaarsak.OMGJOERING_AV_FARSKAP]
)
}

return (
<Content>
<BrevContent>
Expand Down Expand Up @@ -86,7 +94,7 @@ export const Vedtaksbrev = (props: { behandling: IDetaljertBehandling }) => {
</SpinnerContainer>
) : error ? (
<ErrorMessage>{error}</ErrorMessage>
) : vedtaksbrev.prosessType === BrevProsessType.AUTOMATISK ? (
) : erReadOnly() ? (
<ForhaandsvisningBrev brev={vedtaksbrev} />
) : (
<RedigerbartBrev brev={vedtaksbrev} kanRedigeres={manueltBrevKanRedigeres(status)} />
Expand Down

0 comments on commit 1b0f933

Please sign in to comment.