Styles fixed, change language moved to user config popover

This commit is contained in:
Juan Ferrer 2019-01-31 00:33:43 +01:00
parent 1dc8cafc73
commit f643261a85
16 changed files with 120 additions and 126 deletions

View File

@ -73,17 +73,17 @@ let actions = {
},
changeLanguageToEnglish: function(done) {
this.wait('#lang')
.evaluate(selector => {
return document.querySelector(selector).title;
}, '#lang')
.then(title => {
if (title === 'Change language') {
let langSelector = 'vn-user-configuration-popover vn-autocomplete[field="$ctrl.lang"]';
this.waitToClick('#user')
.wait(langSelector)
.waitToGetProperty(`${langSelector} input`, 'value')
.then(lang => {
if (lang === 'English1') {
this.then(done)
.catch(done);
} else {
this.click('#lang')
.click('vn-main-menu [vn-id="langs-menu"] ul > li[name="en"]')
this.autocompleteSearch(langSelector, 'English')
.then(done)
.catch(done);
}

View File

@ -1,3 +1,5 @@
@import "padding";
vn-searchbar {
padding-top: 6px;
display: block;
@ -5,4 +7,9 @@ vn-searchbar {
& > form > vn-horizontal > vn-icon-button {
color: black;
}
}
.search-panel {
@extend .pad-large;
max-height: 44em;
}

View File

@ -5,22 +5,6 @@
class="unselectable">
{{currentUserName}}
</div>
<vn-icon
id="lang"
icon="language"
vn-popover="langs-menu"
translate-attr="{title: 'Change language'}">
</vn-icon>
<vn-menu vn-id="langs-menu">
<ul pad-small>
<li
ng-repeat="lang in ::$ctrl.langs"
name="{{::lang.code}}"
ng-click="$ctrl.onChangeLangClick(lang.code)">
<span>{{::lang.name}}</span>
</li>
</ul>
</vn-menu>
<vn-icon
id="apps"
icon="apps"

View File

@ -1,16 +1,6 @@
import ngModule from '../../module';
import './style.scss';
let languages = {
es: 'Español',
en: 'English',
ca: 'Català',
pt: 'Português',
fr: 'Français',
nl: 'Nederlands',
mn: 'Монгол хэл'
};
export default class MainMenu {
constructor($translate, $scope, $http, $window, vnModules, vnAuth) {
this.$ = $scope;
@ -18,15 +8,11 @@ export default class MainMenu {
this.$translate = $translate;
this.$window = $window;
this.modules = vnModules.get();
this.langs = [];
this.vnAuth = vnAuth;
}
for (let code of $translate.getAvailableLanguageKeys()) {
this.langs.push({
code: code,
name: languages[code] ? languages[code] : code
});
}
$onInit() {
this.getCurrentUserName();
}
getCurrentUserName() {
@ -43,14 +29,6 @@ export default class MainMenu {
onLogoutClick() {
this.vnAuth.logout();
}
onChangeLangClick(lang) {
this.$translate.use(lang);
}
$onInit() {
this.getCurrentUserName();
}
}
MainMenu.$inject = ['$translate', '$scope', '$http', '$window', 'vnModules', 'vnAuth'];

View File

@ -12,7 +12,7 @@ vn-main-menu {
& > * {
cursor: pointer;
padding-left: .1em;
padding-left: .3em;
&:hover {
color: $main-01;
@ -21,7 +21,7 @@ vn-main-menu {
& > #user {
vertical-align: middle;
font-weight: bold;
padding-right: .6em;
padding-right: .4em;
}
& > vn-icon,
& > a > vn-icon {
@ -41,6 +41,7 @@ vn-main-menu {
padding: .8em;
border-radius: .1em;
min-width: 8em;
white-space: nowrap;
&:last-child {
margin-bottom: 0;

View File

@ -16,72 +16,67 @@
data="companiesData"
order="code">
</vn-crud-model>
<vn-popover vn-id="popover">
<vn-vertical class="body">
<form name="form" ng-submit="$ctrl.onSubmit()">
<vn-horizontal>
<vn-autocomplete
vn-one
label="Local warehouse"
id="localWarehouse"
field="$ctrl.localWarehouseFk"
data="warehousesData"
select-fields="['id','name']"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Local bank"
id="localBank"
field="$ctrl.localBankFk"
data="banksData"
select-fields="['id','bank']"
show-field="bank"
order="id"
value-field="id">
<tpl-item>{{id}}: {{bank}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Local company"
id="localCompany"
field="$ctrl.localCompanyFk"
data="companiesData"
select-fields="['id','code']"
show-field="code"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="User warehouse"
id="userWarehouse"
field="$ctrl.warehouseFk"
data="warehousesData"
select-fields="['id', 'name']"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="User company"
id="userCompany"
field="$ctrl.companyFk"
data="companiesData"
select-fields="['id', 'code']"
show-field="code"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
</form>
<vn-autocomplete
vn-one
label="Local warehouse"
id="localWarehouse"
field="$ctrl.localWarehouseFk"
data="warehousesData"
select-fields="['id','name']"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Local bank"
id="localBank"
field="$ctrl.localBankFk"
data="banksData"
select-fields="['id','bank']"
show-field="bank"
order="id"
value-field="id">
<tpl-item>{{id}}: {{bank}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Local company"
id="localCompany"
field="$ctrl.localCompanyFk"
data="companiesData"
select-fields="['id','code']"
show-field="code"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="User warehouse"
id="userWarehouse"
field="$ctrl.warehouseFk"
data="warehousesData"
select-fields="['id', 'name']"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="User company"
id="userCompany"
field="$ctrl.companyFk"
data="companiesData"
select-fields="['id', 'code']"
show-field="code"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Language"
field="$ctrl.lang"
data="$ctrl.langs"
show-field="name"
value-field="code">
</vn-autocomplete>
</vn-vertical>
</vn-popover>

View File

@ -1,6 +1,16 @@
import ngModule from '../../module';
import './style.scss';
let languages = {
es: 'Español',
en: 'English',
ca: 'Català',
pt: 'Português',
fr: 'Français',
nl: 'Nederlands',
mn: 'Монгол хэл'
};
class Controller {
constructor($scope, $http, $state, vnApp, $translate) {
this.$scope = $scope;
@ -9,6 +19,25 @@ class Controller {
this.vnApp = vnApp;
this.$translate = $translate;
this.getUserConfig();
this.lang = $translate.use();
this.langs = [];
for (let code of $translate.getAvailableLanguageKeys()) {
this.langs.push({
code: code,
name: languages[code] ? languages[code] : code
});
}
}
set lang(value) {
this._lang = value;
this.$translate.use(value);
}
get lang() {
return this._lang;
}
set localBankFk(value) {

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,6 +1,6 @@
<mg-ajax path="/item/api/Tags" options="mgIndex as tags"></mg-ajax>
<div style="min-width: 30em; max-height: 540px; overflow: auto;">
<form pad-large ng-submit="$ctrl.onSearch()">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield
vn-one

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield

View File

@ -1,4 +1,4 @@
<div pad-large style="min-width: 30em">
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield