feat: solo muestra los clientes con error y muestra los datos de manera distinta
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-01-26 13:12:53 +01:00
parent 0ba95bd163
commit 67127554f9
3 changed files with 13 additions and 20 deletions

View File

@ -3,11 +3,10 @@
<vn-vertical ng-if="$ctrl.clients.length" text-center class="vn-pa-md"> <vn-vertical ng-if="$ctrl.clients.length" text-center class="vn-pa-md">
<h5 translate>Invoicing</h5> <h5 translate>Invoicing</h5>
<div> <div>
{{'Client' | translate}}: {{$ctrl.currentClient}} {{'Current client id' | translate}}: {{$ctrl.currentClientId}}
{{'of' | translate}} {{::$ctrl.clients.length}}
</div> </div>
<h6> <h6>
{{($ctrl.percentage / 100) | percentage: 0}} {{($ctrl.percentage / 100) | percentage: 0}} ({{$ctrl.currentClient}} {{'of' | translate}} {{$ctrl.clients.length}})
</h6> </h6>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>

View File

@ -51,6 +51,7 @@ class Controller extends Section {
const [clientAndAddress] = clientsAndAddresses; const [clientAndAddress] = clientsAndAddresses;
if (!clientAndAddress) return; if (!clientAndAddress) return;
this.currentClientId = clientAndAddress.clientId;
this.currentClient = ++this.currentClient; this.currentClient = ++this.currentClient;
this.getPercentage(); this.getPercentage();
@ -67,23 +68,14 @@ class Controller extends Section {
this.$http.get(`Addresses/${clientAndAddress.addressId}`) this.$http.get(`Addresses/${clientAndAddress.addressId}`)
.then(res => { .then(res => {
this.address = res.data; this.address = res.data;
this.$.data.unshift({
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) return this.$http.post(`InvoiceOuts/invoiceClient`, params)
.then(() => { .catch(res => {
this.$.data.shift(); this.$.data.unshift({
}).catch(res => { id: clientAndAddress.clientId,
this.$.data[index].status = 'error'; address: this.address,
this.$.data[index].error = res.data.error.message; status: 'error',
error: res.data.error.message
});
}).finally(() => { }).finally(() => {
clientsAndAddresses.shift(); clientsAndAddresses.shift();
return this.invoiceOut(invoice, clientsAndAddresses); return this.invoiceOut(invoice, clientsAndAddresses);
@ -110,13 +102,14 @@ class Controller extends Section {
.then(res => { .then(res => {
this.packageInvoicing = false; this.packageInvoicing = false;
const invoice = res.data.invoice; const invoice = res.data.invoice;
this.currentClient = 0;
const clientsAndAddresses = res.data.clientsAndAddresses; const clientsAndAddresses = res.data.clientsAndAddresses;
if (!clientsAndAddresses.length) throw new UserError(`There aren't clients to invoice`); if (!clientsAndAddresses.length) throw new UserError(`There aren't clients to invoice`);
this.clients = []; this.clients = [];
for (const clientAndAddress of clientsAndAddresses) for (const clientAndAddress of clientsAndAddresses)
this.clients.push(clientAndAddress.clientId); this.clients.push(clientAndAddress.clientId);
this.currentClient = 0;
return this.invoiceOut(invoice, clientsAndAddresses); return this.invoiceOut(invoice, clientsAndAddresses);
}) })

View File

@ -15,5 +15,6 @@ Address id: Id dirección
Printer: Impresora Printer: Impresora
of: de of: de
Client: Cliente Client: Cliente
Current client id: Id cliente actual
Invoicing: Facturando Invoicing: Facturando
Invoice out: Facturar Invoice out: Facturar