From 5306d7ba501b08738689389460bea61b12fe1fe2 Mon Sep 17 00:00:00 2001 From: Thijn Date: Mon, 16 Dec 2024 13:43:18 +0100 Subject: [PATCH] improved close contactmoment function --- .../contactMomenten/ContactMomentenForm.vue | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/modals/contactMomenten/ContactMomentenForm.vue b/src/modals/contactMomenten/ContactMomentenForm.vue index f9152ab..7e04059 100644 --- a/src/modals/contactMomenten/ContactMomentenForm.vue +++ b/src/modals/contactMomenten/ContactMomentenForm.vue @@ -204,32 +204,32 @@ import { contactMomentStore, navigationStore, taakStore, zaakStore } from '../.. Annuleer - - + Medewerker taak aanmaken - + Klant taak aanmaken - + Zaak starten - + @@ -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') } @@ -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}`)