-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
endre Åpent for påmelding-flagg utenfor skjema
- Loading branch information
Showing
19 changed files
with
148 additions
and
48 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
frontend/mr-admin-flate/src/api/tiltaksgjennomforing/useSetApentForPamelding.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { QueryKeys } from "@/api/QueryKeys"; | ||
import { TiltaksgjennomforingerService } from "@mr/api-client"; | ||
|
||
export function useSetApentForPamelding(id: string) { | ||
const queryClient = useQueryClient(); | ||
|
||
return useMutation({ | ||
mutationFn: async (apentForPamelding: boolean) => { | ||
return TiltaksgjennomforingerService.setApentForPamelding({ | ||
id: id, | ||
requestBody: { apentForPamelding }, | ||
}); | ||
}, | ||
|
||
onSuccess() { | ||
return Promise.all([ | ||
queryClient.invalidateQueries({ | ||
queryKey: QueryKeys.tiltaksgjennomforinger(), | ||
}), | ||
queryClient.invalidateQueries({ | ||
queryKey: QueryKeys.tiltaksgjennomforing(id), | ||
}), | ||
]); | ||
}, | ||
|
||
throwOnError: true, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
frontend/mr-admin-flate/src/components/tiltaksgjennomforinger/SetApentForPameldingModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Alert, BodyLong, Button, Modal, Switch } from "@navikt/ds-react"; | ||
import { RefObject } from "react"; | ||
import { TiltaksgjennomforingDto } from "@mr/api-client"; | ||
import { useSetApentForPamelding } from "@/api/tiltaksgjennomforing/useSetApentForPamelding"; | ||
|
||
interface Props { | ||
modalRef: RefObject<HTMLDialogElement>; | ||
gjennomforing: TiltaksgjennomforingDto; | ||
} | ||
|
||
export function SetApentForPameldingModal({ modalRef, gjennomforing }: Props) { | ||
const { mutate } = useSetApentForPamelding(gjennomforing.id); | ||
|
||
return ( | ||
<Modal ref={modalRef} header={{ heading: "Åpent for påmelding" }}> | ||
<Modal.Body> | ||
<BodyLong> | ||
<p>Dette flagget styrer om deltakere kan meldes på fra Modia.</p> | ||
|
||
<Alert variant={"info"}> | ||
<b>Det er kun mulig å stenge for påmelding fra Modia.</b> Hvis deltakelsen fortsatt | ||
administreres i Arena så vil ikke dette flagget ha noe effekt, men det vil likevel vises | ||
som stengt i Modia. | ||
</Alert> | ||
|
||
<p> | ||
Påmelding stenges automatisk av systemet når: | ||
<ul> | ||
<li> | ||
Tiltak med oppstartstype <b>felles oppstart</b> starter. | ||
</li> | ||
<li>Tiltaket avsluttes eller blir avbrutt.</li> | ||
</ul> | ||
</p> | ||
|
||
<Switch | ||
checked={gjennomforing.apentForPamelding} | ||
onChange={(e) => mutate(e.target.checked)} | ||
> | ||
Åpent for påmelding | ||
</Switch> | ||
</BodyLong> | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button type="button" onClick={() => modalRef.current?.close()}> | ||
Ferdig | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
mulighetsrommet-api/src/main/resources/db/migration/V205__apent_for_pamelding.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table tiltaksgjennomforing | ||
alter column apent_for_pamelding set default true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.