From 1e9bd88830ea0caf6356d3b7342c9cebd308977c Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 24 Oct 2018 09:31:08 +0200 Subject: [PATCH] #748 el popover de congifuracion de usuario debe setear unas propedades por defecto --- .../salix/src/components/main-menu/style.scss | 3 +- .../user-configuration-popover/index.html | 6 +-- .../user-configuration-popover/index.js | 43 ++++++++++++------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/client/salix/src/components/main-menu/style.scss b/client/salix/src/components/main-menu/style.scss index 88eaf3105..2719f7927 100644 --- a/client/salix/src/components/main-menu/style.scss +++ b/client/salix/src/components/main-menu/style.scss @@ -19,7 +19,8 @@ vn-main-menu { color: $main-01; } } - .vn-popover ul { + + vn-menu.vn-popover > div > div.content > ul { list-style-type: none; margin: 0; color: white; diff --git a/client/salix/src/components/user-configuration-popover/index.html b/client/salix/src/components/user-configuration-popover/index.html index c2255ca7d..898700609 100644 --- a/client/salix/src/components/user-configuration-popover/index.html +++ b/client/salix/src/components/user-configuration-popover/index.html @@ -20,7 +20,7 @@ vn-one label="Local warehouse" id="localWarehouse" - field="$ctrl.localWarehouse" + field="$ctrl.localWarehouseFk" data="warehouses" select-fields="['id','name']" show-field="name" @@ -32,7 +32,7 @@ vn-one label="Local bank" id="localBank" - field="$ctrl.localBank" + field="$ctrl.localBankFk" data="banks" select-fields="['id','bank']" show-field="bank" @@ -44,7 +44,7 @@ vn-one label="Local company" id="localCompany" - field="$ctrl.localCompany" + field="$ctrl.localCompanyFk" data="companies" select-fields="['id','code']" show-field="code" diff --git a/client/salix/src/components/user-configuration-popover/index.js b/client/salix/src/components/user-configuration-popover/index.js index 559425f84..01e473976 100644 --- a/client/salix/src/components/user-configuration-popover/index.js +++ b/client/salix/src/components/user-configuration-popover/index.js @@ -11,31 +11,36 @@ class Controller { this.getUserConfig(); } - set localBank(value) { - window.localStorage.localBank = value; + set localBankFk(value) { + window.localStorage.localBankFk = value; + window.localStorage.defaultCompanyFk = value; this.showOk(); } - get localBank() { - return parseInt(window.localStorage.localBank); + get localBankFk() { + return parseInt(window.localStorage.localBankFk); } - set localWarehouse(value) { - window.localStorage.localWarehouse = value; + set localWarehouseFk(value) { + window.localStorage.localWarehouseFk = value; + window.localStorage.defaultWarehouseFk = value; this.showOk(); } - get localWarehouse() { - return parseInt(window.localStorage.localWarehouse); + get localWarehouseFk() { + return parseInt(window.localStorage.localWarehouseFk); } - set localCompany(value) { - window.localStorage.localCompany = value; - this.showOk(); + set localCompanyFk(value) { + if (value) { + window.localStorage.localCompanyFk = value; + window.localStorage.defaultCompanyFk = value; + this.showOk(); + } } - get localCompany() { - return parseInt(window.localStorage.localCompany); + get localCompanyFk() { + return parseInt(window.localStorage.localCompanyFk); } set warehouseFk(value) { @@ -63,11 +68,19 @@ class Controller { getUserConfig() { this.$http.get('/api/UserConfigs/getUserConfig') .then(res => { - if (res.data && res.data.warehouseFk) + if (res.data && res.data.warehouseFk) { this.warehouse = res.data.warehouseFk; + if (!localStorage.getItem('localWarehouseFk')) + localStorage.setItem('defaultWarehouseFk', res.data.warehouseFk); + } - if (res.data && res.data.companyFk) + if (res.data && res.data.companyFk) { this.company = res.data.companyFk; + if (!localStorage.getItem('localCompanyFk')) + localStorage.setItem('defaultCompanyFk', res.data.companyFk); + } + + console.log(localStorage.getItem('defaultWarehouseFk'), localStorage.getItem('defaultCompanyFk')); }); }