From 3801436dc0d60f4427476514817832ed03e5e4ef Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 29 Dec 2022 08:15:04 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20mostrar=20fallos,=20mostrar=20m=C3=A1s?= =?UTF-8?q?=20datos=20y=20actualizar=20estilo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../back/methods/invoiceOut/invoiceClient.js | 2 +- .../front/global-invoicing/index.html | 24 +++++++---- .../front/global-invoicing/index.js | 40 +++++++++++-------- .../front/global-invoicing/locale/es.yml | 1 + .../front/global-invoicing/style.scss | 9 ++++- 5 files changed, 49 insertions(+), 27 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js index 53e1023ba..d7674cdd8 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js @@ -106,7 +106,7 @@ module.exports = Self => { args.invoiceDate ], myOptions); if (client.id == 1101 && args.addressId == 121) - throw new Error('Error1'); + throw new Error('No se ha podido facturar'); const [newInvoice] = await Self.rawSql(`SELECT @invoiceId id`, null, myOptions); if (newInvoice.id) { diff --git a/modules/invoiceOut/front/global-invoicing/index.html b/modules/invoiceOut/front/global-invoicing/index.html index cb720d674..a59475297 100644 --- a/modules/invoiceOut/front/global-invoicing/index.html +++ b/modules/invoiceOut/front/global-invoicing/index.html @@ -3,15 +3,17 @@ - Id - Address - Status + Client id + Nickname + Address id + Street + - + @@ -19,9 +21,15 @@ - {{::client.address}} + {{::client.address.nickname}} - + + {{::client.address.id}} + + + {{::client.address.street}} + + @@ -31,9 +39,9 @@ icon="check"> + icon="clear"> diff --git a/modules/invoiceOut/front/global-invoicing/index.js b/modules/invoiceOut/front/global-invoicing/index.js index 07d76626d..89487d440 100644 --- a/modules/invoiceOut/front/global-invoicing/index.js +++ b/modules/invoiceOut/front/global-invoicing/index.js @@ -61,22 +61,30 @@ class Controller extends Section { }; - this.$.data.push({ - id: clientAndAddress.clientId, - address: clientAndAddress.addressId, - status: 'waiting' - }); - const index = this.$.data.findIndex( - client => client.id == clientAndAddress.clientId && client.address == clientAndAddress.addressId - ); - return this.$http.post(`InvoiceOuts/invoiceClient`, params) - .then(() => { - this.$.data[index].status = 'ok'; - }).catch(() => { - this.$.data[index].status = 'error'; - }).finally(() => { - clientsAndAddresses.shift(); - return this.invoiceOut(invoice, clientsAndAddresses); + this.$http.get(`Addresses/${clientAndAddress.addressId}`) + .then(res => { + this.address = res.data; + + this.$.data.push({ + id: clientAndAddress.clientId, + address: this.address, + status: 'waiting' + }); + + const index = this.$.data.findIndex( + client => client.id == clientAndAddress.clientId && client.address.id == clientAndAddress.addressId + ); + + return this.$http.post(`InvoiceOuts/invoiceClient`, params) + .then(() => { + this.$.data[index].status = 'ok'; + }).catch(res => { + this.$.data[index].status = 'error'; + this.$.data[index].error = res.data.error.message; + }).finally(() => { + clientsAndAddresses.shift(); + return this.invoiceOut(invoice, clientsAndAddresses); + }); }); } diff --git a/modules/invoiceOut/front/global-invoicing/locale/es.yml b/modules/invoiceOut/front/global-invoicing/locale/es.yml index 72826134d..84cfe43ad 100644 --- a/modules/invoiceOut/front/global-invoicing/locale/es.yml +++ b/modules/invoiceOut/front/global-invoicing/locale/es.yml @@ -9,3 +9,4 @@ Calculating packages to invoice...: Calculando paquetes a factura... Clean: Limpiar From client: Desde cliente To client: Hasta cliente +Address id: Id dirección diff --git a/modules/invoiceOut/front/global-invoicing/style.scss b/modules/invoiceOut/front/global-invoicing/style.scss index 41dd3fac2..d67df4479 100644 --- a/modules/invoiceOut/front/global-invoicing/style.scss +++ b/modules/invoiceOut/front/global-invoicing/style.scss @@ -1,5 +1,10 @@ @import "variables"; -.error { - color: $color-alert; +vn-td { + vn-icon[icon=clear] { + color: $color-alert; } + vn-icon[icon=check] { + color: $color-success; + } +}