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> <template>
<div v-if="day"> <div v-if="day">
<v-card <v-card :color="color(day)" :max-width="long ? '' : '20em'">
:color="color(day)"
:max-width="long ? '' : '20em'"
>
<v-card-title v-if="day.date" class="subtitle-1 font-weight-bold"> <v-card-title v-if="day.date" class="subtitle-1 font-weight-bold">
{{ name }} den {{ day.date.getDate() }}.{{ day.date.getMonth() + 1 }}.{{ {{ name }} den {{ day.date.getDate() }}.{{ day.date.getMonth() + 1 }}.{{
day.date.getFullYear() day.date.getFullYear()
@ -76,7 +73,7 @@
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-menu> </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 }"> <template v-slot:activator="{ on }">
<v-btn <v-btn
v-show=" v-show="
@ -120,8 +117,9 @@
item-value="id" item-value="id"
chips chips
deletable-chips deletable-chips
:items="filteredDBUsers" :items="filteredDBUsers()"
></v-autocomplete> >
</v-autocomplete>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
@ -136,9 +134,42 @@
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-menu> </v-menu>
<v-btn v-show="!day.locked && userInWorker()" text @click="deletingJob()">Austragen</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>Abgeben</v-btn> <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-actions>
</v-card> </v-card>
</div> </div>
@ -161,6 +192,7 @@ export default {
requestUser: null, requestUser: null,
menu: false, menu: false,
menu_invite: false, menu_invite: false,
menu_request: false,
update: 0, update: 0,
job_invites: [] job_invites: []
} }
@ -253,6 +285,26 @@ export default {
day: sendData.on_date.getDate() day: sendData.on_date.getDate()
} }
this.deleteInvite(sendData) 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: { computed: {
@ -286,26 +338,7 @@ export default {
}) })
return retVal 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() { name() {
const name = this.day.date.getDay() const name = this.day.date.getDay()
if (name === 0) return 'Sonntag' if (name === 0) return 'Sonntag'

View File

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