Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annuleer button is navigating to previous page #2609

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/components/case/forms/SummonForm/SummonForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useSummons, useSummonTypesByTaskId } from "app/state/rest"
import WorkflowForm from "app/components/case/WorkflowForm/WorkflowForm"
import scaffold from "app/components/case/forms/SummonForm/scaffold"
import useScaffoldedFields from "app/components/shared/ConfirmScaffoldForm/hooks/useScaffoldedFields"
import useNavigation from "app/routing/useNavigation"

type Props = {
id: Components.Schemas.CaseDetail["id"]
Expand Down Expand Up @@ -54,7 +55,8 @@ const mapData = (data: SummonData) => {
const SummonForm: React.FC<Props> = ({ id, caseUserTaskId }) => {
const [data] = useSummonTypesByTaskId(caseUserTaskId)
const summonTypes = data?.results
const fields = useScaffoldedFields(scaffold, id, summonTypes)
const { navigateTo } = useNavigation()
const fields = useScaffoldedFields(scaffold, id, navigateTo, summonTypes)
const [, { execPost }] = useSummons({ lazy: true })

return (
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/case/forms/SummonForm/scaffold.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { FormPositioner } from "@amsterdam/amsterdam-react-final-form"
import { Fields } from "app/components/shared/Form/ScaffoldFields"
import InfoButton from "app/components/shared/InfoHeading/InfoButton"
import { personRoleMap } from "@amsterdam/wonen-ui/helpers/dictionaries"
import { redirect } from "react-router-dom"
import type { NavigateToFunction } from "app/routing/useNavigation"

export default (caseId: Components.Schemas.CaseDetail["id"], summonTypes?: Components.Schemas.SummonType[]) => {
export default (caseId: Components.Schemas.CaseDetail["id"], navigateTo: NavigateToFunction, summonTypes?: Components.Schemas.SummonType[]) => {
const roleEntries = Object.entries(personRoleMap)
const personRoles = roleEntries.filter(([key]) => key !== "PERSON_ROLE_PLATFORM").map(([key, label]) => ({ key, label }))
const legalEntityRoles = roleEntries.filter(([key]) => !["PERSON_ROLE_HEIR", "PERSON_ROLE_RESIDENT"].includes(key)).map(([key, label]) => ({ key, label }))
Expand Down Expand Up @@ -221,7 +221,7 @@ export default (caseId: Components.Schemas.CaseDetail["id"], summonTypes?: Compo
props: {
label: "Annuleren",
variant: "primaryInverted",
onClick: () => redirect(`/zaken/${ caseId }`)
onClick: () => navigateTo("/zaken/:id", { id: caseId })
}
},
submit: {
Expand Down