fix User werden nun auch in Einladungen oder Abgeben in JobRequest angezeigt

This commit is contained in:
Tim Gröger 2020-06-02 23:41:36 +02:00
parent 33028050fc
commit 2401b949ce
2 changed files with 66 additions and 31 deletions

View File

@ -1,9 +1,6 @@
<template>
<div v-if="day">
<v-card
:color="color(day)"
:max-width="long ? '' : '20em'"
>
<v-card :color="color(day)" :max-width="long ? '' : '20em'">
<v-card-title v-if="day.date" class="subtitle-1 font-weight-bold">
{{ name }} den {{ day.date.getDate() }}.{{ day.date.getMonth() + 1 }}.{{
day.date.getFullYear()
@ -76,7 +73,7 @@
</v-list-item>
</v-list>
</v-menu>
<v-menu v-model="menu_invite" :close-on-content-click="false">
<v-menu v-model="menu_invite" :close-on-content-click="false" offset-y>
<template v-slot:activator="{ on }">
<v-btn
v-show="
@ -120,8 +117,9 @@
item-value="id"
chips
deletable-chips
:items="filteredDBUsers"
></v-autocomplete>
:items="filteredDBUsers()"
>
</v-autocomplete>
</v-card-text>
<v-card-actions>
<v-spacer />
@ -136,9 +134,42 @@
</v-card-actions>
</v-card>
</v-menu>
<v-btn v-show="!day.locked && userInWorker()" text @click="deletingJob()">Austragen</v-btn>
<v-btn v-show="day.locked && userInWorker()" text>Abgeben</v-btn>
<v-menu v-model="menu_request" :close-on-content-click="false" offset-y>
<template v-slot:activator="{ on }">
<v-btn v-show="day.locked && userInWorker()" text v-on="on">
Abgeben
</v-btn>
</template>
<v-card>
<v-card-text>
<v-autocomplete
v-model="job_invites"
label="Einladungen senden an"
return-object
multiple
filled
:item-text="item => item.firstname + ' ' + item.lastname"
item-value="id"
chips
deletable-chips
:items="filteredDBUsers()"
>
</v-autocomplete>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text>
Anfragen
</v-btn>
</v-card-actions>
</v-card>
</v-menu>
<v-btn
v-show="!day.locked && userInWorker()"
text
@click="deletingJob()"
>Austragen</v-btn
>
</v-card-actions>
</v-card>
</div>
@ -161,6 +192,7 @@ export default {
requestUser: null,
menu: false,
menu_invite: false,
menu_request: false,
update: 0,
job_invites: []
}
@ -253,6 +285,26 @@ export default {
day: sendData.on_date.getDate()
}
this.deleteInvite(sendData)
},
filteredDBUsers() {
var retVal = this.allUsers.filter(user => {
var test = this.day.jobkinddate.find(item => {
return item.worker.find(workeritem => {
return workeritem.id === user.id
})
})
return !test
})
retVal = retVal.filter(user => {
let getedDay = this.getDay(this.day.date)
let test = getedDay
? getedDay.find(day => {
return day.to_user.id === user.id
})
: false
return !test
})
return retVal
}
},
computed: {
@ -286,26 +338,7 @@ export default {
})
return retVal
},
filteredDBUsers() {
var retVal = this.allUsers.filter(user => {
var test = this.day.jobkinddate.find(item => {
return item.worker.find(workeritem => {
return workeritem.id === user.id
})
})
return !test
})
retVal = retVal.filter(user => {
let getedDay = this.getDay(this.day.date)
let test = getedDay
? getedDay.find(day => {
return day.to_user.id === user.id
})
: false
return !test
})
return retVal
},
name() {
const name = this.day.date.getDay()
if (name === 0) return 'Sonntag'

View File

@ -30,7 +30,8 @@ export default {
},
methods: {
...mapActions({
getUser: 'user/getUser'
getUser: 'user/getUser',
getDBUsers: 'usermanager/getUsers',
})
},
computed: {
@ -41,6 +42,7 @@ export default {
},
created() {
this.getUser()
this.getDBUsers()
},
watch: {
$route() {