Skip to content

Commit

Permalink
Merge pull request #842 from Amsterdam/refactor/remove-debriefing-upd…
Browse files Browse the repository at this point in the history
…ate-delete

Remove code, files
  • Loading branch information
gilleswittenberg authored Mar 16, 2021
2 parents adc5f31 + fa134df commit 0486214
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 153 deletions.
29 changes: 23 additions & 6 deletions src/__generated__/apiSchema.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

24 changes: 6 additions & 18 deletions src/app/components/cases/CaseTimeline/components/EventWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
import React from "react"
import type { Field } from "../helpers/fields"
import EventData from "./EventData"
import ButtonEditEvent from "./ButtonEditEvent"
import to from "app/routing/utils/to"

type Props = {
fields: Field[]
caseEvent: Components.Schemas.CaseEvent
isNested?: boolean
pathName?: string
}

const EventWrapper: React.FC<Props> = ({ fields, caseEvent: { case: caseId, event_values, emitter_id, emitter_is_editable, emitter_is_editable_until }, isNested, pathName }) => (
<>
<EventData
fields={ fields }
values={ event_values }
isNested={ isNested }
/>
{ emitter_is_editable_until && pathName !== undefined &&
<ButtonEditEvent
target={ to(`/zaken/:id/${ pathName }/:${ pathName }Id`, { id: caseId, [`${ pathName }Id`]: emitter_id }) }
disabled={ !emitter_is_editable }
editable_until={ emitter_is_editable_until }
/>
}
</>
const EventWrapper: React.FC<Props> = ({ fields, caseEvent: { event_values }, isNested }) => (
<EventData
fields={ fields }
values={ event_values }
isNested={ isNested }
/>
)

export default EventWrapper
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const TimelineEventItem: React.FC<Props> = ({ fields, caseEvents, title = "", da
largeCircle={ false }
isNested={ true }
>
<EventWrapper fields={ fields } caseEvent={ caseEvent } pathName={ pathName } isNested={ true } />
<EventWrapper fields={ fields } caseEvent={ caseEvent } isNested={ true } />
</Timeline> :
<EventWrapper fields={ fields } caseEvent={ caseEvent } pathName={ pathName } />
<EventWrapper fields={ fields } caseEvent={ caseEvent } />
}
</div>
) ) }
Expand Down
49 changes: 0 additions & 49 deletions src/app/pages/case/debriefings/EditPage.tsx

This file was deleted.

21 changes: 2 additions & 19 deletions src/app/pages/case/debriefings/hooks/usePageDebriefing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useFlashMessages } from "app/state/flashMessages/useFlashMessages"
import navigateTo from "app/routing/navigateTo"

const usePageDebriefing = (caseId?: Components.Schemas.Case["id"], id?: Components.Schemas.Debriefing["id"]) => {
const [, { execPost, execPut, execDelete }] = useDebriefings(id, { lazy: true })
const [, { execPost }] = useDebriefings(id, { lazy: true })
const { addSuccessFlashMessage } = useFlashMessages()

const path = `/zaken/${ caseId ?? "" }`
Expand All @@ -18,24 +18,7 @@ const usePageDebriefing = (caseId?: Components.Schemas.Case["id"], id?: Componen
[addSuccessFlashMessage, path, execPost]
)

const handleUpdate = useCallback(payload =>
execPut(payload).then(() => {
addSuccessFlashMessage(path, "Succes", "De debriefing is succesvol gewijzigd")
return navigateTo(path)
}),
[addSuccessFlashMessage, path, execPut]
)

const handleDelete = useCallback(() =>
execDelete().then(() => {
addSuccessFlashMessage(path, "Succes", "De debriefing is succesvol verwijderd")
// TODO: Fix bug that debrief will be refetched, cause it's cache hook is used within displayed component
return navigateTo(path)
}),
[addSuccessFlashMessage, path, execDelete]
)

return { handleCreate, handleUpdate, handleDelete }
return { handleCreate }
}

export default usePageDebriefing
7 changes: 0 additions & 7 deletions src/app/pages/cases/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import IndexPage from "app/pages/cases/index/IndexPage"
import DetailsPage from "app/pages/cases/details/DetailsPage"
import DebriefCreatePage from "app/pages/case/debriefings/CreatePage"
import DebriefEditPage from "app/pages/case/debriefings/EditPage"
import OpinionCreatePage from "app/pages/case/opinions/CreatePage"
import SummonCreatePage from "app/pages/case/summons/CreatePage"
import DecisionCreatePage from "app/pages/case/decisions/CreatePage"
import CorrespondenceCreatePage from "app/pages/case/correspondence/CreatePage"
import CompleteCasePage from "app/pages/cases/complete/CompleteCasePage"
import VisitCreatePage from "app/pages/case/visits/CreatePage"


// NOTE: please add your own POC-specific routes here.
export default {
"/zaken": {
Expand Down Expand Up @@ -37,11 +35,6 @@ export default {
title: "Debrief terugkoppeling geven",
icon: "Edit"
},
"debriefing/:debriefingId": {
Page: DebriefEditPage,
title: "Debrief terugkoppeling wijzigen",
icon: "Edit"
},
"besluit": {
Page: DecisionCreatePage,
title: "Resultaat besluit",
Expand Down

0 comments on commit 0486214

Please sign in to comment.