Skip to content

Commit

Permalink
Merge pull request #88 from ConductionNL/feature/PC108-111/contactmom…
Browse files Browse the repository at this point in the history
…ent-zaak-aanmaken

enabled create zaak on contactMoment modal
  • Loading branch information
RalkeyOfficial authored Dec 12, 2024
2 parents c34cb4e + a5ca104 commit 3e1bb4e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/modals/contactMomenten/ContactMomentenForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ import { contactMomentStore, navigationStore, taakStore, zaakStore } from '../..
</template>
Klant taak aanmaken
</NcActionButton>
<NcActionButton :disabled="true" @click="zaakStore.setZaakItem(); navigationStore.setModal('editZaak')">
<NcActionButton :disabled="!klant?.id" @click="openZaakForm()">
<template #icon>
<BriefcaseAccountOutline :size="20" />
</template>
Expand All @@ -250,6 +250,12 @@ import { contactMomentStore, navigationStore, taakStore, zaakStore } from '../..
:klant-id="klant?.id"
@close-modal="closeTaakForm"
@save-success="closeTaakForm" />

<ZaakForm v-if="zaakFormOpen"
:dashboard-widget="true"
:klant-id="klant?.id"
@close-modal="() => (zaakFormOpen = false)"
@save-success="zaakFormSaveSuccess" />
</NcDialog>
</template>

Expand All @@ -261,6 +267,7 @@ import { NcButton, NcActions, NcLoadingIcon, NcDialog, NcTextArea, NcNoteCard, N
// Forms
import SearchKlantModal from '../../modals/klanten/SearchKlantModal.vue'
import EditTaak from '../../modals/taken/EditTaak.vue'
import ZaakForm from '../../modals/zaken/ZaakForm.vue'
// Icons
import Plus from 'vue-material-design-icons/Plus.vue'
Expand Down Expand Up @@ -344,6 +351,7 @@ export default {
startingType: 'all',
taakFormOpen: false,
taakClientType: 'both',
zaakFormOpen: false,
}
},
mounted() {
Expand Down Expand Up @@ -455,6 +463,17 @@ export default {
this.taakFormOpen = false
},
// zaak functions
openZaakForm() {
zaakStore.setZaakItem(null)
this.zaakFormOpen = true
},
zaakFormSaveSuccess() {
this.zaakFormOpen = false
this.fetchKlantData(this.klant.id)
},
async fetchKlantData(id) {
try {
const klantResponse = await fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}`)
Expand Down
10 changes: 10 additions & 0 deletions src/modals/zaken/ZaakForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ export default {
default: false,
required: false,
},
/**
* The id of the klant that the zaak is for.
* Currently there is no dropdown for selecting a klant.
* So it currently will pass the klantId with the zaak to the API.
*/
klantId: {
type: String,
default: null,
},
},
data() {
return {
Expand Down Expand Up @@ -230,6 +239,7 @@ export default {
...this.zaak,
archiefstatus: this.archiefstatus.value?.id || '',
zaaktype: this.zaakType.value?.id || '',
klant: this.klantId,
})
zaakStore.saveZaak(newZaak)
Expand Down

0 comments on commit 3e1bb4e

Please sign in to comment.