Skip to content

Commit

Permalink
read only på checkbokser
Browse files Browse the repository at this point in the history
  • Loading branch information
hallvardastark committed Jan 2, 2025
1 parent a8a69e0 commit aa37be8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/v2/gui/src/prosess/ung-vedtak/UngVedtak.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const InnvilgetStory: Story = {
],
},
],
readOnly: false,
},
};

Expand Down Expand Up @@ -90,5 +91,6 @@ export const AvslåttStory: Story = {
},
id: 3000001,
},
readOnly: false,
},
};
7 changes: 4 additions & 3 deletions packages/v2/gui/src/prosess/ung-vedtak/UngVedtak.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface UngVedtakProps {
behandling: UngVedtakBehandlingDto;
submitCallback: (data: any) => Promise<any>;
vilkår: UngVedtakVilkårDto[];
readOnly: boolean;
}

const buildInitialValues = () => ({
Expand All @@ -32,7 +33,7 @@ interface FormData {
hindreUtsendingAvBrev: boolean;
}

export const UngVedtak = ({ api, behandling, aksjonspunkter, submitCallback, vilkår }: UngVedtakProps) => {
export const UngVedtak = ({ api, behandling, aksjonspunkter, submitCallback, vilkår, readOnly }: UngVedtakProps) => {
const formMethods = useForm<FormData>({
defaultValues: buildInitialValues(),
});
Expand Down Expand Up @@ -106,12 +107,12 @@ export const UngVedtak = ({ api, behandling, aksjonspunkter, submitCallback, vil
<CheckboxField
name="redigerAutomatiskBrev"
label="Rediger automatisk brev"
disabled={hindreUtsendingAvBrev}
disabled={hindreUtsendingAvBrev || readOnly}
/>
<CheckboxField
name="hindreUtsendingAvBrev"
label="Hindre utsending av brev"
disabled={redigerAutomatiskBrev}
disabled={redigerAutomatiskBrev || readOnly}
/>
</div>
</Fieldset>
Expand Down
10 changes: 9 additions & 1 deletion packages/v2/gui/src/prosess/ung-vedtak/UngVedtakIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ interface UngVedtakIndexProps {
behandling: UngVedtakBehandlingDto;
submitCallback: (data: any) => Promise<any>;
vilkar: UngVedtakVilkårDto[];
isReadOnly: boolean;
}

export const UngVedtakIndex = ({ aksjonspunkter, behandling, submitCallback, vilkar }: UngVedtakIndexProps) => {
export const UngVedtakIndex = ({
aksjonspunkter,
behandling,
submitCallback,
vilkar,
isReadOnly,
}: UngVedtakIndexProps) => {
const ungSakClient = useContext(UngSakClientContext);
const ungVedtakBackendClient = new UngVedtakBackendClient(ungSakClient);
return (
Expand All @@ -28,6 +35,7 @@ export const UngVedtakIndex = ({ aksjonspunkter, behandling, submitCallback, vil
behandling={behandling}
submitCallback={submitCallback}
vilkår={vilkar}
readOnly={isReadOnly}
/>
</>
);
Expand Down

0 comments on commit aa37be8

Please sign in to comment.