finished ##210

This commit is contained in:
Tim Gröger 2020-03-03 22:50:47 +01:00
parent 7ab0af4119
commit 11b8df2251
2 changed files with 36 additions and 11 deletions

View File

@ -116,18 +116,26 @@
append-icon
>
<template v-slot:selection="data">
<v-icon>{{
<v-icon class="ma-2">{{
data.item === 'user'
? person
: data.item === 'bar'
? bar
: data.item === 'moneymaster'
? finanzer
: false
: data.item === 'gastro'
? gastro
: ''
}}</v-icon>
</template>
</v-combobox>
</v-col>
<v-col>
<v-text-field outlined :value="computeStatus" readonly label="Mitgliedsstatus"/>
</v-col>
<v-col>
<v-text-field outlined :value="user.voting ? 'ja' : 'nein'" readonly label="Stimmrecht" />
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
@ -142,7 +150,12 @@
</template>
<script>
import { mdiAccount, mdiGlassCocktail, mdiCurrencyEur } from '@mdi/js'
import {
mdiAccount,
mdiGlassCocktail,
mdiCurrencyEur,
mdiFoodForkDrink
} from '@mdi/js'
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'Config',
@ -151,6 +164,7 @@ export default {
person: mdiAccount,
bar: mdiGlassCocktail,
finanzer: mdiCurrencyEur,
gastro: mdiFoodForkDrink,
username: null,
mail: null,
firstname: null,
@ -160,8 +174,8 @@ export default {
this.password === value || 'Passwörter sind nicht identisch.',
email: value => {
if (value.length > 0) {
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return pattern.test(value) || 'keine gültige E-Mail';
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return pattern.test(value) || 'keine gültige E-Mail'
}
return true
}
@ -169,7 +183,8 @@ export default {
},
methods: {
...mapActions({
saveConfig: 'user/saveConfig'
saveConfig: 'user/saveConfig',
getStatus: 'user/getStatus'
}),
save() {
let user = {}
@ -189,7 +204,8 @@ export default {
...mapGetters({
user: 'user/user',
error: 'user/error',
loading: 'user/loading'
loading: 'user/loading',
status: 'user/status'
}),
lock() {
return this.user.locked ? 'gesperrt' : 'nicht gesperrt'
@ -202,7 +218,13 @@ export default {
},
autoLockColor() {
return this.user.autoLock ? 'green' : 'red'
},
computeStatus() {
return this.status.find(a => a.id == this.user.statusgroup).name
}
},
created() {
this.getStatus()
}
}
</script>

View File

@ -318,7 +318,7 @@ const actions = {
},
async getStatus({commit, rootState, dispatch }) {
try {
const response = await axios.post(url.user.getAllStatus, {
const response = await axios.get(url.user.getAllStatus, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setStatus', response.data)
@ -355,6 +355,9 @@ const getters = {
},
messages: state => {
return state.message
},
status: state => {
return state.status
}
}