fixed some bugs

This commit is contained in:
Tim Gröger 2020-03-05 21:16:47 +01:00
parent a82d3bf4b6
commit b2428cb5b4
22 changed files with 127 additions and 152 deletions

19
package-lock.json generated
View File

@ -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",

View File

@ -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"

View File

@ -6,30 +6,17 @@
<span class="px-4"
>&copy; {{ new Date().getFullYear() }} Studentenclub Wu 5 e.v.</span
>
<CookieLaw>
<template slot-scope="props">
<v-label>Diese Webseite benutzt Cookies in der Art von Local Storage. Dabei werden Daten auf ihrem Local Storage
gespeichert.
Diese Daten werden benutzt, damit Sie sich Anmelden können und sich gegen die REST-API hinter dieser
Webseite Authentifizieren können.
Dabei werden ihr Nutzername, ein AccessToken und ihre Gruppen (welche ihre Rechte sind) gespeichert. Diese
Daten sind Notwendig. Sollten Sie diese nicht Aktzeptieren, können Sie sich nicht Anmelden.</v-label>
<v-row>
<v-btn text color="primary" @click="props.accept">Akzeptieren</v-btn>
<v-btn text color="alert" @click="props.close">Nicht Aktzeptieren</v-btn>
</v-row>
</template>
</CookieLaw>
<CookieNotification />
</v-footer>
</v-app>
</template>
<script>
import TitleBar from './components/TitleBar'
import CookieLaw from 'vue-cookie-law'
import CookieNotification from "./components/CookieNotification";
export default {
name: 'App',
components: { TitleBar, CookieLaw },
components: {CookieNotification, TitleBar },
data: () => ({
//
})

View File

@ -0,0 +1,48 @@
<template>
<v-bottom-sheet persistent v-model="show" hide-overlay>
<v-card>
<v-card-title>
Cookie und Local Storage Hinweis
</v-card-title>
<v-card-text>
Diese Webseite benutzt den Local Storage. Dabei werden Daten in ihm
gespeichert, welche notwendig sind um sich einzuloggen und eingeloggt zu
bleiben. Außerdem sind diese Daten notwendig um mit dem Server zu
kommunizieren. Dabei wird ein Key 'user' angelegt, in welchem ein
Accesstoken, Benutzername, sowie der Name des Benutzers und deren Rechte
gespeichert. Dazu kommt ein Key 'cookie:accepted', falls sie diesem
zustimmen. Diese Daten bleiben solange erhalten bis Sie sich ausloggen
oder der Accesstoken abgelaufen ist und Sie ausgeloggt werden.
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text @click="disableNotification()">Ablehnen</v-btn>
<v-btn text color="primary" @click="acceptNotification()">Akzeptieren</v-btn>
</v-card-actions>
</v-card>
</v-bottom-sheet>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'CookieNotification',
methods: {
...mapActions(['acceptNotification', 'disableNotification', 'getCookieAccepted'])
},
created() {
this.getCookieAccepted()
},
computed: {
...mapGetters({
model: 'cookieNotification',
cookie: 'cookieAccepted'
}),
show() {
return !this.cookie ? this.model : false
}
}
}
</script>
<style scoped></style>

View File

@ -262,7 +262,6 @@ export default {
}, 300)
},
storno(message) {
console.log('storno')
if (!message.error) {
if (!this.under5minutes(message.date)) this.dialog = true
else {

View File

@ -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)
}
}

View File

@ -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()

View File

@ -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 {

View File

@ -31,7 +31,7 @@
</div>
</v-expand-transition>
</v-card-text>
<div v-if="userInWorker">
<div v-if="userInWorker && day.locked">
<v-card-actions class="text--secondary">
<v-autocomplete
return-object
@ -74,6 +74,7 @@
</div>
<v-spacer />
<v-btn
text
v-if="!day.locked &&
!day.loading &&
day.worker.length < 2 &&
@ -126,9 +127,6 @@ export default {
deleteJob: 'jobs/deleteJob',
transactJob: 'jobs/transactJob'
}),
test(event) {
console.log('blur', event)
},
send() {
this.transactJob({
user: this.requestUser.username,
@ -182,16 +180,12 @@ export default {
return users
},
canDelete() {
console.log(this.day.date)
console.log(this.transactJobs)
var transactJob = this.transactJobs.filter(a => {
return a.date - this.day.date === 0
})
console.log('filter', transactJob)
var test = transactJob.find(a => {
return a.accepted && a.answerd
})
console.log('find', test)
return test
}
},

View File

@ -57,7 +57,7 @@
<v-card-actions v-if="!day.loading">
<v-chip class="text-uppercase" :color="lockedColor">{{ lockedText }}</v-chip>
<v-spacer />
<v-btn @click="lock">{{lockedTextBtn}}</v-btn>
<v-btn text @click="lock">{{lockedTextBtn}}</v-btn>
</v-card-actions>
</v-card>
</div>
@ -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)
}
}
}

View File

@ -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) {

View File

@ -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',

View File

@ -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',

View File

@ -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)

View File

@ -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 })

View File

@ -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)
}
}

View File

@ -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 })

View File

@ -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
}
}

View File

@ -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)

View File

@ -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 }

View File

@ -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 => {

View File

@ -1,22 +0,0 @@
<template>
<v-content>
<v-container>
<v-card>
<v-card-title>Informationen zu Cookies</v-card-title>
<v-card-text>
Cookies sind dafür
</v-card-text>
</v-card>
</v-container>
</v-content>
</template>
<script>
export default {
name: "Cookies"
}
</script>
<style scoped>
</style>