add progress circal in user list for finanzer navigation

This commit is contained in:
Tim Gröger 2020-01-23 13:24:12 +01:00
parent db524355b5
commit 706c69803f
6 changed files with 55 additions and 49 deletions

View File

@ -1,11 +1,7 @@
<template> <template>
<div> <div>
<v-list> <v-list>
<v-list-item <v-list-item class="title" link to="/main/finanzer/overview">
class="title"
link
to="/main/finanzer/overview"
>
<v-list-item-icon> <v-list-item-icon>
<v-icon>home</v-icon> <v-icon>home</v-icon>
</v-list-item-icon> </v-list-item-icon>
@ -15,23 +11,19 @@
<v-list-item-icon> <v-list-item-icon>
<v-icon>work</v-icon> <v-icon>work</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title> <v-list-item-title>Dienstverwaltung</v-list-item-title>
Dienstverwaltung
</v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
<v-divider /> <v-divider />
<v-list> <v-list>
<div v-for="user in users" v-bind:key="users.indexOf(user)"> <div v-for="user in users" v-bind:key="users.indexOf(user)">
<v-list-item <v-list-item :to="{ name: 'activeUser', params: { id: user.username } }" link>
:to="{ name: 'activeUser', params: { id: user.username } }" <v-list-item-title>{{ user.lastname }}, {{ user.firstname }}</v-list-item-title>
link
>
<v-list-item-title
>{{ user.lastname }}, {{ user.firstname }}
</v-list-item-title>
</v-list-item> </v-list-item>
</div> </div>
<v-list-item>
<v-progress-circular indeterminate color="grey" v-if="loading" />
</v-list-item>
</v-list> </v-list>
</div> </div>
</template> </template>
@ -42,13 +34,14 @@ export default {
name: 'FinanzerNavigation', name: 'FinanzerNavigation',
methods: { methods: {
...mapActions({ ...mapActions({
addUser: 'finanzerUsers/addUser', addUser: 'finanzerUsers/addUser'
}) })
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
users: 'finanzerUsers/users', users: 'finanzerUsers/users',
allUsers: 'finanzerUsers/allUsers' allUsers: 'finanzerUsers/allUsers',
loading: 'finanzerUsers/usersLoading'
}) })
} }
} }

View File

