Changed methods order, minor fixes

This commit is contained in:
Joan Sanchez 2020-06-30 10:01:30 +02:00
parent c9d94ca814
commit a0f625d019
3 changed files with 34 additions and 35 deletions

View File

@ -114,7 +114,7 @@
order="id DESC"
tabindex="1">
<tpl-item>
{{id}} - {{name}}
{{::id}} - {{::name}}
</tpl-item>
</vn-autocomplete>
</vn-td>
@ -132,9 +132,9 @@
<text>
<vn-fetched-tags
max-length="6"
item="sale.item"
item="::sale.item"
name="sale.concept"
sub-name="sale.subName">
sub-name="::sale.subName">
</vn-fetched-tags>
</text>
<field>
@ -182,7 +182,7 @@
ng-show="$ctrl.isEditable"
ng-click="$ctrl.newOrderFromTicket()"
icon="add"
vn-tooltip="Add item"
vn-tooltip="Add item to basket"
vn-bind="+"
fixed-bottom-right>
</vn-float-button>
@ -203,7 +203,7 @@
</vn-spinner>
<div ng-if="$ctrl.edit.mana != null">
<section class="header vn-pa-md">
<h5>MANÁ: {{$ctrl.edit.mana | currency: 'EUR': 0}}</h5>
<h5>MANÁ: {{::$ctrl.edit.mana | currency: 'EUR': 0}}</h5>
</section>
<div class="vn-pa-md">
<vn-input-number
@ -236,7 +236,7 @@
</vn-spinner>
<div ng-if="$ctrl.edit.mana != null">
<section class="header vn-pa-md">
<h5>Mana: {{$ctrl.edit.mana | currency: 'EUR':0}}</h5>
<h5>Mana: {{::$ctrl.edit.mana | currency: 'EUR':0}}</h5>
</section>
<div class="vn-pa-md">
<vn-input-number
@ -276,7 +276,7 @@
</vn-input-number>
</div>
<section class="header vn-pa-md">
<span>Mana: <strong>{{$ctrl.edit.mana | currency: 'EUR': 0}}</strong></span>
<span>Mana: <strong>{{::$ctrl.edit.mana | currency: 'EUR': 0}}</strong></span>
</section>
</div>
</tpl-body>

View File

@ -33,9 +33,8 @@ class Controller extends Section {
return this.ticket.ticketState.state.code;
}
refreshTotal() {
this.getSubTotal();
this.getVat();
get total() {
return this.subtotal + this.VAT;
}
getSubTotal() {
@ -55,6 +54,11 @@ class Controller extends Section {
return price - discount;
}
getMana() {
this.$http.get(`Tickets/${this.$params.id}/getSalesPersonMana`)
.then(res => this.edit.mana = res.data);
}
getVat() {
this.VAT = 0.0;
if (!this.$params.id || !this.sales) return;
@ -63,8 +67,9 @@ class Controller extends Section {
});
}
get total() {
return this.subtotal + this.VAT;
refreshTotal() {
this.getSubTotal();
this.getVat();
}
/**
@ -174,6 +179,22 @@ class Controller extends Section {
this.refreshTotal();
}
createClaim() {
const sales = this.selectedValidSales();
const params = {
claim: {
ticketFk: this.ticket.id,
clientFk: this.ticket.clientFk,
ticketCreated: this.ticket.shipped
},
sales: sales
};
this.resetChanges();
this.$http.post(`Claims/createFromSales`, params)
.then(res => this.$state.go('claim.card.basicData', {id: res.data.id}));
}
showTransferPopover(event) {
this.setTransferParams();
this.$.transfer.parent = event.target;
@ -208,29 +229,6 @@ class Controller extends Section {
.then(res => this.$state.go('ticket.card.sale', {id: res.data.id}));
}
createClaim() {
const sales = this.selectedValidSales();
const params = {
claim: {
ticketFk: this.ticket.id,
clientFk: this.ticket.clientFk,
ticketCreated: this.ticket.shipped
},
sales: sales
};
if (this.newInstances().length === 0)
this.$.watcher.updateOriginalData();
this.$http.post(`Claims/createFromSales`, params)
.then(res => this.$state.go('claim.card.basicData', {id: res.data.id}));
}
getMana() {
this.$http.get(`Tickets/${this.$params.id}/getSalesPersonMana`)
.then(res => this.edit.mana = res.data);
}
showEditPricePopover(event, sale) {
if (!this.isEditable) return;

View File

@ -1,5 +1,6 @@
New price: Nuevo precio
Add item: Añadir artículo
Add item to basket: Añadir artículo a la cesta
Add turn: Añadir a turno
Delete ticket: Eliminar ticket
Mark as reserved: Marcar como reservado