Skip to content

Commit

Permalink
Merge pull request #2198 from Amsterdam/bugfix/86833-summon-types-by-…
Browse files Browse the repository at this point in the history
…task-id

86833
  • Loading branch information
remyvdwereld authored Jul 18, 2023
2 parents fd8142a + 872ab6e commit c7d2822
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ RUN mv $DIR/build/* $DIR/builds/acceptance/
FROM nginx:stable-alpine
ADD nginx.conf /etc/nginx/nginx.conf

RUN apk update && apk upgrade libx11

COPY --from=builder /var/www/builds /var/www
CMD nginx -g 'daemon off;'
9 changes: 3 additions & 6 deletions src/app/components/case/forms/SummonForm/SummonForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { FormTitle } from "@amsterdam/asc-ui"

import { useCase, useSummons, useSummonTypes } from "app/state/rest/"
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"
Expand Down Expand Up @@ -52,12 +52,9 @@ const mapData = (data: SummonData) => {
}

const SummonForm: React.FC<Props> = ({ id, caseUserTaskId }) => {

const themeId = useCase(id)[0]?.theme.id
const [data] = useSummonTypes(themeId)
const [data] = useSummonTypesByTaskId(caseUserTaskId)
const summonTypes = data?.results
const summonTypesWithoutBoete = summonTypes?.filter((summonType) => summonType.workflow_option !== "besluit")
const fields = useScaffoldedFields(scaffold, id, summonTypesWithoutBoete)
const fields = useScaffoldedFields(scaffold, id, summonTypes)
const [, { execPost }] = useSummons({ lazy: true })

return (
Expand Down
12 changes: 12 additions & 0 deletions src/app/state/rest/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,15 @@ export const useTaskNames = (role: string) => {
isProtected: true
})
}

// useSummonTypes for getting the available summonTypes for a specific task
export const useSummonTypesByTaskId = (id: Components.Schemas.CaseUserTaskWorkdflow["case_user_task_id"], options?: Options) => {
const handleError = useErrorHandler()
return useApiRequest<Components.Schemas.PaginatedSummonTypeList>({
...options,
url: makeApiUrl("tasks", id, "summon-types"),
groupName: "task",
handleError,
isProtected: true
})
}

0 comments on commit c7d2822

Please sign in to comment.