Skip to content

Commit

Permalink
Merge pull request #98 from ConductionNL/feature/PC108-100/close-cont…
Browse files Browse the repository at this point in the history
…actmoment

improved close contactmoment function
  • Loading branch information
RalkeyOfficial authored Dec 16, 2024
2 parents 52e8771 + 5306d7b commit 97087f3
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions src/modals/contactMomenten/ContactMomentenForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,32 +204,32 @@ import { contactMomentStore, navigationStore, taakStore, zaakStore } from '../..
</template>
Annuleer
</NcButton>
<NcActions v-if="!isView"
:disabled="loading || success || fetchLoading"
<NcActions :disabled="loading || success || fetchLoading"
:primary="true"
:force-name="true"
menu-name="Acties">
<template #icon>
<DotsHorizontal :size="20" />
</template>
<NcActionButton @click="openTaakForm('medewerker')">
<NcActionButton v-if="!isView" @click="openTaakForm('medewerker')">
<template #icon>
<CalendarMonthOutline :size="20" />
</template>
Medewerker taak aanmaken
</NcActionButton>
<NcActionButton @click="openTaakForm('klant')">
<NcActionButton v-if="!isView" @click="openTaakForm('klant')">
<template #icon>
<CalendarMonthOutline :size="20" />
</template>
Klant taak aanmaken
</NcActionButton>
<NcActionButton :disabled="!klant?.id" @click="openZaakForm()">
<NcActionButton v-if="!isView" :disabled="!klant?.id" @click="openZaakForm()">
<template #icon>
<BriefcaseAccountOutline :size="20" />
</template>
Zaak starten
</NcActionButton>
<NcActionButton :disabled="contactMoment.status === 'gesloten'" @click="() => (contactMoment.status = 'gesloten')">
<NcActionButton :disabled="contactMoment.status === 'gesloten'" @click="closeContactMoment">
<template #icon>
<BriefcaseAccountOutline :size="20" />
</template>
Expand Down Expand Up @@ -428,17 +428,31 @@ export default {
taak: this.selectedTaak ?? '',
product: this.selectedProduct ?? '',
status: this.contactMoment.status === 'gesloten' ? 'gesloten' : 'open',
startDate: new Date().toISOString(),
startDate: this.contactMoment.startDate ?? new Date().toISOString(),
}),
},
)
.then((response) => {
if (this.isView) {
response.json().then(data => {
this.contactMoment = data
})
if (this.dashboardWidget === true) {
this.$emit('save-success')
}
this.loading = false
return
}
this.succesMessage = true
// Get the modal to self close
this.success = true
this.loading = false
setTimeout(this.closeModal, 2000)
if (this.dashboardWidget === true) {
this.$emit('save-success')
}
Expand Down Expand Up @@ -480,6 +494,11 @@ export default {
this.fetchKlantData(this.klant.id)
},
closeContactMoment() {
this.contactMoment.status = 'gesloten'
if (this.isView) this.addContactMoment()
},
async fetchKlantData(id) {
try {
const klantResponse = await fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}`)
Expand Down

0 comments on commit 97087f3

Please sign in to comment.