1368-ticket_sale_refactor #327

Merged
joan merged 20 commits from 1368-ticket_sale_refactor into dev 2020-07-02 12:58:12 +00:00
3 changed files with 34 additions and 35 deletions
Showing only changes of commit a0f625d019 - Show all commits

View File

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

View File

@ -33,9 +33,8 @@ class Controller extends Section {
return this.ticket.ticketState.state.code; return this.ticket.ticketState.state.code;
} }
refreshTotal() { get total() {
this.getSubTotal(); return this.subtotal + this.VAT;
this.getVat();
} }
getSubTotal() { getSubTotal() {
@ -55,6 +54,11 @@ class Controller extends Section {
return price - discount; return price - discount;
} }
getMana() {
this.$http.get(`Tickets/${this.$params.id}/getSalesPersonMana`)
.then(res => this.edit.mana = res.data);
}
getVat() { getVat() {
this.VAT = 0.0; this.VAT = 0.0;
if (!this.$params.id || !this.sales) return; if (!this.$params.id || !this.sales) return;
@ -63,8 +67,9 @@ class Controller extends Section {
}); });
} }
get total() { refreshTotal() {
return this.subtotal + this.VAT; this.getSubTotal();
this.getVat();
} }
/** /**
@ -174,6 +179,22 @@ class Controller extends Section {
this.refreshTotal(); 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) { showTransferPopover(event) {
this.setTransferParams(); this.setTransferParams();
this.$.transfer.parent = event.target; 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})); .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) { showEditPricePopover(event, sale) {
if (!this.isEditable) return; if (!this.isEditable) return;

View File

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