forked from verdnatura/salix-front
chore: refs #7874 add default ob type
This commit is contained in:
parent
830decb6db
commit
44c4c378f9
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue