0
0
Fork 0

chore: refs #7874 add default ob type

This commit is contained in:
Jorge Penadés 2024-10-10 11:02:03 +02:00
parent 830decb6db
commit 44c4c378f9
1 changed files with 16 additions and 6 deletions

View File

@ -28,16 +28,26 @@ const newObservation = ref(null);
const onSubmit = async () => { const onSubmit = async () => {
try { try {
const data = $props.clients.map((item) => { const observationTypeFk = (
return { clientFk: item.clientFk, text: newObservation.value }; await axios.get('ObservationTypes/findOne', {
}); params: { filter: { where: { description: 'Finance' } } },
await axios.post('ClientObservations', data); })
).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, defaulters: $props.clients,
observation: newObservation.value, observation: newObservation.value,
}; };
await axios.post('Defaulters/observationEmail', payload); await axios.post('Defaulters/observationEmail', bodyObsMail);
await $props.promise(); await $props.promise();