diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue index 5798e7512..9bdb0ad5b 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue @@ -28,16 +28,26 @@ const newObservation = ref(null); const onSubmit = async () => { try { - const data = $props.clients.map((item) => { - return { clientFk: item.clientFk, text: newObservation.value }; - }); - await axios.post('ClientObservations', data); + const observationTypeFk = ( + await axios.get('ObservationTypes/findOne', { + params: { filter: { where: { description: 'Finance' } } }, + }) + ).data?.id; - const payload = { + const bodyObs = $props.clients.map((item) => { + return { + clientFk: item.clientFk, + text: newObservation.value, + observationTypeFk, + }; + }); + await axios.post('ClientObservations', bodyObs); + + const bodyObsMail = { defaulters: $props.clients, observation: newObservation.value, }; - await axios.post('Defaulters/observationEmail', payload); + await axios.post('Defaulters/observationEmail', bodyObsMail); await $props.promise();