2181 - Ticket sale fix item search
This commit is contained in:
parent
ba19c9069a
commit
269bd8e69a
|
@ -175,5 +175,12 @@
|
||||||
"model": "ItemNiche",
|
"model": "ItemNiche",
|
||||||
"foreignKey": "itemFk"
|
"foreignKey": "itemFk"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"where": {
|
||||||
|
"name": {
|
||||||
|
"neq": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -105,20 +105,22 @@
|
||||||
on-error-src/>
|
on-error-src/>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td vn-focus number>
|
<vn-td vn-focus number>
|
||||||
<span class="link" ng-if="sale.itemFk"
|
<span class="link" ng-if="sale.id"
|
||||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
||||||
{{sale.itemFk | zeroFill:6}}
|
{{sale.itemFk}}
|
||||||
</span>
|
</span>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
ng-if="!sale.itemFk"
|
ng-if="!sale.id"
|
||||||
vn-focus
|
vn-focus
|
||||||
vn-one
|
vn-one
|
||||||
url="Items"
|
url="Items"
|
||||||
ng-model="sale.itemFk"
|
ng-model="sale.itemFk"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
search-function="{or: [{id: $search}, {name: {like: '%' + $search + '%'}}]}"
|
search-function="$ctrl.itemSearchFunc($search)"
|
||||||
order="id DESC">
|
on-change="sale.quantity && $ctrl.onChangeQuantity(sale)"
|
||||||
|
order="id DESC"
|
||||||
|
tabindex="1">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
{{id}} - {{name}}
|
{{id}} - {{name}}
|
||||||
</tpl-item>
|
</tpl-item>
|
||||||
|
@ -137,7 +139,8 @@
|
||||||
<vn-td ng-if="!sale.id" number>
|
<vn-td ng-if="!sale.id" number>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
ng-model="sale.quantity"
|
ng-model="sale.quantity"
|
||||||
on-change="$ctrl.onChangeQuantity(sale)">
|
on-change="$ctrl.onChangeQuantity(sale)"
|
||||||
|
tabindex="2">
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td-editable disabled="!sale.id || !$ctrl.isEditable" expand>
|
<vn-td-editable disabled="!sale.id || !$ctrl.isEditable" expand>
|
||||||
|
@ -150,7 +153,7 @@
|
||||||
</vn-fetched-tags>
|
</vn-fetched-tags>
|
||||||
</text>
|
</text>
|
||||||
<field>
|
<field>
|
||||||
<vn-textfield
|
<vn-textfield class="dense"
|
||||||
vn-id="concept"
|
vn-id="concept"
|
||||||
ng-model="sale.concept"
|
ng-model="sale.concept"
|
||||||
on-change="$ctrl.updateConcept(sale)">
|
on-change="$ctrl.updateConcept(sale)">
|
||||||
|
@ -167,7 +170,8 @@
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span ng-class="{'link': !$ctrl.isLocked}"
|
<span ng-class="{'link': !$ctrl.isLocked}"
|
||||||
title="{{!$ctrl.isLocked ? 'Edit discount' : ''}}"
|
title="{{!$ctrl.isLocked ? 'Edit discount' : ''}}"
|
||||||
ng-click="$ctrl.showEditDiscountPopover($event, sale)">
|
ng-click="$ctrl.showEditDiscountPopover($event, sale)"
|
||||||
|
ng-if="sale.id">
|
||||||
{{(sale.discount / 100) | percentage}}
|
{{(sale.discount / 100) | percentage}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -560,6 +560,12 @@ class Controller {
|
||||||
this.$scope.model.refresh();
|
this.$scope.model.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itemSearchFunc($search) {
|
||||||
|
return /^\d+$/.test($search)
|
||||||
|
? {id: $search}
|
||||||
|
: {name: {like: '%' + $search + '%'}};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
||||||
|
|
Loading…
Reference in New Issue