2020-01-26 22:55:59 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<v-card v-if="user" :loading="loading" style="margin-top: 3px">
|
|
|
|
<v-card-title>{{ user.firstname }} {{ user.lastname }}</v-card-title>
|
|
|
|
<v-card-text>
|
|
|
|
<v-row>
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
|
<v-text-field
|
|
|
|
outlined
|
|
|
|
label="Vornamen"
|
|
|
|
:placeholder="user.firstname"
|
|
|
|
v-model="firstname"
|
|
|
|
readonly
|
|
|
|
/>
|
|
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
|
<v-text-field
|
|
|
|
outlined
|
|
|
|
label="Nachname"
|
|
|
|
:placeholder="user.lastname"
|
|
|
|
v-model="lastname"
|
|
|
|
readonly
|
|
|
|
/>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
<v-row>
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
|
<v-text-field
|
|
|
|
outlined
|
|
|
|
label="Benutzername"
|
|
|
|
:placeholder="user.username"
|
|
|
|
v-model="username"
|
|
|
|
readonly
|
|
|
|
></v-text-field>
|
|
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
|
<v-text-field
|
|
|
|
ref="mail"
|
|
|
|
outlined
|
|
|
|
label="E-Mail"
|
|
|
|
:placeholder="user.mail"
|
|
|
|
v-model="mail"
|
|
|
|
readonly
|
|
|
|
></v-text-field>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
<v-row>
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
|
<v-text-field
|
|
|
|
outlined
|
|
|
|
label="Password"
|
|
|
|
type="password"
|
|
|
|
v-model="password"
|
|
|
|
/>
|
|
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
|
<v-text-field
|
|
|
|
ref="password"
|
|
|
|
outlined
|
|
|
|
label="Password bestätigen"
|
|
|
|
type="password"
|
|
|
|
:disabled="!password"
|
|
|
|
:rules="[equal_password]"
|
|
|
|
/>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
<v-divider />
|
|
|
|
<v-row>
|
|
|
|
<v-col cols="12" sm="4">
|
|
|
|
<v-text-field
|
|
|
|
outlined
|
|
|
|
label="Sperrlimit"
|
|
|
|
readonly
|
|
|
|
:value="(user.limit / 100).toFixed(2).toString() + '€'"
|
|
|
|
/>
|
|
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="4">
|
|
|
|
<v-combobox
|
|
|
|
outlined
|
|
|
|
label="Sperrstatus"
|
|
|
|
v-model="lock"
|
|
|
|
append-icon
|
|
|
|
readonly
|
|
|
|
>
|
|
|
|
<template v-slot:selection="data">
|
|
|
|
<v-chip :color="lockColor">
|
|
|
|
{{ data.item }}
|
|
|
|
</v-chip>
|
|
|
|
</template>
|
|
|
|
</v-combobox>
|
|
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="4">
|
|
|
|
<v-combobox
|
|
|
|
outlined
|
|
|
|
label="Autosperre"
|
|
|
|
v-model="autoLock"
|
|
|
|
readonly
|
|
|
|
append-icon
|
|
|
|
>
|
|
|
|
<template v-slot:selection="data">
|
|
|
|
<v-chip :color="autoLockColor">
|
|
|
|
{{ data.item }}
|
|
|
|
</v-chip>
|
|
|
|
</template>
|
|
|
|
</v-combobox>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
<v-row>
|
|
|
|
<v-col>
|
|
|
|
<v-combobox
|
|
|
|
outlined
|
|
|
|
multiple
|
|
|
|
label="Gruppen"
|
|
|
|
readonly
|
|
|
|
v-model="user.group"
|
|
|
|
append-icon
|
|
|
|
>
|
|
|
|
<template v-slot:selection="data">
|
2020-03-03 21:50:47 +00:00
|
|
|
<v-icon class="ma-2">{{
|
2020-01-26 22:55:59 +00:00
|
|
|
data.item === 'user'
|
|
|
|
? person
|
|
|
|
: data.item === 'bar'
|
|
|
|
? bar
|
|
|
|
: data.item === 'moneymaster'
|
|
|
|
? finanzer
|
2020-03-03 21:50:47 +00:00
|
|
|
: data.item === 'gastro'
|
|
|
|
? gastro
|
|
|
|
: ''
|
2020-01-26 22:55:59 +00:00
|
|
|
}}</v-icon>
|
|
|
|
</template>
|
|
|
|
</v-combobox>
|
|
|
|
</v-col>
|
2020-03-03 21:50:47 +00:00
|
|
|
<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>
|
2020-01-26 22:55:59 +00:00
|
|
|
</v-row>
|
|
|
|
</v-card-text>
|
|
|
|
<v-card-actions>
|
|
|
|
<v-spacer></v-spacer>
|
|
|
|
<v-btn @click="save">Save</v-btn>
|
|
|
|
</v-card-actions>
|
|
|
|
<v-expand-transition>
|
2020-03-03 21:50:47 +00:00
|
|
|
<v-alert type="error" v-if="error">{{ error }}</v-alert>
|
2020-01-26 22:55:59 +00:00
|
|
|
</v-expand-transition>
|
|
|
|
</v-card>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-03-03 21:50:47 +00:00
|
|
|
import {
|
|
|
|
mdiAccount,
|
|
|
|
mdiGlassCocktail,
|
|
|
|
mdiCurrencyEur,
|
|
|
|
mdiFoodForkDrink
|
|
|
|
} from '@mdi/js'
|
2020-01-26 22:55:59 +00:00
|
|
|
import { mapGetters, mapActions } from 'vuex'
|
|
|
|
export default {
|
|
|
|
name: 'Config',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
person: mdiAccount,
|
|
|
|
bar: mdiGlassCocktail,
|
|
|
|
finanzer: mdiCurrencyEur,
|
2020-03-03 21:50:47 +00:00
|
|
|
gastro: mdiFoodForkDrink,
|
2020-01-26 22:55:59 +00:00
|
|
|
username: null,
|
|
|
|
mail: null,
|
|
|
|
firstname: null,
|
|
|
|
lastname: null,
|
|
|
|
password: null,
|
|
|
|
equal_password: value =>
|
|
|
|
this.password === value || 'Passwörter sind nicht identisch.',
|
|
|
|
email: value => {
|
2020-03-03 21:50:47 +00:00
|
|
|
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'
|
2020-01-26 22:55:59 +00:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions({
|
2020-03-03 21:50:47 +00:00
|
|
|
saveConfig: 'user/saveConfig',
|
|
|
|
getStatus: 'user/getStatus'
|
2020-01-26 22:55:59 +00:00
|
|
|
}),
|
|
|
|
save() {
|
|
|
|
let user = {}
|
|
|
|
if (this.firstname) user.firstname = this.firstname
|
|
|
|
if (this.lastname) user.lastname = this.lastname
|
|
|
|
if (this.username) user.username = this.username
|
|
|
|
if (this.$refs.mail.validate()) {
|
|
|
|
if (this.mail) user.mail = this.mail
|
|
|
|
}
|
|
|
|
if (this.$refs.password.validate()) {
|
|
|
|
if (this.password) user.password = this.password
|
|
|
|
}
|
2020-03-03 21:50:47 +00:00
|
|
|
this.saveConfig({ oldUsername: user.username, ...user })
|
2020-01-26 22:55:59 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
|
|
|
user: 'user/user',
|
|
|
|
error: 'user/error',
|
2020-03-03 21:50:47 +00:00
|
|
|
loading: 'user/loading',
|
|
|
|
status: 'user/status'
|
2020-01-26 22:55:59 +00:00
|
|
|
}),
|
|
|
|
lock() {
|
2020-01-27 18:56:56 +00:00
|
|
|
return this.user.locked ? 'gesperrt' : 'nicht gesperrt'
|
2020-01-26 22:55:59 +00:00
|
|
|
},
|
|
|
|
lockColor() {
|
2020-01-27 18:56:56 +00:00
|
|
|
return this.user.locked ? 'red' : 'green'
|
2020-01-26 22:55:59 +00:00
|
|
|
},
|
|
|
|
autoLock() {
|
|
|
|
return this.user.autoLock ? 'aktiviert' : 'deaktiviert'
|
|
|
|
},
|
|
|
|
autoLockColor() {
|
|
|
|
return this.user.autoLock ? 'green' : 'red'
|
2020-03-03 21:50:47 +00:00
|
|
|
},
|
|
|
|
computeStatus() {
|
2020-03-05 19:15:35 +00:00
|
|
|
try {
|
|
|
|
return this.status.find(a => a.id == this.user.statusgroup).name
|
|
|
|
} catch (e) {
|
|
|
|
return null
|
|
|
|
}
|
2020-01-26 22:55:59 +00:00
|
|
|
}
|
2020-03-03 21:50:47 +00:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.getStatus()
|
2020-01-26 22:55:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|