From 5918b3e0dfc3bc3c7868664fb71090366ba8820a Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 14 Oct 2022 09:30:09 +0200 Subject: [PATCH] refactor: juan changes --- .../invoiceOut/front/index/global-invoicing/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/invoiceOut/front/index/global-invoicing/index.js b/modules/invoiceOut/front/index/global-invoicing/index.js index a74cf7610..2dc4de3cb 100644 --- a/modules/invoiceOut/front/index/global-invoicing/index.js +++ b/modules/invoiceOut/front/index/global-invoicing/index.js @@ -62,6 +62,7 @@ class Controller extends Dialog { this.vnApp.showSuccess(this.$t('Data saved!')); }); + this.$.invoiceButton.disabled = true; return this.$http.post(`InvoiceOuts/clientToInvoice`, this.invoice) .then(async res => { const clientsAndAddresses = res.data.clientsAndAddresses; @@ -69,7 +70,6 @@ class Controller extends Dialog { if (!clientsAndAddresses.length) return super.responseHandler(response); this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId; - this.$.invoiceButton.setAttribute('disabled', true); for (let clientAndAddress of clientsAndAddresses) { this.currentClientId = clientAndAddress.clientId; const params = { @@ -93,13 +93,14 @@ class Controller extends Dialog { .then(() => super.responseHandler(response)) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) .finally(() => { - this.lastClientId = null; - this.$.invoiceButton.removeAttribute('disabled'); + this.lastClientId = null; // unificar en una función + this.$.invoiceButton.disabled = false; // unificar en una función }); } catch (e) { this.vnApp.showError(this.$t(e.message)); - this.lastClientId = null; - this.$.invoiceButton.removeAttribute('disabled'); + this.lastClientId = null; // unificar en una función + this.$.invoiceButton.disabled = false; // unificar en una función + throw e; return false; } }