refs #5327 warnFix(ticket_sale): fix orderBy amount itemPackingType #1604

Merged
alexm merged 3 commits from warnFix_ticket_sale_orderBy into test 2023-06-19 05:13:03 +00:00
2 changed files with 8 additions and 2 deletions

View File

@ -69,7 +69,7 @@
<vn-th ng-click="$ctrl.sortBy('price')" field="price" number>Price</vn-th> <vn-th ng-click="$ctrl.sortBy('price')" field="price" number>Price</vn-th>
<vn-th ng-click="$ctrl.sortBy('discount')" field="discount" number>Disc</vn-th> <vn-th ng-click="$ctrl.sortBy('discount')" field="discount" number>Disc</vn-th>
<vn-th ng-click="$ctrl.sortBy('amount')" field="amount" number>Amount</vn-th> <vn-th ng-click="$ctrl.sortBy('amount')" field="amount" number>Amount</vn-th>
<vn-th ng-click="$ctrl.sortBy('itemPackingTypeFk')" field="itemPackingTypeFk" shrink>Packaging</vn-th> <vn-th ng-click="$ctrl.sortBy('item.itemPackingTypeFk')" field="itemPackingTypeFk" shrink>Packaging</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
@ -202,7 +202,7 @@
</span> </span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>
{{$ctrl.getSaleTotal(sale) | currency: 'EUR':2}} {{sale.amount | currency: 'EUR':2}}
</vn-td> </vn-td>
<vn-td shrink> <vn-td shrink>
{{::sale.item.itemPackingTypeFk | dashIfEmpty}} {{::sale.item.itemPackingTypeFk | dashIfEmpty}}

View File

@ -34,6 +34,11 @@ class Controller extends Section {
} }
get sales() { get sales() {
if (this._sales) {
Review

Se te ocurrix alguna manera més eficient?

El problema ve de que AngularJS necesita tindre una propietat per a poder ordenar per ella, entonces he creat .amount

En problema de fer-ho en el Set es que quan es modifica el descompte o s'afegix no entra per el Set.

Se te ocurrix alguna manera més eficient? El problema ve de que AngularJS necesita tindre una propietat per a poder ordenar per ella, entonces he creat .amount En problema de fer-ho en el Set es que quan es modifica el descompte o s'afegix no entra per el Set.
for (let sale of this._sales)
sale.amount = this.getSaleTotal(sale);
}
return this._sales; return this._sales;
} }
@ -49,6 +54,7 @@ class Controller extends Section {
return ticketState && ticketState.state.code; return ticketState && ticketState.state.code;
} }
getConfig() { getConfig() {
let filter = { let filter = {
fields: ['daysForWarningClaim'], fields: ['daysForWarningClaim'],