5000-invoiceOut.global-invoicing #1322

Merged
carlosap merged 62 commits from 5000-invoiceOut.global-invoicing into dev 2023-03-14 10:00:40 +00:00
5 changed files with 49 additions and 27 deletions
Showing only changes of commit 3801436dc0 - Show all commits

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,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);
});
});
}

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
Review

Esta traducció es rara, es gasta sola en algun lloc¿?

Esta traducció es rara, es gasta sola en algun lloc¿?

View File

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