From f3387cf120efcd327cd1fd6c5d501884e2909dfa Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 30 Apr 2024 12:39:50 +0200 Subject: [PATCH] fix: refs #6336 fix reload and disable button when is loading --- src/components/ui/VnPaginate.vue | 2 ++ src/pages/Claim/Card/ClaimAction.vue | 25 +++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 4dae312ce..c00849512 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -95,6 +95,8 @@ const addFilter = async (filter, params) => { }; async function fetch() { + store.filter.skip = 0; + store.skip = 0; await arrayData.fetch({ append: false }); if (!store.hasMoreData) { isLoading.value = false; diff --git a/src/pages/Claim/Card/ClaimAction.vue b/src/pages/Claim/Card/ClaimAction.vue index 367b5249c..b0650b610 100644 --- a/src/pages/Claim/Card/ClaimAction.vue +++ b/src/pages/Claim/Card/ClaimAction.vue @@ -37,6 +37,7 @@ const marker_labels = [ { value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') }, ]; const multiplicatorValue = ref(); +const loading = ref(false); const columns = computed(() => [ { @@ -118,7 +119,7 @@ async function updateDestinations(claimDestinationFk) { async function updateDestination(claimDestinationFk, row, options = {}) { if (claimDestinationFk) { - await axios.post('Claims/updateClaimDestination', { + await post('Claims/updateClaimDestination', { claimDestinationFk, rows: Array.isArray(row) ? row : [row], }); @@ -127,7 +128,7 @@ async function updateDestination(claimDestinationFk, row, options = {}) { } async function regularizeClaim() { - await axios.post(`Claims/${claimId}/regularizeClaim`); + await post(`Claims/${claimId}/regularizeClaim`); await claimRef.value.fetch(); await arrayData.fetch({ append: false }); quasar.notify({ @@ -146,7 +147,7 @@ async function onUpdateGreugeAccept() { const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data.freightPickUpPrice * multiplicatorValue.value; - await axios.post(`Greuges`, { + await post(`Greuges`, { clientFk: claim.value.clientFk, description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(), amount: freightPickUpPrice, @@ -165,14 +166,22 @@ async function save(data) { } async function importToNewRefundTicket() { - const query = `ClaimBeginnings/${claimId}/importToNewRefundTicket`; - await axios.post(query); - claimActionsForm.value.reload(); + await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`); + await claimActionsForm.value.reload(); quasar.notify({ message: t('globals.dataSaved'), type: 'positive', }); } + +async function post(query, params) { + loading.value = true; + try { + await axios.post(query, params); + } finally { + loading.value = false; + } +}