@ -1,21 +1,19 @@
<template> <template>
<v-content v-if="activeUser"> <v-content v-if="activeUser">
<v-toolbar tile> <v-toolbar tile>
<v-toolbar-title <v-toolbar-title>{{ activeUser.lastname }}, {{ activeUser.firstname }}</v-toolbar-title>
>{{ activeUser.lastname }}, {{ activeUser.firstname }}</v-toolbar-title
>
<v-spacer /> <v-spacer />
<v-toolbar-items> <v-toolbar-items>
<v-btn @click="sendMail({ username: activeUser.username })" text <v-btn @click="sendMail({ username: activeUser.username })" text>Email senden</v-btn>
>Email senden</v-btn
>
</v-toolbar-items> </v-toolbar-items>
</v-toolbar> </v-toolbar>
<v-expand-transition> <v-expand-transition>
<v-card style="margin-top: 3px" v-show="errorMail"> <v-card style="margin-top: 3px" v-show="errorMail">
<v-alert dense :type="computeError(errorMail)">{{ <v-alert dense :type="computeError(errorMail)">
{{
errorMessage(errorMail) errorMessage(errorMail)
}}</v-alert> }}
</v-alert>
</v-card> </v-card>
</v-expand-transition> </v-expand-transition>
<v-card style="margin-top: 3px;"> <v-card style="margin-top: 3px;">
@ -30,16 +28,14 @@
<v-chip <v-chip
outlined outlined
:text-color="getLockedColor(activeUser.locked)" :text-color="getLockedColor(activeUser.locked)"
>{{ activeUser.locked ? 'Gesperrt' : 'nicht Gesperrt' }}</v-chip >{{ activeUser.locked ? 'Gesperrt' : 'nicht Gesperrt' }}</v-chip>
>
</v-col> </v-col>
<v-col> <v-col>
<v-btn <v-btn
@click=" @click="
doLock({ user: activeUser, locked: !activeUser.locked }) doLock({ user: activeUser, locked: !activeUser.locked })
" "
>{{ activeUser.locked ? 'Entperren' : 'Sperren' }}</v-btn >{{ activeUser.locked ? 'Entperren' : 'Sperren' }}</v-btn>
>
</v-col> </v-col>
</v-row> </v-row>
<v-divider style="margin-bottom: 15px;" /> <v-divider style="margin-bottom: 15px;" />
@ -75,8 +71,7 @@
autoLock: autoLock.value autoLock: autoLock.value
}) })
" "
>Speichern</v-btn >Speichern</v-btn>
>
</v-row> </v-row>
</v-form> </v-form>
</v-card-text> </v-card-text>
@ -87,11 +82,7 @@
<v-form style="margin-left: 15px; margin-right: 15px"> <v-form style="margin-left: 15px; margin-right: 15px">
<v-row> <v-row>
<v-col> <v-col>
<v-text-field <v-text-field :rules="[isNumber]" label="Betrag" v-model="amount"></v-text-field>
:rules="[isNumber]"
label="Betrag"
v-model="amount"
></v-text-field>
</v-col> </v-col>
<v-col> <v-col>
<v-select <v-select
@ -149,10 +140,11 @@
:text-color=" :text-color="
getLastColor(activeUser.creditList[year][1].last) getLastColor(activeUser.creditList[year][1].last)
" "
>{{
(activeUser.creditList[year][1].last / 100).toFixed(2)
}}</v-chip
> >
{{
(activeUser.creditList[year][1].last / 100).toFixed(2)
}}
</v-chip>
</v-col> </v-col>
<v-col> <v-col>
<v-label>Gesamt:</v-label> <v-label>Gesamt:</v-label>
@ -341,6 +333,7 @@ export default {
}, },
watch: { watch: {
activeUser(newVal) { activeUser(newVal) {
// eslint-disable-next-line no-console
console.log(newVal) console.log(newVal)
this.limit = (newVal.limit / 100).toFixed(2) this.limit = (newVal.limit / 100).toFixed(2)
this.autoLock = { this.autoLock = {
@ -349,6 +342,7 @@ export default {
} }
}, },
id(newVal) { id(newVal) {
// eslint-disable-next-line no-console
console.log(newVal) console.log(newVal)
this.setActiveUser(newVal) this.setActiveUser(newVal)
} }

View File

@ -1,6 +1,6 @@
//const main = 'https://192.168.5.128:5000/' //const main = 'https://192.168.5.128:5000/'
//const main = 'https://localhost:5000/' const main = 'http://localhost:5000/'
const main = 'http://192.168.5.118:5000/' //const main = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/' //const main = 'https://groeger-clan.duckdns.org:5000/'
const url = { const url = {

View File

@ -97,7 +97,6 @@ const router = new VueRouter({
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
store.dispatch('fetchAccessToken') store.dispatch('fetchAccessToken')
console.log('fullPath', to.fullPath)
if (to.fullPath.includes('/main')) { if (to.fullPath.includes('/main')) {
if (to.fullPath.includes('/main/finanzer')) { if (to.fullPath.includes('/main/finanzer')) {
if (!store.state.login.user.group.includes('moneymaster')) { if (!store.state.login.user.group.includes('moneymaster')) {

View File

@ -24,7 +24,9 @@ const state = {
{ value: 10, text: 'Oktober' }, { value: 10, text: 'Oktober' },
{ value: 11, text: 'November' }, { value: 11, text: 'November' },
{ value: 12, text: 'Dezember' } { value: 12, text: 'Dezember' }
] ],
allUsersLoading: false,
usersLoading: false
} }
const mutations = { const mutations = {
@ -217,12 +219,19 @@ const mutations = {
setYear: (state, value) => { setYear: (state, value) => {
if (value) state.year++ if (value) state.year++
else state.year-- else state.year--
},
setAllUsersLoading: (state, value) => {
state.allUsersLoading = value
},
setUsersLoading: (state, value) => {
state.usersLoading = value
} }
} }
const actions = { const actions = {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
async getAllUsers({ commit, rootState, dispatch }) { async getAllUsers({ commit, rootState, dispatch }) {
commit('setAllUsersLoading', true)
try { try {
const response = await axios.post( const response = await axios.post(
url.searchUser, url.searchUser,
@ -236,8 +245,10 @@ const actions = {
if (err.response.status === 401) if (err.response.status === 401)
dispatch('logout', null, { root: true }) dispatch('logout', null, { root: true })
} }
commit('setAllUsersLoading', false)
}, },
async getUsers({ commit, rootState, dispatch }) { async getUsers({ commit, rootState, dispatch }) {
commit('setUsersLoading', true)
try { try {
const response = await axios.get(url.getFinanzerMain, { const response = await axios.get(url.getFinanzerMain, {
headers: { Token: rootState.login.user.accessToken } headers: { Token: rootState.login.user.accessToken }
@ -248,6 +259,7 @@ const actions = {
if (err.response.status === 401) if (err.response.status === 401)
dispatch('logout', null, { root: true }) dispatch('logout', null, { root: true })
} }
commit('setUsersLoading', false)
}, },
setActiveUser({ commit }, username) { setActiveUser({ commit }, username) {
commit('setActiveUser', username) commit('setActiveUser', username)
@ -410,6 +422,12 @@ const getters = {
}, },
months: state => { months: state => {
return state.months return state.months
},
allUsersLoading: state => {
return state.allUsersLoading
},
usersLoading: state => {
return state.usersLoading
} }
} }

View File

@ -11,6 +11,7 @@ const mutations = {
state.user = user state.user = user
let list = {} let list = {}
for (let creditList in user['creditList']) { for (let creditList in user['creditList']) {
// eslint-disable-next-line no-console
console.log(creditList) console.log(creditList)
let amount = mutations.createAmount(user['creditList'][creditList]) let amount = mutations.createAmount(user['creditList'][creditList])
let credit = mutations.createCredit(user['creditList'][creditList]) let credit = mutations.createCredit(user['creditList'][creditList])
@ -19,6 +20,7 @@ const mutations = {
} }
state.user.creditList = list state.user.creditList = list
state.creditList = [] state.creditList = []
// eslint-disable-next-line no-console
console.log(state.user) console.log(state.user)
}, },
createAmount(creditList) { createAmount(creditList) {