From b2428cb5b4d6eefdbfb6fd8d5ca4ca6d42318e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 5 Mar 2020 21:16:47 +0100 Subject: [PATCH] fixed some bugs --- package-lock.json | 19 ++------ package.json | 1 - src/App.vue | 19 ++------ src/components/CookieNotification.vue | 48 +++++++++++++++++++ src/components/baruser/CreditLists.vue | 1 - src/components/finanzer/User.vue | 4 -- src/components/pricelist/PriceList.vue | 7 --- src/components/user/AddAmount.vue | 2 - src/components/user/Jobs/Day.vue | 10 +--- .../ServiceManagementComponents/Day.vue | 9 +--- src/components/vorstand/UserManager.vue | 3 -- src/plugins/routes.js | 4 +- src/router/index.js | 15 +++--- src/store/modules/barUsers.js | 26 +++++----- src/store/modules/finanzerUsers.js | 8 ++-- src/store/modules/jobRequests.js | 6 +-- src/store/modules/jobs.js | 10 ++-- src/store/modules/login.js | 39 +++++++++++++-- src/store/modules/serviceManagement.js | 7 ++- src/store/modules/user.js | 16 +------ src/store/modules/userManager.js | 3 +- src/views/contents/Cookies.vue | 22 --------- 22 files changed, 127 insertions(+), 152 deletions(-) create mode 100644 src/components/CookieNotification.vue delete mode 100644 src/views/contents/Cookies.vue diff --git a/package-lock.json b/package-lock.json index abd000c..ff23f0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -883,9 +883,9 @@ "dev": true }, "@hapi/hoek": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz", - "integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw==", + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz", + "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==", "dev": true }, "@hapi/joi": { @@ -10402,11 +10402,6 @@ "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", "dev": true }, - "tiny-cookie": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tiny-cookie/-/tiny-cookie-2.3.1.tgz", - "integrity": "sha512-C4x1e8dHfKf03ewuN9aIZzzOfN2a6QKhYlnHdzJxmmjMTLqcskI20F+EplszjODQ4SHmIGFJrvUUnBMS/bJbOA==" - }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -10897,14 +10892,6 @@ } } }, - "vue-cookie-law": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/vue-cookie-law/-/vue-cookie-law-1.12.0.tgz", - "integrity": "sha512-Am8lHqGVD7P6iVkktVE7sZwqZz36oBBKJBBveXwCOOKA7U7XJNveO7kFxJPBrJwOzrsXjbxGIGibg5SpNlJkKg==", - "requires": { - "tiny-cookie": "^2.1.1" - } - }, "vue-eslint-parser": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz", diff --git a/package.json b/package.json index a067bd4..b520207 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "@mdi/js": "^4.8.95", "core-js": "^3.4.3", "vue": "^2.6.10", - "vue-cookie-law": "^1.12.0", "vue-router": "^3.1.3", "vuetify": "^2.1.0", "vuex": "^3.1.2" diff --git a/src/App.vue b/src/App.vue index 7a40772..8db0818 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,30 +6,17 @@ © {{ new Date().getFullYear() }} Studentenclub Wu 5 e.v. - - - + + + diff --git a/src/components/baruser/CreditLists.vue b/src/components/baruser/CreditLists.vue index a3098ad..9a9e4d5 100644 --- a/src/components/baruser/CreditLists.vue +++ b/src/components/baruser/CreditLists.vue @@ -262,7 +262,6 @@ export default { }, 300) }, storno(message) { - console.log('storno') if (!message.error) { if (!this.under5minutes(message.date)) this.dialog = true else { diff --git a/src/components/finanzer/User.vue b/src/components/finanzer/User.vue index 7f09a1d..be477d0 100644 --- a/src/components/finanzer/User.vue +++ b/src/components/finanzer/User.vue @@ -347,8 +347,6 @@ export default { }, watch: { activeUser(newVal) { - // eslint-disable-next-line no-console - console.log(newVal) this.limit = (newVal.limit / 100).toFixed(2) this.autoLock = { value: newVal.autoLock, @@ -356,8 +354,6 @@ export default { } }, id(newVal) { - // eslint-disable-next-line no-console - console.log(newVal) this.setActiveUser(newVal) } } diff --git a/src/components/pricelist/PriceList.vue b/src/components/pricelist/PriceList.vue index 7a0b2f2..62c361d 100644 --- a/src/components/pricelist/PriceList.vue +++ b/src/components/pricelist/PriceList.vue @@ -347,7 +347,6 @@ export default { deleteDrinkType: 'priceList/deleteDrinkType' }), editType(item) { - console.log(item) this.editedType = Object.assign({}, item) this.dialogType = true }, @@ -379,7 +378,6 @@ export default { }, editItem(item) { this.editedIndex = item.id - console.log('item', item) this.editedItem = Object.assign({}, item) for (let i in this.editedItem) { this.editedItem[i] = isNaN(this.editedItem[i]) @@ -388,7 +386,6 @@ export default { ? null : (this.editedItem[i] / 100).toFixed(2) } - console.log(this.editedItem) this.editedItem.type = Object.assign( {}, this.types.find(a => a.id == item.type) @@ -401,9 +398,6 @@ export default { this.deleteDrink({ id: item.id }) }, save() { - console.log(this.editedItem) - console.log(this.editedIndex) - console.log(!isNaN(this.editedItem.price_extern_club)) var drink = { id: this.editedIndex, name: this.editedItem.name, @@ -430,7 +424,6 @@ export default { ? this.editedItem.price_extern_club * 100 : null } - console.log(drink) drink.id === -1 ? this.setDrink(drink) : this.updateDrink(drink) this.editedItem = Object.assign({}, this.defaultItem) this.close() diff --git a/src/components/user/AddAmount.vue b/src/components/user/AddAmount.vue index 8fefcac..84fc5ad 100644 --- a/src/components/user/AddAmount.vue +++ b/src/components/user/AddAmount.vue @@ -198,7 +198,6 @@ export default { return value >= 0 ? 'title green--text' : 'title red--text' }, getAllSum() { - console.log('getAllSum', this.user) if (this.user) return ( this.user.creditList[this.year][2].sum + @@ -207,7 +206,6 @@ export default { return 0 }, storno(message) { - console.log('storno') if (!message.error) { if (!this.under5minutes(message.date)) this.dialog = true else { diff --git a/src/components/user/Jobs/Day.vue b/src/components/user/Jobs/Day.vue index f322de8..7c47de5 100644 --- a/src/components/user/Jobs/Day.vue +++ b/src/components/user/Jobs/Day.vue @@ -31,7 +31,7 @@ -
+
{{ lockedText }} - {{lockedTextBtn}} + {{lockedTextBtn}}
@@ -113,9 +113,6 @@ export default { day: this.day.date.getDate() }) }, - test(event) { - console.log('blur', event) - }, color: day => { if (day) { if (day.date.getDay() === 0 || day.date.getDay() === 1) { @@ -173,7 +170,6 @@ export default { for (let user in oldValue) { if (!newValue.includes(oldValue[user])) { deletedUser = oldValue[user] - console.log('deleteUser', deletedUser, this.day.date) this.deleteUser({ startdatetime: this.day.date, date: this.day.date.getTime() / 1000, @@ -194,9 +190,6 @@ export default { month: this.day.date.getMonth() + 1, day: this.day.date.getDate() }) - }, - focused(newVal, oldValue) { - console.log(newVal, oldValue) } } } diff --git a/src/components/vorstand/UserManager.vue b/src/components/vorstand/UserManager.vue index 61652df..72f9491 100644 --- a/src/components/vorstand/UserManager.vue +++ b/src/components/vorstand/UserManager.vue @@ -174,9 +174,7 @@ export default { }, 300) }, editItem(item) { - console.log('item', item) this.editedItem = Object.assign({}, item) - console.log(this.editedItem) this.editedItem.statusgroup = Object.assign( {}, this.status.find(a => a.id == item.statusgroup) @@ -184,7 +182,6 @@ export default { this.editedItem.voting = Object.assign({}, item.voting ? {value: true, text: 'ja'} : {value: false, text: 'nein'}) this.clickItem(this.editedItem.statusgroup) - console.log(this.editedItem) this.editUser = true }, clickItem(item) { diff --git a/src/plugins/routes.js b/src/plugins/routes.js index 06f86a8..a6d0023 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -1,7 +1,7 @@ //const main = 'https://192.168.5.128:5000/' -const main = 'http://localhost:5000/' +//const main = 'http://localhost: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 = { login: main + 'login', diff --git a/src/router/index.js b/src/router/index.js index b47ef28..fccf75b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -19,18 +19,17 @@ import Config from '@/components/user/Config' import Jobs from '@/components/user/Jobs' import JobRequests from '@/components/user/JobRequests' import PriceList from '@/components/pricelist/PriceList' -import ManagementNavigation from "@/components/vorstand/ManagementNavigation"; -import GastroNavigation from "@/components/gastro/GastroNavigation"; -import PriceListView from "@/views/contents/PriceListView"; -import UserManager from "@/components/vorstand/UserManager"; +import ManagementNavigation from '@/components/vorstand/ManagementNavigation' +import GastroNavigation from '@/components/gastro/GastroNavigation' +import PriceListView from '@/views/contents/PriceListView' +import UserManager from '@/components/vorstand/UserManager' Vue.use(VueRouter) const routes = [ { path: '/cookies', - name: 'cookies', - + name: 'cookies' }, { path: '/pricelist', @@ -50,7 +49,7 @@ const routes = [ { path: 'management', name: 'management', - components: { nav: ManagementNavigation, default: BarView}, + components: { nav: ManagementNavigation, default: BarView }, children: [ { path: 'servicemanagement', @@ -126,7 +125,7 @@ const routes = [ { path: 'gastro', name: 'gastro', - components: { nav: GastroNavigation, default: BarView}, + components: { nav: GastroNavigation, default: BarView }, children: [ { path: 'pricelist', diff --git a/src/store/modules/barUsers.js b/src/store/modules/barUsers.js index b48afef..d2bca91 100644 --- a/src/store/modules/barUsers.js +++ b/src/store/modules/barUsers.js @@ -104,7 +104,6 @@ const mutations = { amount: data.amount, date: new Date() }) - console.log(state.message) }, updateMessage: (state, data) => { var message = state.message.find(msg => { @@ -137,9 +136,9 @@ const actions = { }, async addAmount({ commit, rootState, dispatch }, data) { try { - commit('updateUser', {username: data.username, loading: true}) + commit('updateUser', { username: data.username, loading: true }) } catch (e) { - console.log(e) + //error } try { const response = await axios.post( @@ -163,16 +162,16 @@ const actions = { if (e.response.status === 401) dispatch('logout', null, { root: true }) } try { - commit('updateUser', {username: data.username, loading: false}) + commit('updateUser', { username: data.username, loading: false }) } catch (e) { - console.log(e) + //error } }, async addCreditList({ commit, rootState, dispatch }, data) { try { - commit('updateUser', {username: data.username, loading: true}) + commit('updateUser', { username: data.username, loading: true }) } catch (e) { - console.log(e) + //error } try { const response = await axios.post( @@ -186,18 +185,17 @@ const actions = { if (e.response.status === 401) dispatch('logout', null, { root: true }) } try { - commit('updateUser', {username: data.username, loading: false}) - } catch (e) { - console.log(e) + commit('updateUser', { username: data.username, loading: false }) + } catch { + //error } }, async getAllUsers({ commit, rootState, dispatch }) { commit('setAllUsersLoading', true) try { - const response = await axios.get( - url.searchUser, - { headers: { Token: rootState.login.user.accessToken } } - ) + const response = await axios.get(url.searchUser, { + headers: { Token: rootState.login.user.accessToken } + }) commit('setAllUsers', response.data) } catch (e) { if (e.response) diff --git a/src/store/modules/finanzerUsers.js b/src/store/modules/finanzerUsers.js index 6a92bc9..66b31e5 100644 --- a/src/store/modules/finanzerUsers.js +++ b/src/store/modules/finanzerUsers.js @@ -243,13 +243,11 @@ const actions = { async getAllUsers({ commit, rootState, dispatch }) { commit('setAllUsersLoading', true) try { - const response = await axios.get( - url.searchUser, - { headers: { Token: rootState.login.user.accessToken } } - ) + const response = await axios.get(url.searchUser, { + headers: { Token: rootState.login.user.accessToken } + }) commit('setAllUsers', response.data) } catch (err) { - // eslint-disable-next-line no-console if (err.response) if (err.response.status === 401) dispatch('logout', null, { root: true }) diff --git a/src/store/modules/jobRequests.js b/src/store/modules/jobRequests.js index 02747ac..45267f7 100644 --- a/src/store/modules/jobRequests.js +++ b/src/store/modules/jobRequests.js @@ -65,14 +65,10 @@ const mutations = { deleteTransactJobactJob: (state, data) => { const date = new Date(data.year, data.month - 1, data.day) var job = state.transactJobs.find(a => { - console.log(a) - console.log(a.date, date) return a.date - date === 0 && a.to_user.username === data.username }) - console.log(job) var index = state.transactJobs.indexOf(job) - if (job) - state.transactJobs.splice(index, 1) + if (job) state.transactJobs.splice(index, 1) } } diff --git a/src/store/modules/jobs.js b/src/store/modules/jobs.js index 99a8cfc..15d6a32 100644 --- a/src/store/modules/jobs.js +++ b/src/store/modules/jobs.js @@ -204,10 +204,9 @@ const mutations = { const actions = { async getAllUsers({ commit, rootState, dispatch }) { try { - const response = await axios.get( - url.searchUser, - { headers: { Token: rootState.login.user.accessToken } } - ) + const response = await axios.get(url.searchUser, { + headers: { Token: rootState.login.user.accessToken } + }) commit('setAllUsers', { users: response.data, username: rootState.login.user.username @@ -271,7 +270,7 @@ const actions = { // eslint-disable-next-line no-unused-vars async deleteJob({ commit, rootState, dispatch }, data) { try { - const response = await axios.post( + await axios.post( url.user.deleteJob, { ...data }, { headers: { Token: rootState.login.user.accessToken } } @@ -281,7 +280,6 @@ const actions = { user: rootState.login.user, com: 'delete' }) - console.log(response) } catch (e) { if (e.response) if (e.response.status === 401) dispatch('logout', null, { root: true }) diff --git a/src/store/modules/login.js b/src/store/modules/login.js index a05bcd1..dbecdb1 100644 --- a/src/store/modules/login.js +++ b/src/store/modules/login.js @@ -11,7 +11,9 @@ const state = { group: null }, loggingIn: false, - loginError: null + loginError: null, + cookieNotification: true, + cookieAccepted: false } const mutations = { @@ -42,6 +44,12 @@ const mutations = { state.user.group = null state.user.firstname = null state.user.lastname = null + }, + setCookieNotification(state, value) { + state.cookieNotification = value + }, + setCookieAccepted(state, value) { + state.cookieAccepted = value } } @@ -53,6 +61,8 @@ const actions = { const cookieA = localStorage.getItem('cookie:accepted') if (!cookieA) { commit('loginStop', 'Sie müssen die Cookies akzeptieren!') + commit('setCookieNotification', true) + commit('setCookieAccepted', false) return } localStorage.setItem( @@ -93,12 +103,25 @@ const actions = { logout({ commit }) { localStorage.removeItem('user') localStorage.removeItem('cookie:accepted') - localStorage.removeItem('cookie:all') + commit('setCookieNotification', true) + commit('setCookieAccepted', false) commit('logout') router.push('/login') }, resetLoginError({ commit }) { commit('loginStop') + }, + acceptNotification({ commit }) { + localStorage.setItem('cookie:accepted', true) + commit('setCookieAccepted', true) + commit('setCookieNotification', false) + }, + disableNotification({ commit }) { + commit('setCookieNotification', false) + }, + getCookieAccepted({ commit }) { + var cookie = localStorage.getItem('cookie:accepted') + commit('setCookieAccepted', cookie) } } @@ -158,7 +181,11 @@ const getters = { }, isManagement: state => { try { - return state.user.group.includes('vorstand') || state.user.group.includes('gastro') || state.user.group.includes('moneymaster') + return ( + state.user.group.includes('vorstand') || + state.user.group.includes('gastro') || + state.user.group.includes('moneymaster') + ) } catch (e) { return false } @@ -168,6 +195,12 @@ const getters = { }, user: state => { return state.user + }, + cookieNotification: state => { + return state.cookieNotification + }, + cookieAccepted: state => { + return state.cookieAccepted } } diff --git a/src/store/modules/serviceManagement.js b/src/store/modules/serviceManagement.js index c78d7e9..51ad6db 100644 --- a/src/store/modules/serviceManagement.js +++ b/src/store/modules/serviceManagement.js @@ -200,10 +200,9 @@ const actions = { }, async getAllUsers({ commit, rootState, dispatch }) { try { - const response = await axios.get( - url.vorstand.sm.searchUser, - { headers: { Token: rootState.login.user.accessToken } } - ) + const response = await axios.get(url.vorstand.sm.searchUser, { + headers: { Token: rootState.login.user.accessToken } + }) commit('setAllUsers', response.data) } catch (e) { if (e.response) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 4d1e4d2..fdb3c9f 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -20,8 +20,6 @@ const mutations = { state.user = user let list = {} for (let creditList in user['creditList']) { - // eslint-disable-next-line no-console - console.log(creditList) let amount = mutations.createAmount(user['creditList'][creditList]) let credit = mutations.createCredit(user['creditList'][creditList]) let sum = mutations.createSum(credit, amount) @@ -30,8 +28,6 @@ const mutations = { state.user.creditList = list state.creditList = [] state.error = '' - // eslint-disable-next-line no-console - console.log(state.user) }, createAmount(creditList) { let amount = { @@ -136,7 +132,6 @@ const mutations = { }, setError(state, value) { state.error = value - console.log(state) }, createDays(state, date) { let days = [] @@ -194,7 +189,6 @@ const mutations = { amount: data.amount, date: new Date() }) - console.log(state.message) }, updateMessage: (state, data) => { var message = state.message.find(msg => { @@ -230,7 +224,6 @@ const actions = { { amount: amount }, { headers: { Token: rootState.login.user.accessToken } } ) - console.log(response.data) commit('setUser', response.data) commit('addMessage', { user: rootState.login.user, @@ -257,14 +250,12 @@ const actions = { { ...data }, { headers: { Token: rootState.login.user.accessToken } } ) - console.log(response.data) commit('setUser', response.data) commit('setError', '') } catch (e) { if (e.response) { if (e.response.status === 401) dispatch('logout', null, { root: true }) if (e.response.data) { - console.log(e.response.data) commit('setError', e.response.data.error) } } @@ -277,23 +268,19 @@ const actions = { async updateDay({ commit, rootState, dispatch }, data) { commit('setLoading', true) try { - console.log('hier bin ich') const response = await axios.post( url.user.job, { date: data.date.getTime() / 1000 }, { headers: { Token: rootState.login.user.accessToken } } ) - console.log(response.data) commit('updateDay', { ...response.data, date: data.date }) } catch (e) { if (e.response) { if (e.response.status === 401) dispatch('logout', null, { root: true }) if (e.response.data) { - console.log(e.response.data, data.date) commit('setError', e.response.data.error) } } - console.log(e) } commit('setLoading', false) }, @@ -307,7 +294,6 @@ const actions = { }, { headers: { Token: rootState.login.user.accessToken } } ) - console.log(response.data) commit('setUser', response.data) commit('updateMessage', { date: data.date, storno: true }) } catch (e) { @@ -316,7 +302,7 @@ const actions = { } commit('updateMessage', { date: data.date, loading: false }) }, - async getStatus({commit, rootState, dispatch }) { + async getStatus({ commit, rootState, dispatch }) { try { const response = await axios.get(url.user.getAllStatus, { headers: { Token: rootState.login.user.accessToken } diff --git a/src/store/modules/userManager.js b/src/store/modules/userManager.js index 6034485..6284a40 100644 --- a/src/store/modules/userManager.js +++ b/src/store/modules/userManager.js @@ -5,7 +5,7 @@ const state = { users: [], status: [], usersLoading: false, - statusLoading: false, + statusLoading: false } const mutations = { @@ -14,7 +14,6 @@ const mutations = { }, setStatus: (state, status) => { state.status = status - }, updateUser: (state, user) => { let exists = state.users.find(a => { diff --git a/src/views/contents/Cookies.vue b/src/views/contents/Cookies.vue deleted file mode 100644 index 965a56e..0000000 --- a/src/views/contents/Cookies.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - -