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

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

View File

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

View File

@ -1,6 +1,6 @@
//const main = 'https://192.168.5.128:5000/' //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 = '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 = {
@ -77,7 +77,8 @@ const url = {
}, },
barU: { barU: {
storno: main + 'bar/storno', storno: main + 'bar/storno',
lock: main + 'bar/lock' lock: main + 'bar/lock',
addUser: main + 'bar/addUser'
}, },
gastro: { gastro: {
setDrink: main + 'gastro/setDrink', setDrink: main + 'gastro/setDrink',

View File

@ -22,9 +22,9 @@ import ManagementNavigation from '@/components/vorstand/ManagementNavigation'
import GastroNavigation from '@/components/gastro/GastroNavigation' import GastroNavigation from '@/components/gastro/GastroNavigation'
import PriceListView from '@/views/contents/PriceListView' import PriceListView from '@/views/contents/PriceListView'
import UserManager from '@/components/vorstand/UserManager' import UserManager from '@/components/vorstand/UserManager'
import WorkgroupManagement from "@/components/vorstand/WorkgroupManagement"; import WorkgroupManagement from '@/components/vorstand/WorkgroupManagement'
import JobKindManager from "@/components/vorstand/JobKindManager"; import JobKindManager from '@/components/vorstand/JobKindManager'
import JobsRequest from "@/components/user/JobsRequest"; import JobsRequest from '@/components/user/JobsRequest'
Vue.use(VueRouter) Vue.use(VueRouter)

View File

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

View File

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

View File

@ -87,7 +87,8 @@ const mutations = {
item.worker.splice(item.worker.indexOf(worker), 1) item.worker.splice(item.worker.indexOf(worker), 1)
} }
}) })
})}) })
})
}, },
updateMonthLocked: (state, { locked, date, getters, from_me }) => { updateMonthLocked: (state, { locked, date, getters, from_me }) => {
let mop let mop
@ -151,10 +152,11 @@ const mutations = {
return item.id === day.jobkinddate[jobkind].job_kind.id return item.id === day.jobkinddate[jobkind].job_kind.id
}) })
day.jobkinddate[jobkind].worker = worker ? worker.worker : [] 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 }) => { setDayLoading: (state, { getters, date, value }) => {
let day = getters.getDayToMe(date) let day = getters.getDayToMe(date)
@ -162,7 +164,6 @@ const mutations = {
a.day.loading = value a.day.loading = value
console.log('day', value ? 'loading' : 'not loading', day, a.day.loading) console.log('day', value ? 'loading' : 'not loading', day, a.day.loading)
}) })
}, },
deleteJobInviteFromMe: (state, jobinvite) => { deleteJobInviteFromMe: (state, jobinvite) => {
var item = state.jobInvitesFromMe.find(item => { var item = state.jobInvitesFromMe.find(item => {
@ -201,9 +202,24 @@ const actions = {
item.day.date.month - 1, item.day.date.month - 1,
item.day.date.day item.day.date.day
) )
commit('updateMonthJobkind', { data: item.jobkinddate, date, getters, from_me: true }) commit('updateMonthJobkind', {
commit('updateMonthWorker', { workers: item.worker, date, getters, from_me: true }) data: item.jobkinddate,
commit('updateMonthLocked', { locked: item.day.locked, date, getters, from_me: true }) 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( const to_me = await axios.post(
url.user.getJobInvites, url.user.getJobInvites,
@ -229,9 +245,24 @@ const actions = {
item.day.date.month - 1, item.day.date.month - 1,
item.day.date.day item.day.date.day
) )
commit('updateMonthJobkind', { data: item.jobkinddate, date, getters, from_me: false }) commit('updateMonthJobkind', {
commit('updateMonthWorker', { workers: item.worker, date, getters, from_me: false }) data: item.jobkinddate,
commit('updateMonthLocked', { locked: item.day.locked, date, getters, from_me: false }) 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) commit('setJobInvitesLoading', false)
dispatch('getLifeTime', null, { root: true }) dispatch('getLifeTime', null, { root: true })
@ -269,7 +300,8 @@ const actions = {
commit('updateMonthWorker', { commit('updateMonthWorker', {
workers: [...response.data], workers: [...response.data],
date: new Date(data.year, data.month - 1, data.day), date: new Date(data.year, data.month - 1, data.day),
getters, from_me: false getters,
from_me: false
}) })
commit('setDayLoading', { date, getters, value: false }) commit('setDayLoading', { date, getters, value: false })
dispatch('getLifeTime', null, { root: true }) dispatch('getLifeTime', null, { root: true })
@ -323,7 +355,9 @@ const actions = {
async deleteJobInviteFromMe({ commit, rootState, dispatch }, data) { async deleteJobInviteFromMe({ commit, rootState, dispatch }, data) {
try { try {
commit('setJobInvitesLoading', true) 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('deleteJobInviteFromMe', data)
commit('setJobInvitesLoading', false) commit('setJobInvitesLoading', false)
} catch (e) { } catch (e) {

View File

@ -296,7 +296,11 @@ const actions = {
const response = await axios.post(url.user.setJobRequests, data, { const response = await axios.post(url.user.setJobRequests, data, {
headers: { Token: rootState.login.user.accessToken } 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('updateJobRequestToMe', response.data)
commit('setJobRequestsLoading', false) commit('setJobRequestsLoading', false)
dispatch('getLifeTime', null, { root: true }) dispatch('getLifeTime', null, { root: true })

View File

@ -174,12 +174,20 @@ const mutations = {
filteredWorkers.push(item.user) filteredWorkers.push(item.user)
}) })
filteredWorkers.forEach(worker => { 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.push(worker)
} }
}) })
item.worker.forEach(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) item.worker.splice(item.worker.indexOf(worker), 1)
} }
}) })
@ -354,7 +362,6 @@ const actions = {
var date = new Date(data.year, data.month - 1, data.day) var date = new Date(data.year, data.month - 1, data.day)
commit('setDayLoading', { date, getters }) commit('setDayLoading', { date, getters })
try { try {
const response = await axios.post( const response = await axios.post(
url.user.addJob, url.user.addJob,
{ ...data }, { ...data },

View File

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

View File

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