ticket component refactor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-10-29 11:09:58 +01:00
parent 8faf7d97fd
commit 42d16d0258
6 changed files with 54 additions and 6 deletions

View File

@ -48,6 +48,12 @@
},
"zoneFk": {
"type": "Number"
},
"zonePrice": {
"type": "Number"
},
"zoneBonus": {
"type": "Number"
}
},
"relations": {

View File

@ -15,6 +15,9 @@ class Controller extends ModuleCard {
relation: 'warehouse',
scope: {fields: ['name']}
},
{
relation: 'zone',
},
{
relation: 'invoiceOut',
scope: {fields: ['id']}

View File

@ -76,11 +76,35 @@
</section>
</div>
<div class="totalBox align-left">
<h6 class="align-center" translate>Theorical cost</h6>
<div> <vn-label translate>Price</vn-label> {{$ctrl.theoricalCost | currency: 'EUR': 2}} </div>
<h6 class="align-center" translate>Zone breakdown</h6>
<div> <vn-label translate>Zone price</vn-label> {{$ctrl.ticket.zonePrice | currency: 'EUR': 2}} </div>
<div> <vn-label translate>Zone bonus</vn-label> {{$ctrl.ticket.zoneBonus | currency: 'EUR': 2}} </div>
<div> <vn-label translate>Zone</vn-label>
<span
title="{{$ctrl.ticket.zone.name}}"
vn-click-stop="zoneDescriptor.show($event, $ctrl.ticket.zone.id)"
class="link">
{{$ctrl.ticket.zone.name | dashIfEmpty}}
</span>
</div>
<div ng-show="$ctrl.ticket.zone.isVolumetric">
<vn-label translate>Volume</vn-label> {{$ctrl.ticketVolume}}
</div>
<div ng-show="!$ctrl.ticket.zone.isVolumetric">
<vn-label translate>Packages</vn-label> {{$ctrl.ticket.packages}}
</div>
</div>
<div class="totalBox align-left">
<h6 class="align-center" translate>Theorical cost</h6>
<div class="total"> <vn-label translate>Price total</vn-label> {{$ctrl.theoricalCost | currency: 'EUR': 2}} </div>
</div>
</vn-side-menu>
<vn-item-descriptor-popover
vn-id="descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>
</vn-item-descriptor-popover>
<vn-zone-descriptor-popover
vn-id="zoneDescriptor">
</vn-zone-descriptor-popover>

View File

@ -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', {

View File

@ -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();

View File

@ -1,2 +1,6 @@
Theorical cost: Porte teorico
Total without VAT: Total sin IVA
Total without VAT: Total sin IVA
Zone bonus: Bonificación
Zone price: Precio de la zona
Price total: Precio total
Zone breakdown: Desglose zona