From 676b5198a88d8eee7087284ad9bc4d76083c23bf Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 13 Dec 2019 08:01:13 +0100 Subject: [PATCH] changed discount popover width + refresh discount --- loopback/locale/en.json | 3 +- loopback/locale/es.json | 3 +- modules/claim/front/detail/index.html | 54 +++++++++-------- modules/claim/front/detail/index.js | 17 ++++-- modules/claim/front/detail/index.spec.js | 11 +++- modules/claim/front/detail/locale/es.yml | 3 +- modules/claim/front/detail/style.scss | 60 +++++++------------ .../client/front/billing-data/locale/es.yml | 1 - 8 files changed, 73 insertions(+), 79 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 14b95eef8..91339d14e 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -56,5 +56,6 @@ "Value has an invalid format": "Value has an invalid format", "The postcode doesn't exists. Ensure you put the correct format": "The postcode doesn't exists. Ensure you put the correct format", "Can't create stowaway for this ticket": "Can't create stowaway for this ticket", - "Has deleted the ticket id": "Has deleted the ticket id [#{{id}}]({{{url}}})" + "Has deleted the ticket id": "Has deleted the ticket id [#{{id}}]({{{url}}})", + "Swift / BIC can't be empty": "Swift / BIC can't be empty" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 70293a965..5529af264 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -117,5 +117,6 @@ "You should specify a date": "Debes especificar una fecha", "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fín", "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fín", - "You should mark at least one week day": "Debes marcar al menos un día de la semana" + "You should mark at least one week day": "Debes marcar al menos un día de la semana", + "Swift / BIC can't be empty": "El Swift / BIC no puede quedar vacío" } \ No newline at end of file diff --git a/modules/claim/front/detail/index.html b/modules/claim/front/detail/index.html index 900d17560..7551be257 100644 --- a/modules/claim/front/detail/index.html +++ b/modules/claim/front/detail/index.html @@ -57,11 +57,11 @@ - {{::saleClaimed.sale.discount}} % + {{saleClaimed.sale.discount}} % - {{::$ctrl.getSaleTotal(saleClaimed.sale) | currency: 'EUR':2}} + {{$ctrl.getSaleTotal(saleClaimed.sale) | currency: 'EUR':2}} - - -
- -
MANÁ: {{$ctrl.mana | currency: 'EUR':0}}
-
-
- - -
-

New price

-

{{$ctrl.newPrice | currency: 'EUR':2}} -

+
+ + +
+ +
MANÁ: {{$ctrl.mana | currency: 'EUR':0}}
+
+
+ + +
+

Total claimed price

+

{{$ctrl.newPrice | currency: 'EUR':2}} +

+
diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js index 6589354ae..f66a296c8 100644 --- a/modules/claim/front/detail/index.js +++ b/modules/claim/front/detail/index.js @@ -128,25 +128,30 @@ class Controller { this.$.editPopover.show(); } - getManaSalespersonMana() { + getSalespersonMana() { this.$http.get(`Tickets/${this.claim.ticketFk}/getSalesPersonMana`).then(res => { this.mana = res.data; }); } updateDiscount() { - if (this.newDiscount != this.saleClaimed.sale.discount) { - const params = {salesIds: [this.saleClaimed.sale.id], newDiscount: this.newDiscount}; - const query = `Tickets/${this.saleClaimed.sale.ticketFk}/updateDiscount`; + const claimedSale = this.saleClaimed.sale; + if (this.newDiscount != claimedSale.discount) { + const params = {salesIds: [claimedSale.id], newDiscount: this.newDiscount}; + const query = `Tickets/${claimedSale.ticketFk}/updateDiscount`; this.$http.post(query, params).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + claimedSale.discount = this.newDiscount; + this.calculateTotals(); this.clearDiscount(); - this.$.model.refresh(); + + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); }).catch(err => { this.vnApp.showError(err.message); }); } + + this.$.editPopover.hide(); } updateNewPrice() { diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index a8843df38..24491075d 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -29,6 +29,9 @@ describe('claim', () => { hide: () => {}, show: () => {} }; + controller.$.editPopover = { + hide: () => {} + }; })); describe('openAddSalesDialog()', () => { @@ -110,16 +113,18 @@ describe('claim', () => { spyOn(controller.vnApp, 'showSuccess'); + spyOn(controller, 'calculateTotals'); spyOn(controller, 'clearDiscount'); - spyOn(controller.$.model, 'refresh'); + spyOn(controller.$.editPopover, 'hide'); $httpBackend.when('POST', 'Tickets/1/updateDiscount').respond({}); controller.updateDiscount(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.calculateTotals).toHaveBeenCalledWith(); expect(controller.clearDiscount).toHaveBeenCalledWith(); - expect(controller.$.model.refresh).toHaveBeenCalledWith(); + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.$.editPopover.hide).toHaveBeenCalledWith(); }); }); diff --git a/modules/claim/front/detail/locale/es.yml b/modules/claim/front/detail/locale/es.yml index ae648d51d..9bbfd7e86 100644 --- a/modules/claim/front/detail/locale/es.yml +++ b/modules/claim/front/detail/locale/es.yml @@ -6,4 +6,5 @@ Price: Precio Claimable sales from ticket: Lineas reclamables del ticket Detail: Detalles Add sale item: Añadir artículo -Insuficient permisos: Permisos insuficientes \ No newline at end of file +Insuficient permisos: Permisos insuficientes +Total claimed price: Precio total reclamado \ No newline at end of file diff --git a/modules/claim/front/detail/style.scss b/modules/claim/front/detail/style.scss index 2b5727d48..6229e56fb 100644 --- a/modules/claim/front/detail/style.scss +++ b/modules/claim/front/detail/style.scss @@ -1,47 +1,27 @@ @import "variables"; -vn-claim-detail { - .vn-textfield { - margin: 0!important; - max-width: 100px; - } - vn-dialog[vn-id=addSales] { - tpl-body { - width: 950px; - div { - div.buttons { - display: none; - } - vn-table{ - min-width: 950px; - } - } - } - } - vn-popover.edit { - div.popover { - width: 200px; - } - vn-horizontal.header { - background-color: $color-main; - color: $color-font-dark; +.vn-popover .discount-popover { + width: 16em; - h5 { - color: inherit; - margin: 0 auto; - } - } - p.simulatorTitle { - margin-bottom: 0px; - font-size: 12px; - color: $color-main; - } - vn-label-value { - padding-bottom: 20px; - } - div.simulator{ - text-align: center; + .header { + background-color: $color-main; + color: $color-font-dark; + + h5 { + color: inherit; + margin: 0 auto; } } + .simulatorTitle { + margin-bottom: 0px; + font-size: 12px; + color: $color-main; + } + vn-label-value { + padding-bottom: 20px; + } + .simulator{ + text-align: center; + } } diff --git a/modules/client/front/billing-data/locale/es.yml b/modules/client/front/billing-data/locale/es.yml index 15373914e..a7ecbbdae 100644 --- a/modules/client/front/billing-data/locale/es.yml +++ b/modules/client/front/billing-data/locale/es.yml @@ -15,5 +15,4 @@ Received B2B VNL: Recibido B2B VNL Save: Guardar New bank entity: Nueva entidad bancaria Name can't be empty: El nombre no puede quedar vacío -Swift / BIC can't be empty: El Swift / BIC no puede quedar vacío Entity Code: Código \ No newline at end of file