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
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
0ba95bd163
commit
67127554f9
|
@ -3,11 +3,10 @@
|
|||
<vn-vertical ng-if="$ctrl.clients.length" text-center class="vn-pa-md">
|
||||
<h5 translate>Invoicing</h5>
|
||||
<div>
|
||||
{{'Client' | translate}}: {{$ctrl.currentClient}}
|
||||
{{'of' | translate}} {{::$ctrl.clients.length}}
|
||||
{{'Current client id' | translate}}: {{$ctrl.currentClientId}}
|
||||
</div>
|
||||
<h6>
|
||||
{{($ctrl.percentage / 100) | percentage: 0}}
|
||||
{{($ctrl.percentage / 100) | percentage: 0}} ({{$ctrl.currentClient}} {{'of' | translate}} {{$ctrl.clients.length}})
|
||||
</h6>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -51,6 +51,7 @@ class Controller extends Section {
|
|||
const [clientAndAddress] = clientsAndAddresses;
|
||||
if (!clientAndAddress) return;
|
||||
|
||||
this.currentClientId = clientAndAddress.clientId;
|
||||
this.currentClient = ++this.currentClient;
|
||||
this.getPercentage();
|
||||
|
||||
|
@ -67,23 +68,14 @@ class Controller extends Section {
|
|||
this.$http.get(`Addresses/${clientAndAddress.addressId}`)
|
||||
.then(res => {
|
||||
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)
|
||||
.then(() => {
|
||||
this.$.data.shift();
|
||||
}).catch(res => {
|
||||
this.$.data[index].status = 'error';
|
||||
this.$.data[index].error = res.data.error.message;
|
||||
.catch(res => {
|
||||
this.$.data.unshift({
|
||||
id: clientAndAddress.clientId,
|
||||
address: this.address,
|
||||
status: 'error',
|
||||
error: res.data.error.message
|
||||
});
|
||||
}).finally(() => {
|
||||
clientsAndAddresses.shift();
|
||||
return this.invoiceOut(invoice, clientsAndAddresses);
|
||||
|
@ -110,13 +102,14 @@ class Controller extends Section {
|
|||
.then(res => {
|
||||
this.packageInvoicing = false;
|
||||
const invoice = res.data.invoice;
|
||||
this.currentClient = 0;
|
||||
|
||||
const clientsAndAddresses = res.data.clientsAndAddresses;
|
||||
if (!clientsAndAddresses.length) throw new UserError(`There aren't clients to invoice`);
|
||||
|
||||
this.clients = [];
|
||||
for (const clientAndAddress of clientsAndAddresses)
|
||||
this.clients.push(clientAndAddress.clientId);
|
||||
this.currentClient = 0;
|
||||
|
||||
return this.invoiceOut(invoice, clientsAndAddresses);
|
||||
})
|
||||
|
|
|
@ -15,5 +15,6 @@ Address id: Id dirección
|
|||
Printer: Impresora
|
||||
of: de
|
||||
Client: Cliente
|
||||
Current client id: Id cliente actual
|
||||
Invoicing: Facturando
|
||||
Invoice out: Facturar
|
||||
|
|
Loading…
Reference in New Issue