Hotfix[CustomerAddress]: Fixed buttons disabled when there are no changes #1641

Merged
jon merged 8 commits from Hotfix-CustomerAddress into master 2025-04-01 06:08:12 +00:00
1 changed files with 17 additions and 1 deletions

View File

@ -93,10 +93,26 @@ const updateAddressTicket = async () => {
};
const updateObservations = async (payload) => {
await axios.post('AddressObservations/crud', payload);
await axios.post('AddressObservations/crud', cleanPayload(payload));
notes.value = [];
jon marked this conversation as resolved
Review

Deberia ser:
await axios.post('AddressObservations/crud', cleanPayload(payload));

Deberia ser: `await axios.post('AddressObservations/crud', cleanPayload(payload));`
deletes.value = [];
};
function cleanPayload(payload) {
['creates', 'deletes', 'updates'].forEach((prop) => {
if (prop === 'creates' || prop === 'updates') {
payload[prop] = payload[prop].filter(
(item) => item.description !== '' && item.observationTypeFk !== '',
);
} else {
payload[prop] = payload[prop].filter(
(item) => item !== null && item !== undefined,
);
}
});
return payload;
}
async function updateAll({ data, payload }) {
await updateObservations(payload);
await updateAddress(data);