diff --git a/src/entities/contactmoment/contactmoment.mock.ts b/src/entities/contactmoment/contactmoment.mock.ts index 563b9ea..be3c000 100644 --- a/src/entities/contactmoment/contactmoment.mock.ts +++ b/src/entities/contactmoment/contactmoment.mock.ts @@ -12,6 +12,7 @@ export const mockContactMomentData = (): TContactMoment[] => [ product: 'Product 3', startDate: new Date().toISOString(), status: 'open', + contactmoment: 'Contactmoment 3', }, ] diff --git a/src/entities/contactmoment/contactmoment.ts b/src/entities/contactmoment/contactmoment.ts index 14aa482..da525bd 100644 --- a/src/entities/contactmoment/contactmoment.ts +++ b/src/entities/contactmoment/contactmoment.ts @@ -12,6 +12,7 @@ export class ContactMoment implements TContactMoment { public product: string public startDate: string public status: string + public contactmoment: string constructor(source: TContactMoment) { this.id = source.id || '' @@ -23,6 +24,7 @@ export class ContactMoment implements TContactMoment { this.product = source.product || '' this.startDate = source.startDate || '' this.status = source.status || 'open' + this.contactmoment = source.contactmoment || '' } public validate(): SafeParseReturnType { @@ -36,6 +38,7 @@ export class ContactMoment implements TContactMoment { product: z.string().min(1), startDate: z.string().min(1), status: z.string().min(1), + contactmoment: z.string().min(1), }) return schema.safeParse(this) diff --git a/src/entities/contactmoment/contactmoment.types.ts b/src/entities/contactmoment/contactmoment.types.ts index 89d817e..3d3e0ef 100644 --- a/src/entities/contactmoment/contactmoment.types.ts +++ b/src/entities/contactmoment/contactmoment.types.ts @@ -8,4 +8,5 @@ export type TContactMoment = { product: string; startDate: string; status: string; + contactmoment: string; } diff --git a/src/modals/contactMomenten/ContactMomentenForm.vue b/src/modals/contactMomenten/ContactMomentenForm.vue index 6b8d393..7a080a6 100644 --- a/src/modals/contactMomenten/ContactMomentenForm.vue +++ b/src/modals/contactMomenten/ContactMomentenForm.vue @@ -783,27 +783,16 @@ export default { const contactMomentCopy = _.cloneDeep(this.contactMoment) - delete contactMomentCopy.taken - delete contactMomentCopy.zaken - delete contactMomentCopy.berichten - delete contactMomentCopy.klantContactmomenten - delete contactMomentCopy.auditTrails - delete contactMomentCopy.addedTaken - delete contactMomentCopy.selectedKlantContactMoment - delete contactMomentCopy.selectedProduct - delete contactMomentCopy.selectedTaak - delete contactMomentCopy.selectedZaak - contactMomentStore.saveContactMoment({ - ...contactMomentCopy, + id: contactMomentCopy.id, notitie: contactMomentCopy.notitie, klant: contactMomentCopy.klant?.id ?? '', zaak: contactMomentCopy.selectedZaak ?? '', taak: contactMomentCopy.selectedTaak ?? '', product: contactMomentCopy.selectedProduct ?? '', - contactmoment: contactMomentCopy.selectedKlantContactMoment, - status: contactMomentCopy.status === 'gesloten' ? 'gesloten' : 'open', startDate: contactMomentCopy.startDate ?? new Date().toISOString(), + status: contactMomentCopy.status === 'gesloten' ? 'gesloten' : 'open', + contactmoment: contactMomentCopy.selectedKlantContactMoment, }) .then((response) => { this.contactMoment.addedTaken.forEach(taak => { @@ -843,25 +832,18 @@ export default { this.success = true this.loading = false - if (!this.dashboardWidget) { + setTimeout(() => { + this.closeTab(this.selectedContactMoment) + this.success = false + this.succesMessage = false + }, 2000) + if (this.tabs.length === 1) { + if (this.dashboardWidget) this.$emit('save-success') setTimeout(() => { this.closeModal() }, 2000) } - if (this.dashboardWidget === true) { - setTimeout(() => { - this.closeTab(this.selectedContactMoment) - this.success = false - this.succesMessage = false - }, 2000) - if (this.tabs.length === 1) { - this.$emit('save-success') - setTimeout(() => { - this.closeModal() - }, 2000) - } - } }) .catch((err) => { console.error(err) diff --git a/src/modals/taken/EditTaak.vue b/src/modals/taken/EditTaak.vue index a6dcf91..e2c8289 100644 --- a/src/modals/taken/EditTaak.vue +++ b/src/modals/taken/EditTaak.vue @@ -1,5 +1,5 @@