baransicht suche gefixed ##280

This commit is contained in:
Tim Gröger 2020-06-05 22:50:10 +02:00
parent b812b86b6a
commit ccdc3004aa
12 changed files with 182 additions and 101 deletions

View File

@ -1,4 +1,4 @@
module.exports = {
singleQuote: true,
semi: false
}
singleQuote: true,
semi: false
}

View File

@ -6,9 +6,8 @@
>Transaktion ist länger als 1 Minute her!</v-card-title
>
<v-card-text>
Da die Transaktion länger als 1 Minuter her ist, kann eine
Stornierung nicht durchgeführt werden. Wende dich bitte an den
Finanzer.
Da die Transaktion länger als 1 Minuter her ist, kann eine Stornierung
nicht durchgeführt werden. Wende dich bitte an den Finanzer.
</v-card-text>
<v-card-actions>
<v-spacer />
@ -39,7 +38,9 @@
<v-list-item-content>
<v-progress-linear indeterminate v-if="message.loading" />
<v-list-item-title>{{ now(message.date) }}</v-list-item-title>
<v-list-item-subtitle>{{ createMessage(message) }}</v-list-item-subtitle>
<v-list-item-subtitle>{{
createMessage(message)
}}</v-list-item-subtitle>
<v-list-item-subtitle class="red--text" v-if="message.storno"
>STORNIERT!!!</v-list-item-subtitle
>
@ -61,7 +62,8 @@
>
</v-card-title>
<v-card-subtitle v-if="user.limit + user.amount > 0">
Nur noch {{ ((user.limit + user.amount)/100).toFixed(2)}} übrig!!
Nur noch {{ ((user.limit + user.amount) / 100).toFixed(2) }}
übrig!!
</v-card-subtitle>
<v-card-text>
<v-row>
@ -262,10 +264,17 @@ export default {
isFiltered(user) {
try {
var filters = this.filter.split(' ')
for (var filter in filters) {
if (filters.length === 1) {
if (
user.firstname.toLowerCase().includes(filters[filter].toLowerCase()) ||
user.lastname.toLowerCase().includes(filters[filter].toLowerCase())
user.firstname.toLowerCase().includes(filters[0].toLowerCase()) ||
user.lastname.toLowerCase().includes(filters[0].toLowerCase())
) {
return true
}
} else if (filters.length > 1) {
if (
user.firstname.toLowerCase().includes(filters[0].toLowerCase()) &&
user.lastname.toLowerCase().includes(filters[1].toLowerCase())
) {
return true
}
@ -301,22 +310,22 @@ export default {
var text = ''
if (message.error) {
text =
'Konnte ' +
(message.amount / 100).toFixed(2) +
'€ zu ' +
message.user.firstname +
' ' +
message.user.lastname +
' hinzufügen.'
'Konnte ' +
(message.amount / 100).toFixed(2) +
'€ zu ' +
message.user.firstname +
' ' +
message.user.lastname +
' hinzufügen.'
} else {
text =
'' +
(message.amount / 100).toFixed(2) +
'€ wurde zu ' +
message.user.firstname +
' ' +
message.user.lastname +
' hinzugefügt.'
'' +
(message.amount / 100).toFixed(2) +
'€ wurde zu ' +
message.user.firstname +
' ' +
message.user.lastname +
' hinzugefügt.'
}
return text
}

View File

@ -14,6 +14,7 @@
full-width
:loading="loading"
:search-input.sync="filter"
clearable
>
<template v-slot:prepend-inner>
<v-icon>{{ search_person }}</v-icon>
@ -79,7 +80,6 @@ export default {
}),
addUser() {
this.addCreditList(this.user)
this.user = null
},
clickMenu() {
if (this.menu) this.deactivateMenu()

View File

@ -1,6 +1,6 @@
//const main = 'https://192.168.5.128:5000/'
//const main = 'http://localhost:5000/'
const main = 'http://192.168.5.118:5000/'
const main = 'http://localhost:5000/'
//const main = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/'
const url = {
@ -77,7 +77,8 @@ const url = {
},
barU: {
storno: main + 'bar/storno',
lock: main + 'bar/lock'
lock: main + 'bar/lock',
addUser: main + 'bar/addUser'
},
gastro: {
setDrink: main + 'gastro/setDrink',

View File

@ -22,9 +22,9 @@ 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 WorkgroupManagement from "@/components/vorstand/WorkgroupManagement";
import JobKindManager from "@/components/vorstand/JobKindManager";
import JobsRequest from "@/components/user/JobsRequest";
import WorkgroupManagement from '@/components/vorstand/WorkgroupManagement'
import JobKindManager from '@/components/vorstand/JobKindManager'
import JobsRequest from '@/components/user/JobsRequest'
Vue.use(VueRouter)

View File

@ -10,8 +10,8 @@ import priceList from '@/store/modules/pricelist'
import usermanager from '@/store/modules/userManager'
import wm from '@/store/modules/workgroupManagement'
import jkm from '@/store/modules/jobkindManager'
import jobInvites from "@/store/modules/jobInvites";
import jobRequests from "@/store/modules/jobRequests";
import jobInvites from '@/store/modules/jobInvites'
import jobRequests from '@/store/modules/jobRequests'
Vue.use(Vuex)

View File

@ -14,12 +14,14 @@ const state = {
const mutations = {
setAllUsers: (state, users) => {
console.log(users)
state.allUsers = []
state.allUsers = users
for (let i = 0; i < state.allUsers.length; i++) {
state.allUsers[i].fullName =
state.allUsers[i].firstname + ' ' + state.allUsers[i].lastname
}
console.log(state.allUsers)
},
setUsers: (state, users) => {
for (let user in users) {
@ -86,10 +88,11 @@ const mutations = {
message.amount = message.amount + data.amount
message.visible = true
message.date = new Date()
message.timeout = setTimeout(() => {message.visible = false}, 5000)
message.timeout = setTimeout(() => {
message.visible = false
}, 5000)
return
}
else {
} else {
message.visible = false
}
}
@ -102,7 +105,9 @@ const mutations = {
visible: true,
amount: data.amount,
date: new Date(),
timeout: setTimeout(() => {message2.visible = false}, 5000)
timeout: setTimeout(() => {
message2.visible = false
}, 5000)
}
state.messages.unshift(message2)
},

View File

@ -71,23 +71,24 @@ const mutations = {
})
filteredWorkers.forEach(worker => {
if (
!item.worker.find(a => {
return a.id === worker.id
})
!item.worker.find(a => {
return a.id === worker.id
})
) {
item.worker.push(worker)
}
})
item.worker.forEach(worker => {
if (
!filteredWorkers.find(a => {
return a.id === worker.id
})
!filteredWorkers.find(a => {
return a.id === worker.id
})
) {
item.worker.splice(item.worker.indexOf(worker), 1)
}
})
})})
})
})
},
updateMonthLocked: (state, { locked, date, getters, from_me }) => {
let mop
@ -151,10 +152,11 @@ const mutations = {
return item.id === day.jobkinddate[jobkind].job_kind.id
})
day.jobkinddate[jobkind].worker = worker ? worker.worker : []
day.jobkinddate[jobkind].backupWorker = worker ? worker.backupWorker : []
day.jobkinddate[jobkind].backupWorker = worker
? worker.backupWorker
: []
}
})
},
setDayLoading: (state, { getters, date, value }) => {
let day = getters.getDayToMe(date)
@ -162,7 +164,6 @@ const mutations = {
a.day.loading = value
console.log('day', value ? 'loading' : 'not loading', day, a.day.loading)
})
},
deleteJobInviteFromMe: (state, jobinvite) => {
var item = state.jobInvitesFromMe.find(item => {
@ -190,20 +191,35 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
const workers_from_me = await axios.post(
url.user.getJobOnDates,
from_me.data,
{ headers: { Token: rootState.login.user.accessToken } }
url.user.getJobOnDates,
from_me.data,
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setJobInvitesFromMe', from_me.data)
workers_from_me.data.forEach(item => {
var date = new Date(
item.day.date.year,
item.day.date.month - 1,
item.day.date.day
item.day.date.year,
item.day.date.month - 1,
item.day.date.day
)
commit('updateMonthJobkind', { data: item.jobkinddate, date, getters, from_me: true })
commit('updateMonthWorker', { workers: item.worker, date, getters, from_me: true })
commit('updateMonthLocked', { locked: item.day.locked, date, getters, from_me: true })
commit('updateMonthJobkind', {
data: item.jobkinddate,
date,
getters,
from_me: true
})
commit('updateMonthWorker', {
workers: item.worker,
date,
getters,
from_me: true
})
commit('updateMonthLocked', {
locked: item.day.locked,
date,
getters,
from_me: true
})
})
const to_me = await axios.post(
url.user.getJobInvites,
@ -229,9 +245,24 @@ const actions = {
item.day.date.month - 1,
item.day.date.day
)
commit('updateMonthJobkind', { data: item.jobkinddate, date, getters, from_me: false })
commit('updateMonthWorker', { workers: item.worker, date, getters, from_me: false })
commit('updateMonthLocked', { locked: item.day.locked, date, getters, from_me: false })
commit('updateMonthJobkind', {
data: item.jobkinddate,
date,
getters,
from_me: false
})
commit('updateMonthWorker', {
workers: item.worker,
date,
getters,
from_me: false
})
commit('updateMonthLocked', {
locked: item.day.locked,
date,
getters,
from_me: false
})
})
commit('setJobInvitesLoading', false)
dispatch('getLifeTime', null, { root: true })
@ -269,7 +300,8 @@ const actions = {
commit('updateMonthWorker', {
workers: [...response.data],
date: new Date(data.year, data.month - 1, data.day),
getters, from_me: false
getters,
from_me: false
})
commit('setDayLoading', { date, getters, value: false })
dispatch('getLifeTime', null, { root: true })
@ -281,15 +313,15 @@ const actions = {
},
async deleteJob({ commit, rootState, dispatch, getters }, data) {
var date = new Date(data.year, data.month - 1, data.day)
commit('setDayLoading', {date, getters, value: true})
commit('setDayLoading', { date, getters, value: true })
commit('setJobInvitesLoading', true)
try {
const response = await axios.post(
url.user.deleteJob,
{ ...data },
{
headers: { Token: rootState.login.user.accessToken }
}
url.user.deleteJob,
{ ...data },
{
headers: { Token: rootState.login.user.accessToken }
}
)
console.log(response.data)
commit('updateMonthWorker', {
@ -297,7 +329,7 @@ const actions = {
date: new Date(data.year, data.month - 1, data.day),
getters
})
commit('setDayLoading', {date, getters, value: false})
commit('setDayLoading', { date, getters, value: false })
dispatch('getLifeTime', null, { root: true })
commit('setJobInvitesLoading', false)
} catch (e) {
@ -320,10 +352,12 @@ const actions = {
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async deleteJobInviteFromMe({ commit, rootState, dispatch}, data) {
async deleteJobInviteFromMe({ commit, rootState, dispatch }, data) {
try {
commit('setJobInvitesLoading', true)
await axios.post(url.user.deletJobInvite, data, {headers: {Token: rootState.login.user.accessToken}})
await axios.post(url.user.deletJobInvite, data, {
headers: { Token: rootState.login.user.accessToken }
})
commit('deleteJobInviteFromMe', data)
commit('setJobInvitesLoading', false)
} catch (e) {

View File

@ -296,7 +296,11 @@ const actions = {
const response = await axios.post(url.user.setJobRequests, data, {
headers: { Token: rootState.login.user.accessToken }
})
response.data.on_date = new Date(response.data.on_date.year, response.data.on_date.month - 1, response.data.on_date.day)
response.data.on_date = new Date(
response.data.on_date.year,
response.data.on_date.month - 1,
response.data.on_date.day
)
commit('updateJobRequestToMe', response.data)
commit('setJobRequestsLoading', false)
dispatch('getLifeTime', null, { root: true })

View File

@ -174,12 +174,20 @@ const mutations = {
filteredWorkers.push(item.user)
})
filteredWorkers.forEach(worker => {
if (!item.worker.find(a => {return a.id === worker.id})) {
if (
!item.worker.find(a => {
return a.id === worker.id
})
) {
item.worker.push(worker)
}
})
item.worker.forEach(worker => {
if (!filteredWorkers.find(a => {return a.id === worker.id})) {
if (
!filteredWorkers.find(a => {
return a.id === worker.id
})
) {
item.worker.splice(item.worker.indexOf(worker), 1)
}
})
@ -318,15 +326,15 @@ const actions = {
commit('setAllDayLoading')
try {
const response = await axios.post(
url.vorstand.sm.getUsers,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
url.vorstand.sm.getUsers,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
for (var day in response.data) {
var date = new Date(
response.data[day].day.date.year,
response.data[day].day.date.month - 1,
response.data[day].day.date.day
response.data[day].day.date.year,
response.data[day].day.date.month - 1,
response.data[day].day.date.day
)
commit('updateMonthJobkind', {
data: [...response.data[day].jobkinddate],
@ -352,9 +360,8 @@ const actions = {
},
async addJob({ commit, rootState, dispatch, getters }, data) {
var date = new Date(data.year, data.month - 1, data.day)
commit('setDayLoading', {date, getters})
commit('setDayLoading', { date, getters })
try {
const response = await axios.post(
url.user.addJob,
{ ...data },
@ -367,7 +374,7 @@ const actions = {
date: new Date(data.year, data.month - 1, data.day),
getters
})
commit('setDayNotLoading', {date, getters})
commit('setDayNotLoading', { date, getters })
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
@ -377,14 +384,14 @@ const actions = {
// eslint-disable-next-line no-unused-vars
async deleteJob({ commit, rootState, dispatch, getters }, data) {
var date = new Date(data.year, data.month - 1, data.day)
commit('setDayLoading', {date, getters})
commit('setDayLoading', { date, getters })
try {
const response = await axios.post(
url.user.deleteJob,
{ ...data },
{
headers: { Token: rootState.login.user.accessToken }
}
url.user.deleteJob,
{ ...data },
{
headers: { Token: rootState.login.user.accessToken }
}
)
console.log(response.data)
commit('updateMonthWorker', {
@ -392,7 +399,7 @@ const actions = {
date: new Date(data.year, data.month - 1, data.day),
getters
})
commit('setDayNotLoading', {date, getters})
commit('setDayNotLoading', { date, getters })
dispatch('getLifeTime', null, { root: true })
} catch (e) {
console.log(e)

View File

@ -173,13 +173,21 @@ const mutations = {
filteredWorkers.push(item.user)
})
filteredWorkers.forEach(worker => {
if (!item.worker.find(a => {return a.id === worker.id})) {
if (
!item.worker.find(a => {
return a.id === worker.id
})
) {
item.worker.push(worker)
item.backupWorker.push(worker)
}
})
item.worker.forEach(worker => {
if (!filteredWorkers.find(a => {return a.id === worker.id})) {
if (
!filteredWorkers.find(a => {
return a.id === worker.id
})
) {
item.worker.splice(item.worker.indexOf(worker), 1)
}
})
@ -233,7 +241,6 @@ const mutations = {
day.jobkinddate[jobkind].worker = worker ? worker.worker : []
day.jobkinddate[jobkind].backupWorker = worker ? worker.backupWorker : []
}
},
setAllDayLoading: state => {
for (let week = 0; week < state.month.length; week++) {
@ -351,8 +358,16 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
console.log(response.data)
let date = new Date(response.data.date.year, response.data.date.month - 1, response.data.date.day)
commit('updateMonthLocked', { locked: response.data.locked, date, getters })
let date = new Date(
response.data.date.year,
response.data.date.month - 1,
response.data.date.day
)
commit('updateMonthLocked', {
locked: response.data.locked,
date,
getters
})
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)

View File

@ -172,10 +172,11 @@ const mutations = {
message.amount = message.amount + data.amount
message.visible = true
message.date = new Date()
message.timeout = setTimeout(() => {message.visible = false}, 300000)
message.timeout = setTimeout(() => {
message.visible = false
}, 300000)
return
}
else {
} else {
message.visible = false
}
}
@ -188,10 +189,11 @@ const mutations = {
visible: true,
amount: data.amount,
date: new Date(),
timeout: setTimeout(() => {message2.visible = false}, 300000)
timeout: setTimeout(() => {
message2.visible = false
}, 300000)
}
state.messages.unshift(message2)
},
updateMessage: (state, data) => {
var message = state.messages.find(msg => {
@ -324,7 +326,9 @@ const actions = {
},
async getTokens({ commit, rootState, dispatch }) {
try {
const response = await axios.get(url.user.getAccessTokens, {headers: {Token: rootState.login.user.accessToken}})
const response = await axios.get(url.user.getAccessTokens, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setTokens', response.data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
@ -334,7 +338,9 @@ const actions = {
},
async deleteToken({ commit, rootState, dispatch }, token) {
try {
const response = await axios.post(url.user.getAccessTokens, token,{headers: {Token: rootState.login.user.accessToken}})
const response = await axios.post(url.user.getAccessTokens, token, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setTokens', response.data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {