diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index ca4668b3a1..2bb86312de 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -48,6 +48,12 @@ }, "zoneFk": { "type": "Number" + }, + "zonePrice": { + "type": "Number" + }, + "zoneBonus": { + "type": "Number" } }, "relations": { diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 44fc3e48b9..6e38039e29 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -15,6 +15,9 @@ class Controller extends ModuleCard { relation: 'warehouse', scope: {fields: ['name']} }, + { + relation: 'zone', + }, { relation: 'invoiceOut', scope: {fields: ['id']} diff --git a/modules/ticket/front/component/index.html b/modules/ticket/front/component/index.html index fb8af32195..c9b506bc94 100644 --- a/modules/ticket/front/component/index.html +++ b/modules/ticket/front/component/index.html @@ -76,11 +76,35 @@
-
Theorical cost
-
Price {{$ctrl.theoricalCost | currency: 'EUR': 2}}
+
Zone breakdown
+
Zone price {{$ctrl.ticket.zonePrice | currency: 'EUR': 2}}
+
Zone bonus {{$ctrl.ticket.zoneBonus | currency: 'EUR': 2}}
+
Zone + + {{$ctrl.ticket.zone.name | dashIfEmpty}} + +
+
+ Volume {{$ctrl.ticketVolume}} +
+
+ Packages {{$ctrl.ticket.packages}} +
+
+
+
Theorical cost
+
Price total {{$ctrl.theoricalCost | currency: 'EUR': 2}}
- \ No newline at end of file + + + + + diff --git a/modules/ticket/front/component/index.js b/modules/ticket/front/component/index.js index 7557bfba6f..2a5988719b 100644 --- a/modules/ticket/front/component/index.js +++ b/modules/ticket/front/component/index.js @@ -37,9 +37,10 @@ class Controller extends Section { this._ticket = value; if (!value) return; - this.getTheoricalCost(); this.getComponentsSum(); + if (this.ticket.zone.isVolumetric) + this.getTicketVolume(); } base() { @@ -76,6 +77,13 @@ class Controller extends Section { this.$http.get(`Tickets/${this.ticket.id}/getComponentsSum`) .then(res => this.componentsList = res.data); } + + getTicketVolume() { + if (!this.ticket) return; + + this.$http.get(`Tickets/${this.ticket.id}/getVolume`) + .then(res => this.ticketVolume = res.data[0].volume); + } } ngModule.vnComponent('vnTicketComponents', { diff --git a/modules/ticket/front/component/index.spec.js b/modules/ticket/front/component/index.spec.js index 053248c2c9..acd757578d 100644 --- a/modules/ticket/front/component/index.spec.js +++ b/modules/ticket/front/component/index.spec.js @@ -89,7 +89,10 @@ describe('ticket', () => { jest.spyOn(controller, 'getComponentsSum'); controller._ticket = undefined; controller.ticket = { - id: 7 + id: 7, + zone: { + isVolumetric: false + } }; expect(controller.ticket).toBeDefined(); diff --git a/modules/ticket/front/component/locale/es.yml b/modules/ticket/front/component/locale/es.yml index 57dcf64e04..af07811b85 100644 --- a/modules/ticket/front/component/locale/es.yml +++ b/modules/ticket/front/component/locale/es.yml @@ -1,2 +1,6 @@ Theorical cost: Porte teorico -Total without VAT: Total sin IVA \ No newline at end of file +Total without VAT: Total sin IVA +Zone bonus: Bonificación +Zone price: Precio de la zona +Price total: Precio total +Zone breakdown: Desglose zona \ No newline at end of file