refactor: juan changes
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-14 09:30:09 +02:00
parent 50ec41dece
commit 5918b3e0df
1 changed files with 6 additions and 5 deletions

View File

@ -62,6 +62,7 @@ class Controller extends Dialog {
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));
}); });
this.$.invoiceButton.disabled = true;
return this.$http.post(`InvoiceOuts/clientToInvoice`, this.invoice) return this.$http.post(`InvoiceOuts/clientToInvoice`, this.invoice)
.then(async res => { .then(async res => {
const clientsAndAddresses = res.data.clientsAndAddresses; const clientsAndAddresses = res.data.clientsAndAddresses;
@ -69,7 +70,6 @@ class Controller extends Dialog {
if (!clientsAndAddresses.length) return super.responseHandler(response); if (!clientsAndAddresses.length) return super.responseHandler(response);
this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId; this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId;
this.$.invoiceButton.setAttribute('disabled', true);
for (let clientAndAddress of clientsAndAddresses) { for (let clientAndAddress of clientsAndAddresses) {
this.currentClientId = clientAndAddress.clientId; this.currentClientId = clientAndAddress.clientId;
const params = { const params = {
@ -93,13 +93,14 @@ class Controller extends Dialog {
.then(() => super.responseHandler(response)) .then(() => super.responseHandler(response))
.then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) .then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
.finally(() => { .finally(() => {
this.lastClientId = null; this.lastClientId = null; // unificar en una función
this.$.invoiceButton.removeAttribute('disabled'); this.$.invoiceButton.disabled = false; // unificar en una función
}); });
} catch (e) { } catch (e) {
this.vnApp.showError(this.$t(e.message)); this.vnApp.showError(this.$t(e.message));
this.lastClientId = null; this.lastClientId = null; // unificar en una función
this.$.invoiceButton.removeAttribute('disabled'); this.$.invoiceButton.disabled = false; // unificar en una función
throw e;
return false; return false;
} }
} }