From 671b9335c9445f8050bdbc0dd91570719b83aece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 16 May 2020 23:24:14 +0200 Subject: [PATCH 1/3] finished ##255 --- src/components/pricelist/PriceList.vue | 11 +- .../vorstand/ManagementNavigation.vue | 13 +- .../vorstand/WorkgroupManagement.vue | 190 ++++++++++++++++++ src/plugins/routes.js | 12 +- src/router/index.js | 5 + src/store/index.js | 4 +- src/store/modules/workgroupManagement.js | 120 +++++++++++ 7 files changed, 346 insertions(+), 9 deletions(-) create mode 100644 src/components/vorstand/WorkgroupManagement.vue create mode 100644 src/store/modules/workgroupManagement.js diff --git a/src/components/pricelist/PriceList.vue b/src/components/pricelist/PriceList.vue index 62c361d..299ce75 100644 --- a/src/components/pricelist/PriceList.vue +++ b/src/components/pricelist/PriceList.vue @@ -1,6 +1,11 @@ + @@ -132,6 +153,7 @@ export default { header: [ { text: 'Nachname', value: 'lastname' }, { text: 'Vorname(n)', value: 'firstname' }, + { text: 'AG\'s', value: 'workgroups'}, { text: 'Status', value: 'statusgroup' }, { text: 'Stimmrecht', value: 'voting' }, { @@ -146,6 +168,7 @@ export default { firstname: null, lastname: null, username: null, + workgroups: [], statusgroup: { id: -1, name: null @@ -158,6 +181,7 @@ export default { defaultItem: { id: -1, username: null, + workgroups: [], statusgroup: { id: -1, name: null @@ -183,7 +207,9 @@ export default { getUsers: 'usermanager/getUsers', getStatus: 'usermanager/getStatus', updateStatusUser: 'usermanager/updateStatusUser', - updateVoting: 'usermanager/updateVoting' + updateVoting: 'usermanager/updateVoting', + updateWorkgroups: 'usermanager/updateWorkgroups', + getAllWorkgroups: 'wm/getAllWorkgroups' }), getWindowWidth() { this.isFulllineText = document.documentElement.clientWidth <= 750; @@ -231,6 +257,7 @@ export default { save() { this.updateStatusUser({username: this.editedItem.username, status: this.editedItem.statusgroup}) this.updateVoting({username: this.editedItem.username, voting: this.editedItem.voting.value}) + this.updateWorkgroups(this.editedItem) this.close() } }, @@ -239,7 +266,8 @@ export default { users: 'usermanager/users', status: 'usermanager/status', usersLoading: 'usermanager/usersLoading', - statusLoading: 'usermanager/statusLoading' + statusLoading: 'usermanager/statusLoading', + workgroups: 'wm/workgroups' }), computeStatus() { return id => { @@ -263,6 +291,7 @@ export default { created() { this.getUsers() this.getStatus() + this.getAllWorkgroups() } } diff --git a/src/plugins/routes.js b/src/plugins/routes.js index 4c3994e..118a35e 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -40,7 +40,8 @@ const url = { updateStatus: main + 'um/updateStatus', deleteStatus: main + 'um/deleteStatus', updateStatusUser: main + 'um/updateStatusUser', - updateVoting: main + 'um/updateVoting' + updateVoting: main + 'um/updateVoting', + updateWorkgroups: main + 'um/updateWorkgroups' }, wm: { workgroup: main + 'wgm/workgroup', diff --git a/src/store/modules/userManager.js b/src/store/modules/userManager.js index d60a75f..c63ec42 100644 --- a/src/store/modules/userManager.js +++ b/src/store/modules/userManager.js @@ -25,6 +25,7 @@ const mutations = { exists.mail = user.mail exists.statusgroup = user.statusgroup exists.voting = user.voting + exists.workgroups = user.workgroup } else { state.users.push({ username: user.username, @@ -32,7 +33,8 @@ const mutations = { lastname: user.lastname, mail: user.mail, statusgroup: user.statusgroup, - voting: user.voting + voting: user.voting, + workgroups: user.workgroups }) } }, @@ -59,6 +61,14 @@ const mutations = { }, setStatusLoading: (state, value) => { state.statusLoading = value + }, + updateWorkgroups: (state, { id, workgroups }) => { + let exists = state.users.find(a => { + return a.id === id + }) + if (exists) { + exists.workgroups = workgroups + } } } @@ -126,6 +136,23 @@ const actions = { if (e.response) if (e.response.status === 401) dispatch('logout', null, { root: true }) } + }, + async updateWorkgroups({ commit, rootState, dispatch }, data) { + try { + commit('setUsersLoading', true) + const response = await axios.post( + url.vorstand.um.updateWorkgroups, + { ...data }, + { headers: { Token: rootState.login.user.accessToken } } + ) + commit('updateWorkgroups', { id: data.id, workgroups: response.data }) + commit('setUsersLoading', false) + dispatch('getLifeTime', null, { root: true }) + } catch (e) { + commit('setUsersLoading', false) + if (e.response) + if (e.response.status === 401) dispatch('logout', null, { root: true }) + } } } From 82610a011b680d4e8c4f31bf6eafa09e8517231f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 17 May 2020 13:46:34 +0200 Subject: [PATCH 3/3] finished ##257 --- src/components/user/Config.vue | 47 +++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/components/user/Config.vue b/src/components/user/Config.vue index 2933ed9..6d4fa8b 100644 --- a/src/components/user/Config.vue +++ b/src/components/user/Config.vue @@ -132,10 +132,39 @@ - + - + + + + + + + + @@ -186,9 +215,8 @@ export default { }, mounted() { this.$nextTick(function() { - window.addEventListener('resize', this.getWindowWidth); + window.addEventListener('resize', this.getWindowWidth) this.getWindowWidth() - }) }, methods: { @@ -196,9 +224,9 @@ export default { saveConfig: 'user/saveConfig', getStatus: 'user/getStatus' }), - getWindowWidth() { - this.isFulllineText = document.documentElement.clientWidth <= 600; - }, + getWindowWidth() { + this.isFulllineText = document.documentElement.clientWidth <= 600 + }, save() { let user = {} if (this.firstname) user.firstname = this.firstname @@ -249,6 +277,7 @@ export default { +} +