feat: añadido contador y porcetaje
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-01-24 09:45:52 +01:00
parent 1154179ddf
commit facaee6f95
4 changed files with 35 additions and 6 deletions

View File

@ -64,6 +64,18 @@
order="code">
</vn-crud-model>
<form class="vn-pa-md">
<vn-vertical text-center
class="progress vn-my-sm"
ng-if="$ctrl.lastClientId">
<h5 class="vn-mb-md vn-mt-lg" translate>Invoicing</h5>
<div>
{{'Id Client' | translate}}: {{$ctrl.currentClientId}}
{{'of' | translate}} {{::$ctrl.lastClientId}}
</div>
<div>
{{($ctrl.percentage / 100) | percentage: 0}}
</div>
</vn-vertical>
<vn-vertical>
<vn-date-picker
vn-one

View File

@ -11,6 +11,7 @@ class Controller extends Section {
companyFk: this.vnConfig.companyFk
};
this.clientsNumber = 'allClients';
this.currentClient = 0;
}
$onInit() {
@ -39,19 +40,22 @@ class Controller extends Section {
return this.$http.get('Clients/findOne', {params});
}
restartValues() {
this.$.invoiceButton.disabled = false;
this.packageInvoicing = false;
getPercentage() {
this.percentage = (this.currentClient * 100) / this.clients.length;
}
cancelRequest() {
this.canceler = this.$q.defer();
return {timeout: this.canceler.promise};
restartValues() {
this.lastClientId = null;
this.$.invoiceButton.disabled = false;
this.packageInvoicing = false;
}
invoiceOut(invoice, clientsAndAddresses) {
const [clientAndAddress] = clientsAndAddresses;
if (!clientAndAddress) return;
this.currentClientId = clientAndAddress.clientId;
this.currentClient = ++this.currentClient;
this.getPercentage();
const params = {
clientId: clientAndAddress.clientId,
addressId: clientAndAddress.addressId,
@ -115,6 +119,12 @@ class Controller extends Section {
const invoice = res.data.invoice;
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.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId;
return this.invoiceOut(invoice, clientsAndAddresses);
})
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))

View File

@ -13,3 +13,6 @@ From client: Desde cliente
To client: Hasta cliente
Address id: Id dirección
Printer: Impresora
of: de
Id Client: Id Cliente
Invoicing: Facturando

View File

@ -8,3 +8,7 @@ vn-td {
color: $color-success;
}
}
h5{
color: $color-primary;
}