diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index dbaa3a409..5d2e47d2a 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -175,5 +175,12 @@ "model": "ItemNiche", "foreignKey": "itemFk" } + }, + "scope": { + "where": { + "name": { + "neq": "" + } + } } } \ No newline at end of file diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 41ef74c38..9fb0337f2 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -105,20 +105,22 @@ on-error-src/> - - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}} + search-function="$ctrl.itemSearchFunc($search)" + on-change="sale.quantity && $ctrl.onChangeQuantity(sale)" + order="id DESC" + tabindex="1"> {{id}} - {{name}} @@ -137,7 +139,8 @@ + on-change="$ctrl.onChangeQuantity(sale)" + tabindex="2"> @@ -150,7 +153,7 @@ - @@ -167,7 +170,8 @@ + ng-click="$ctrl.showEditDiscountPopover($event, sale)" + ng-if="sale.id"> {{(sale.discount / 100) | percentage}} diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index ff7daba03..fd52bd970 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -560,6 +560,12 @@ class Controller { this.$scope.model.refresh(); }); } + + itemSearchFunc($search) { + return /^\d+$/.test($search) + ? {id: $search} + : {name: {like: '%' + $search + '%'}}; + } } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];