Bug #1194 configuracion de usuario, buscar por id

This commit is contained in:
Carlos Jimenez Ruiz 2019-03-07 09:55:03 +01:00
parent bbe8e7988e
commit 1bf7aa112a
2 changed files with 12 additions and 14 deletions

View File

@ -1,9 +1,3 @@
<vn-crud-model
url="/api/Banks"
vn-id="banks"
data="banksData"
order="bank">
</vn-crud-model>
<vn-crud-model <vn-crud-model
url="/api/Warehouses" url="/api/Warehouses"
vn-id="warehouses" vn-id="warehouses"
@ -33,11 +27,12 @@
label="Local bank" label="Local bank"
id="localBank" id="localBank"
field="$ctrl.localBankFk" field="$ctrl.localBankFk"
data="banksData" url="/api/Banks"
select-fields="['id','bank']" select-fields="['id','bank']"
show-field="bank" show-field="bank"
order="id" order="id"
value-field="id"> value-field="id"
search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}">
<tpl-item>{{id}}: {{bank}}</tpl-item> <tpl-item>{{id}}: {{bank}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete

View File

@ -31,6 +31,13 @@ class Controller {
} }
} }
$onInit() {
if (window.localStorage.localBankFk && window.localStorage.localBankFk !== 'null')
window.localStorage.defaultBankFk = window.localStorage.localBankFk;
else
localStorage.removeItem('defaultBankFk');
}
set lang(value) { set lang(value) {
this._lang = value; this._lang = value;
this.$translate.use(value); this.$translate.use(value);
@ -105,7 +112,6 @@ class Controller {
} }
show(event) { show(event) {
this.$scope.banks.refresh();
this.$scope.warehouses.refresh(); this.$scope.warehouses.refresh();
this.$scope.companies.refresh(); this.$scope.companies.refresh();
this.$scope.popover.parent = event.target; this.$scope.popover.parent = event.target;
@ -139,11 +145,8 @@ class Controller {
}); });
} }
$onInit() { searchLocalBank(a, b) {
if (window.localStorage.localBankFk && window.localStorage.localBankFk !== 'null') return angular.equals(a.id, b.id);
window.localStorage.defaultBankFk = window.localStorage.localBankFk;
else
localStorage.removeItem('defaultBankFk');
} }
} }