5000-invoiceOut.global-invoicing #1322
|
@ -106,7 +106,7 @@ module.exports = Self => {
|
||||||
args.invoiceDate
|
args.invoiceDate
|
||||||
], myOptions);
|
], myOptions);
|
||||||
if (client.id == 1101 && args.addressId == 121)
|
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);
|
const [newInvoice] = await Self.rawSql(`SELECT @invoiceId id`, null, myOptions);
|
||||||
if (newInvoice.id) {
|
if (newInvoice.id) {
|
||||||
|
|
|
@ -3,15 +3,17 @@
|
||||||
<vn-table ng-if="data.length">
|
<vn-table ng-if="data.length">
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th field="id">Id</vn-th>
|
<vn-th field="clientId" number>Client id</vn-th>
|
||||||
<vn-th field="id">Address</vn-th>
|
<vn-th field="nickname">Nickname</vn-th>
|
||||||
<vn-th field="name">Status</vn-th>
|
<vn-th field="addressId" number>Address id</vn-th>
|
||||||
|
<vn-th field="street" expand>Street</vn-th>
|
||||||
|
<vn-th shrink></vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr
|
<vn-tr
|
||||||
ng-repeat="client in data">
|
ng-repeat="client in data">
|
||||||
<vn-td>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
vn-click-stop="clientDescriptor.show($event, client.id)"
|
vn-click-stop="clientDescriptor.show($event, client.id)"
|
||||||
class="link">
|
class="link">
|
||||||
|
@ -19,9 +21,15 @@
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
{{::client.address}}
|
{{::client.address.nickname}}
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td number>
|
||||||
|
{{::client.address.id}}
|
||||||
|
</vn-td>
|
||||||
|
<vn-td expand>
|
||||||
|
{{::client.address.street}}
|
||||||
|
</vn-td>
|
||||||
|
<vn-td shrink>
|
||||||
<vn-spinner
|
<vn-spinner
|
||||||
ng-if="client.status == 'waiting'"
|
ng-if="client.status == 'waiting'"
|
||||||
enable="true">
|
enable="true">
|
||||||
|
@ -31,9 +39,9 @@
|
||||||
icon="check">
|
icon="check">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
class="error"
|
vn-tooltip={{::client.error}}
|
||||||
ng-if="client.status == 'error'"
|
ng-if="client.status == 'error'"
|
||||||
icon="error">
|
icon="clear">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
|
|
@ -61,22 +61,30 @@ class Controller extends Section {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$.data.push({
|
this.$http.get(`Addresses/${clientAndAddress.addressId}`)
|
||||||
id: clientAndAddress.clientId,
|
.then(res => {
|
||||||
address: clientAndAddress.addressId,
|
this.address = res.data;
|
||||||
status: 'waiting'
|
|
||||||
});
|
this.$.data.push({
|
||||||
const index = this.$.data.findIndex(
|
id: clientAndAddress.clientId,
|
||||||
client => client.id == clientAndAddress.clientId && client.address == clientAndAddress.addressId
|
address: this.address,
|
||||||
);
|
status: 'waiting'
|
||||||
return this.$http.post(`InvoiceOuts/invoiceClient`, params)
|
});
|
||||||
.then(() => {
|
|
||||||
this.$.data[index].status = 'ok';
|
const index = this.$.data.findIndex(
|
||||||
}).catch(() => {
|
client => client.id == clientAndAddress.clientId && client.address.id == clientAndAddress.addressId
|
||||||
this.$.data[index].status = 'error';
|
);
|
||||||
}).finally(() => {
|
|
||||||
clientsAndAddresses.shift();
|
return this.$http.post(`InvoiceOuts/invoiceClient`, params)
|
||||||
return this.invoiceOut(invoice, clientsAndAddresses);
|
.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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,4 @@ Calculating packages to invoice...: Calculando paquetes a factura...
|
||||||
Clean: Limpiar
|
Clean: Limpiar
|
||||||
From client: Desde cliente
|
From client: Desde cliente
|
||||||
To client: Hasta cliente
|
To client: Hasta cliente
|
||||||
|
Address id: Id dirección
|
||||||
|
|||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
.error {
|
vn-td {
|
||||||
color: $color-alert;
|
vn-icon[icon=clear] {
|
||||||
|
color: $color-alert;
|
||||||
}
|
}
|
||||||
|
vn-icon[icon=check] {
|
||||||
|
color: $color-success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Esta traducció es rara, es gasta sola en algun lloc¿?