Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2844-item_lastEntries_sum

This commit is contained in:
Carlos Jimenez Ruiz 2021-03-26 10:33:58 +01:00
commit f46c18b6b0
9 changed files with 39 additions and 89 deletions

View File

@ -376,7 +376,8 @@ describe('Ticket Edit sale path', () => {
expect(result).toBeFalsy();
});
it('should update all sales discount', async() => {
// tickets no longer update their totals instantly, a task performed ever 5-10 mins does it. disabled this test until it changes.
xit('should update all sales discount', async() => {
await page.closePopup();
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);

View File

@ -167,8 +167,8 @@
"Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
"Sorts whole route": "Reordena ruta entera",
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>",
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
"Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
"This BIC already exist.": "Este BIC ya existe.",
"That item doesn't exists": "Ese artículo no existe",

View File

@ -43,9 +43,9 @@
</vn-button>
</vn-tool-bar>
<vn-one class="taxes" ng-if="$ctrl.sales.length > 0">
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR': 2}}</p>
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR': 2}}</p>
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.total | currency: 'EUR': 2}}</strong></p>
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}</p>
<p><vn-label translate>VAT</vn-label> {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}</p>
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}</strong></p>
</vn-one>
</vn-horizontal>
<vn-table model="model">

View File

@ -24,7 +24,6 @@ class Controller extends Section {
set sales(value) {
this._sales = value;
this.refreshTotal();
}
get ticketState() {
@ -33,17 +32,6 @@ class Controller extends Section {
return this.ticket.ticketState.state.code;
}
get total() {
return this.subtotal + this.VAT;
}
getSubTotal() {
if (!this.$params.id || !this.sales) return;
this.$http.get(`Tickets/${this.$params.id}`).then(res => {
this.subtotal = res.data.totalWithoutVat || 0.0;
});
}
getSaleTotal(sale) {
if (sale.quantity == null || sale.price == null)
return null;
@ -59,19 +47,6 @@ class Controller extends Section {
.then(res => this.edit.mana = res.data);
}
getVat() {
this.VAT = 0.0;
if (!this.$params.id || !this.sales) return;
this.$http.get(`Tickets/${this.$params.id}`).then(res => {
this.VAT = res.data.totalWithVat - res.data.totalWithoutVat || 0.0;
});
}
refreshTotal() {
this.getSubTotal();
this.getVat();
}
/**
* Returns checked instances
*
@ -158,8 +133,6 @@ class Controller extends Section {
const index = this.sales.indexOf(sale);
this.sales.splice(index, 1);
});
this.refreshTotal();
}
createClaim() {
@ -221,7 +194,6 @@ class Controller extends Section {
this.$http.post(query, {newPrice}).then(res => {
sale.price = res.data.price;
this.edit = null;
this.refreshTotal();
this.vnApp.showSuccess(this.$t('Data saved!'));
}).finally(() => this.resetChanges());
}
@ -287,7 +259,6 @@ class Controller extends Section {
sale.discount = this.edit.discount;
this.edit = null;
this.refreshTotal();
}).finally(() => this.resetChanges());
}
@ -401,7 +372,6 @@ class Controller extends Section {
updateQuantity(sale) {
const data = {quantity: sale.quantity};
this.$http.post(`Sales/${sale.id}/updateQuantity`, data).then(() => {
this.refreshTotal();
this.vnApp.showSuccess(this.$t('Data saved!'));
}).catch(e => {
this.$.model.refresh();
@ -444,7 +414,6 @@ class Controller extends Section {
sale.price = newSale.price;
sale.item = newSale.item;
this.refreshTotal();
this.vnApp.showSuccess(this.$t('Data saved!'));
}).finally(() => this.resetChanges());
}
@ -466,7 +435,6 @@ class Controller extends Section {
this.$http.post(query).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.refresh();
this.refreshTotal();
});
}

View File

@ -72,28 +72,6 @@ describe('Ticket', () => {
});
});
describe('sales() setter', () => {
it('should set the sales data an then call the refreshTotal() method', () => {
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
controller.sales = [{id: 1}];
expect(controller.refreshTotal).toHaveBeenCalledWith();
});
});
describe('getSubTotal()', () => {
it('should make an HTTP GET query and then set the subtotal property', () => {
const expectedResponse = {totalWithoutVat: 128};
$httpBackend.expect('GET', 'Tickets/1').respond(200, expectedResponse);
controller.getSubTotal();
$httpBackend.flush();
expect(controller.subtotal).toEqual(expectedResponse.totalWithoutVat);
});
});
describe('getSaleTotal()', () => {
it('should return the sale total amount', () => {
const sale = {
@ -122,21 +100,6 @@ describe('Ticket', () => {
});
});
describe('getVat()', () => {
it('should make an HTTP GET query and return the ticket VAT', () => {
controller.edit = {};
const expectedResponse = {totalWithVat: 1000, totalWithoutVat: 999};
const expectedVAT = expectedResponse.totalWithVat - expectedResponse.totalWithoutVat;
$httpBackend.expect('GET', 'Tickets/1').respond(200, expectedResponse);
controller.getVat();
$httpBackend.flush();
expect(controller.VAT).toEqual(expectedVAT);
});
});
describe('selectedSales()', () => {
it('should return a list of selected sales', () => {
controller.sales[1].checked = true;
@ -276,7 +239,6 @@ describe('Ticket', () => {
describe('removeSelectedSales()', () => {
it('should remove the selected sales from the controller sale property', () => {
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
jest.spyOn(controller, 'resetChanges').mockReturnThis();
const firstSale = controller.sales[0];
@ -288,7 +250,6 @@ describe('Ticket', () => {
expect(controller.sales.length).toEqual(1);
expect(lastSale.id).toEqual(4);
expect(controller.refreshTotal).toHaveBeenCalledWith();
});
});
@ -355,7 +316,6 @@ describe('Ticket', () => {
describe('updatePrice()', () => {
it('should make an HTTP POST query, update the sale price and then call to the resetChanges() method', () => {
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis();
jest.spyOn(controller, 'resetChanges').mockReturnThis();
@ -372,7 +332,6 @@ describe('Ticket', () => {
$httpBackend.flush();
expect(selectedSale.price).toEqual(2);
expect(controller.refreshTotal).toHaveBeenCalledWith();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
expect(controller.$.editPricePopover.hide).toHaveBeenCalledWith();
expect(controller.resetChanges).toHaveBeenCalledWith();
@ -451,7 +410,6 @@ describe('Ticket', () => {
it('should make an HTTP POST query, update the sales discount and then call to the resetChanges() method', () => {
jest.spyOn(controller, 'resetChanges').mockReturnThis();
jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis();
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
const expectedDiscount = 10;
const firstSelectedSale = controller.sales[0];
@ -473,7 +431,6 @@ describe('Ticket', () => {
expect(firstSelectedSale.discount).toEqual(expectedDiscount);
expect(secondSelectedSale.discount).toEqual(expectedDiscount);
expect(controller.refreshTotal).toHaveBeenCalledWith();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
expect(controller.resetChanges).toHaveBeenCalledWith();
});
@ -622,7 +579,6 @@ describe('Ticket', () => {
describe('updateQuantity()', () => {
it('should make a POST query saving sale quantity', () => {
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
jest.spyOn(controller, 'resetChanges').mockReturnThis();
const selectedSale = controller.sales[0];
@ -634,7 +590,6 @@ describe('Ticket', () => {
controller.updateQuantity(selectedSale);
$httpBackend.flush();
expect(controller.refreshTotal).toHaveBeenCalledWith();
expect(controller.resetChanges).toHaveBeenCalledWith();
});
});
@ -659,7 +614,6 @@ describe('Ticket', () => {
describe('addSale()', () => {
it('should make a POST query adding a new sale', () => {
jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis();
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
jest.spyOn(controller, 'resetChanges').mockReturnThis();
const newSale = {itemFk: 4, quantity: 10};
@ -681,7 +635,6 @@ describe('Ticket', () => {
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
expect(controller.refreshTotal).toHaveBeenCalledWith();
expect(controller.resetChanges).toHaveBeenCalledWith();
});
});
@ -712,7 +665,6 @@ describe('Ticket', () => {
it('should make an HTTP post query ', () => {
jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis();
jest.spyOn(controller.$.model, 'refresh').mockReturnThis();
jest.spyOn(controller, 'refreshTotal').mockReturnThis();
const selectedSale = controller.sales[0];
selectedSale.checked = true;
@ -723,7 +675,6 @@ describe('Ticket', () => {
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
expect(controller.$.model.refresh).toHaveBeenCalledWith();
expect(controller.refreshTotal).toHaveBeenCalledWith();
});
});
});

View File

@ -1,5 +1,5 @@
<div class="vn-mx-xs" v-if="attachment.component">
<a target="_blank" class="vn-py-sm vn-px-md" v-bind:href="path">
<a target="_blank" class="vn-py-sm vn-px-md" v-bind:href="attachmentPath">
<div class="text">{{attachment.filename}}</div>
<div class="icon vn-pl-md">&#x25BC;</div>
</a>

View File

@ -1,7 +1,7 @@
module.exports = {
name: 'attachment',
computed: {
path() {
attachmentPath() {
const filename = this.attachment.filename;
const component = this.attachment.component;
if (this.attachment.cid)

View File

@ -0,0 +1,20 @@
subject: Avis initial de solde débiteur
title: Avis initial de solde débiteur
sections:
introduction:
title: Madame, Monsieur,
description: Sauf erreur ou omission de notre part, nous constatons que votre
compte client présente à ce jour un solde débiteur.
checkExtract: Ce montant correspond à nos factures restées impayées, ci-joint en annexe.
Notre service administratif se fera un plaisir de clarifier toutes les questions que vous
pourriez avoir, et vous fournira également tout document que vous nous demandez.
checkValidData: Si lors de la vérification des données fournies, elles sont correctes et
léchéance étant dépassée, nous vous demandons de bien vouloir régulariser cette situation.
payMethod: Si vous ne souhaitez pas vous rendre personnellement à nos bureaux, vous
pouvez effectuer le paiement par virement bancaire sur le compte qui apparaît en
bas du relevé, en indiquant votre numéro de client, ou vous pouvez effectuer le
paiement en ligne avec une carte bleue sur notre site Internet.
conclusion: Dans le cas où votre règlement aurait été adressé entre temps,
nous vous prions de ne pas tenir compte de la présente.
Nous vous remercions par avance de votre aimable coopération.
transferAccount: Coordonées pour virement bancaire

View File

@ -0,0 +1,10 @@
title: Relevé de compte
claimId: Réclamation
clientId: Client
clientData: Données client
date: Date
concept: Objet
invoiced: Facturé
payed: Payé
balance: Solde
client: Client {0}