feat: mostrar fallos, mostrar más datos y actualizar estilo
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-12-29 08:15:04 +01:00
parent 4579758ba6
commit 3801436dc0
5 changed files with 49 additions and 27 deletions

View File

@ -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) {

View File

@ -3,15 +3,17 @@
<vn-table ng-if="data.length">
<vn-thead>
<vn-tr>
<vn-th field="id">Id</vn-th>
<vn-th field="id">Address</vn-th>
<vn-th field="name">Status</vn-th>
<vn-th field="clientId" number>Client id</vn-th>
<vn-th field="nickname">Nickname</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-thead>
<vn-tbody>
<vn-tr
ng-repeat="client in data">
<vn-td>
<vn-td number>
<span
vn-click-stop="clientDescriptor.show($event, client.id)"
class="link">
@ -19,9 +21,15 @@
</span>
</vn-td>
<vn-td>
{{::client.address}}
{{::client.address.nickname}}
</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
ng-if="client.status == 'waiting'"
enable="true">
@ -31,9 +39,9 @@
icon="check">
</vn-icon>
<vn-icon
class="error"
vn-tooltip={{::client.error}}
ng-if="client.status == 'error'"
icon="error">
icon="clear">
</vn-icon>
</vn-td>
</vn-tr>

View File

@ -61,23 +61,31 @@ class Controller extends Section {
};
this.$http.get(`Addresses/${clientAndAddress.addressId}`)
.then(res => {
this.address = res.data;
this.$.data.push({
id: clientAndAddress.clientId,
address: clientAndAddress.addressId,
address: this.address,
status: 'waiting'
});
const index = this.$.data.findIndex(
client => client.id == clientAndAddress.clientId && client.address == clientAndAddress.addressId
client => client.id == clientAndAddress.clientId && client.address.id == clientAndAddress.addressId
);
return this.$http.post(`InvoiceOuts/invoiceClient`, params)
.then(() => {
this.$.data[index].status = 'ok';
}).catch(() => {
}).catch(res => {
this.$.data[index].status = 'error';
this.$.data[index].error = res.data.error.message;
}).finally(() => {
clientsAndAddresses.shift();
return this.invoiceOut(invoice, clientsAndAddresses);
});
});
}
makeInvoice() {

View File

@ -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

View File

@ -1,5 +1,10 @@
@import "variables";
.error {
vn-td {
vn-icon[icon=clear] {
color: $color-alert;
}
vn-icon[icon=check] {
color: $color-success;
}
}