Merge pull request '5327-ticket.sale_ordenarPorColumnas' (!1517) from 5327-ticket.sale_ordenarPorColumnas into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1517
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Vicent Llopis 2023-05-30 07:11:48 +00:00
commit 94e7e8e321
3 changed files with 27 additions and 12 deletions

View File

@ -61,20 +61,20 @@
</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
<vn-th shrink>Visible</vn-th>
<vn-th shrink>Available</vn-th>
<vn-th>Id</vn-th>
<vn-th shrink>Quantity</vn-th>
<vn-th expand>Item</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc</vn-th>
<vn-th number>Amount</vn-th>
<vn-th shrink>Packaging</vn-th>
<vn-th ng-click="$ctrl.sortBy('visible')" field="visible" shrink>Visible</vn-th>
<vn-th ng-click="$ctrl.sortBy('available')" field="available" shrink>Available</vn-th>
<vn-th ng-click="$ctrl.sortBy('itemFk')" field="itemFk">Id</vn-th>
<vn-th ng-click="$ctrl.sortBy('quantity')" field="quantity" shrink>Quantity</vn-th>
<vn-th ng-click="$ctrl.sortBy('concept')" field="concept" expand>Item</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('amount')" field="amount" number>Amount</vn-th>
<vn-th ng-click="$ctrl.sortBy('itemPackingTypeFk')" field="itemPackingTypeFk" shrink>Packaging</vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.sales">
<vn-tr ng-repeat="sale in $ctrl.sales | orderBy: $ctrl.propertyName:$ctrl.reverse">
<vn-td shrink>
<vn-check tabindex="-1"
ng-model="sale.checked">
@ -481,7 +481,7 @@
on-accept="$ctrl.transferSales($ctrl.transfer.ticketId)">
</vn-confirm>
<vn-confirm
<vn-confirm
vn-id="claimConfirm"
question="Do you want to continue?"
message="Claim out of time"
@ -515,7 +515,7 @@
name="claim"
ng-click="$ctrl.createClaim()"
ng-if="$ctrl.isClaimable">
Add claim
Add claim
</vn-item>
<vn-item translate
name="reserve"

View File

@ -10,6 +10,11 @@ class Controller extends Section {
this.getConfig();
}
sortBy(propertyName) {
this.reverse = (this.propertyName === propertyName) ? !this.reverse : false;
this.propertyName = propertyName;
}
get manaCode() {
return this._manaCode;
}

View File

@ -758,5 +758,15 @@ describe('Ticket', () => {
expect(controller.$.editDiscount.hide).toHaveBeenCalledWith();
});
});
describe('sortBy()', () => {
it('should set reverse and propertyName properties', () => {
const propertyName = 'id';
controller.sortBy(propertyName);
expect(controller.propertyName).toEqual(propertyName);
expect(controller.reverse).toEqual(false);
});
});
});
});