diensteinladung und übertragung fertig. User können leute einladen, sich austragen, jobs abgeben usw.

user können sehen, wenn es neue nachrichten gibt und sehen ob die einladung bzw. anfrage gesehen wurde.
This commit is contained in:
Tim Gröger 2020-06-04 13:19:48 +02:00
parent 4d6db01bd3
commit ba44231e4f
4 changed files with 181 additions and 52 deletions

View File

@ -16,8 +16,10 @@
{{ jobInvite.on_date.getDate() }}.{{ {{ jobInvite.on_date.getDate() }}.{{
jobInvite.on_date.getMonth() + 1 jobInvite.on_date.getMonth() + 1
}}.{{ jobInvite.on_date.getFullYear() }} von }}.{{ jobInvite.on_date.getFullYear() }} von
<v-badge dot :value="!jobInvite.watched" color="red">
{{ jobInvite.from_user.firstname }} {{ jobInvite.from_user.firstname }}
{{ jobInvite.from_user.lastname }} {{ jobInvite.from_user.lastname }}
</v-badge>
</div> </div>
<v-row class="text-right" style="margin-right: 5px"> <v-row class="text-right" style="margin-right: 5px">
<v-col> <v-col>
@ -49,6 +51,72 @@
:loading="jobInvite.day.loading" :loading="jobInvite.day.loading"
@addingJob="addingJob(jobInvite, $event)" @addingJob="addingJob(jobInvite, $event)"
@deletingJob="deletingJob(jobInvite, $event)" @deletingJob="deletingJob(jobInvite, $event)"
@sendInvites="setJobInvites"
@sendRequests="setJobRequests"
@deleteJobInvite="deleteInvite"
@deleteJobRequest="deleteRequest"
/>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-card-text>
</v-card>
<v-card tile :loading="jobInvitesLoading">
<v-card-title>
Versendete Einladungen
</v-card-title>
<v-card-text>
<v-expansion-panels>
<v-expansion-panel
v-for="jobInvite in jobInvitesFromMe"
:key="jobInvite.id"
@click.once="seenJobIvnite(jobInvite)"
>
<v-expansion-panel-header>
<div>
{{ jobInvite.on_date.getDate() }}.{{
jobInvite.on_date.getMonth() + 1
}}.{{ jobInvite.on_date.getFullYear() }} an
<v-badge :value="jobInvite.watched" icon="mdi-eye" color="grey" inline>
{{ jobInvite.to_user.firstname }}
{{ jobInvite.to_user.lastname }}
</v-badge>
</div>
<v-row class="text-right" style="margin-right: 5px">
<v-col>
<v-progress-circular
indeterminate
v-if="jobInvitesLoading"
></v-progress-circular>
</v-col>
<v-col>
<v-icon color="green" v-show="userInWorker(jobInvite)">
{{ check }}
</v-icon>
</v-col>
</v-row>
</v-expansion-panel-header>
<v-expansion-panel-content :eager="true">
<v-row class="text-right">
<v-col>
<v-btn icon @click="deleteInvite(jobInvite)">
<v-icon>
{{trashCan}}
</v-icon>
</v-btn>
</v-col>
</v-row>
<Day
:day="jobInvite.day"
:long="true"
:loading="jobInvite.day.loading"
@addingJob="addingJob(jobInvite, $event)"
@deletingJob="deletingJob(jobInvite, $event)"
@sendInvites="setJobInvites"
@sendRequests="setJobRequests"
@deleteJobInvite="deleteInvite"
@deleteJobRequest="deleteRequest"
/> />
</v-expansion-panel-content> </v-expansion-panel-content>
</v-expansion-panel> </v-expansion-panel>
@ -60,7 +128,7 @@
<script> <script>
import { mapActions, mapGetters } from 'vuex' import { mapActions, mapGetters } from 'vuex'
import { mdiEyeOff, mdiEyeCheck, mdiCheck } from '@mdi/js' import { mdiEyeOff, mdiEyeCheck, mdiCheck, mdiTrashCan } from '@mdi/js'
import Day from '@/components/user/Jobs/Day' import Day from '@/components/user/Jobs/Day'
export default { export default {
name: 'JobInvites', name: 'JobInvites',
@ -70,6 +138,7 @@ export default {
notSeen: mdiEyeOff, notSeen: mdiEyeOff,
seen: mdiEyeCheck, seen: mdiEyeCheck,
check: mdiCheck, check: mdiCheck,
trashCan: mdiTrashCan,
showNotSeen: false, showNotSeen: false,
showSeen: false, showSeen: false,
update: 0 update: 0
@ -79,8 +148,12 @@ export default {
...mapActions({ ...mapActions({
getJobInvites: 'jobInvites/getJobInvites', getJobInvites: 'jobInvites/getJobInvites',
addJob: 'jobInvites/addJob', addJob: 'jobInvites/addJob',
setJobInvites: 'jobInvites/setJobInvites',
updateJobInviteToMe: 'jobInvites/updateJobInviteToMe', updateJobInviteToMe: 'jobInvites/updateJobInviteToMe',
deleteJob: 'jobInvites/deleteJob' deleteJob: 'jobInvites/deleteJob',
setJobRequests: 'jobRequests/setJobRequests',
deleteInvite: 'jobInvites/deleteJobInviteFromMe',
deleteRequest: 'jobRequests/deleteJobRequestFromMe'
}), }),
forceRender() { forceRender() {
setTimeout(() => { setTimeout(() => {
@ -110,7 +183,7 @@ export default {
userInWorker(jobinvite) { userInWorker(jobinvite) {
var jobkinddate = jobinvite.day.jobkinddate.find(item => { var jobkinddate = jobinvite.day.jobkinddate.find(item => {
return item.worker.find(workeritem => { return item.worker.find(workeritem => {
return workeritem.id === this.activeUser.id return workeritem.id === jobinvite.to_user.id
}) })
}) })
return !!jobkinddate return !!jobkinddate

View File

@ -15,8 +15,10 @@
{{ jobrequest.on_date.getDate() }}.{{ {{ jobrequest.on_date.getDate() }}.{{
jobrequest.on_date.getMonth() + 1 jobrequest.on_date.getMonth() + 1
}}.{{ jobrequest.on_date.getFullYear() }} von }}.{{ jobrequest.on_date.getFullYear() }} von
<v-badge dot :value="!jobrequest.watched" color="red">
{{ jobrequest.from_user.firstname }} {{ jobrequest.from_user.firstname }}
{{ jobrequest.from_user.lastname }} {{ jobrequest.from_user.lastname }}
</v-badge>
</div> </div>
<v-row class="text-right" style="margin-right: 5px"> <v-row class="text-right" style="margin-right: 5px">
<v-col> <v-col>
@ -46,15 +48,23 @@
:day="jobrequest.day" :day="jobrequest.day"
:long="true" :long="true"
@sendRequests="sendingJobRequests(jobrequest, $event)" @sendRequests="sendingJobRequests(jobrequest, $event)"
@addingJob="addJob"
@deletingJob="deleteJob"
@sendInvites="setJobInvites"
@deleteJobInvite="deleteInvite"
@deleteJobRequest="deleteJobRequestFromMe"
/> />
<v-row class="text-right"> <v-row class="text-right">
<v-col> <v-col>
<v-btn <v-btn
v-show="!jobrequest.accepted" v-show="!jobrequest.answered"
text text
@click="updatingAcceptedJobRequest(jobrequest)" @click="updatingAcceptedJobRequest(jobrequest)"
>Annehmen</v-btn >Annehmen</v-btn
> >
<div v-show="jobrequest.answered && !jobrequest.accepted">
Dieser Dienst wurde schon übertragen.
</div>
</v-col> </v-col>
</v-row> </v-row>
</v-expansion-panel-content> </v-expansion-panel-content>
@ -77,8 +87,10 @@
{{ jobrequest.on_date.getDate() }}.{{ {{ jobrequest.on_date.getDate() }}.{{
jobrequest.on_date.getMonth() + 1 jobrequest.on_date.getMonth() + 1
}}.{{ jobrequest.on_date.getFullYear() }} an }}.{{ jobrequest.on_date.getFullYear() }} an
<v-badge :value="jobrequest.watched" icon="mdi-eye" color="grey" inline>
{{ jobrequest.to_user.firstname }} {{ jobrequest.to_user.firstname }}
{{ jobrequest.to_user.lastname }} {{ jobrequest.to_user.lastname }}
</v-badge>
</div> </div>
<v-row class="text-right" style="margin-right: 5px"> <v-row class="text-right" style="margin-right: 5px">
<v-col> <v-col>
@ -108,17 +120,12 @@
:day="jobrequest.day" :day="jobrequest.day"
:long="true" :long="true"
@sendRequests="sendingJobRequests(jobrequest, $event)" @sendRequests="sendingJobRequests(jobrequest, $event)"
@addingJob="addJob"
@deletingJob="deleteJob"
@sendInvites="setJobInvites"
@deleteJobInvite="deleteInvite"
@deleteJobRequest="deleteJobRequestFromMe"
/> />
<v-row class="text-right">
<v-col>
<v-btn
v-show="!jobrequest.accepted"
text
@click="updatingAcceptedJobRequest(jobrequest)"
>Annehmen
</v-btn>
</v-col>
</v-row>
</v-expansion-panel-content> </v-expansion-panel-content>
</v-expansion-panel> </v-expansion-panel>
</v-expansion-panels> </v-expansion-panels>
@ -148,7 +155,13 @@ export default {
getJobRequests: 'jobRequests/getJobRequests', getJobRequests: 'jobRequests/getJobRequests',
updateJobRequestToMe: 'jobRequests/updateJobRequestToMe', updateJobRequestToMe: 'jobRequests/updateJobRequestToMe',
setJobRequests: 'jobRequests/setJobRequests', setJobRequests: 'jobRequests/setJobRequests',
deleteJobRequestFromMe: 'jobRequests/deleteJobRequestFromMe' deleteJobRequestFromMe: 'jobRequests/deleteJobRequestFromMe',
deleteInvite: 'jobInvites/deleteJobInviteFromMe',
getJobInvites: 'jobInvites/getJobInvites',
addJob: 'jobInvites/addJob',
setJobInvites: 'jobInvites/setJobInvites',
updateJobInviteToMe: 'jobInvites/updateJobInviteToMe',
deleteJob: 'jobInvites/deleteJob',
}), }),
updatingAcceptedJobRequest(jobRequest) { updatingAcceptedJobRequest(jobRequest) {
jobRequest.accepted = true jobRequest.accepted = true

View File

@ -46,7 +46,16 @@
<v-row justify="start" align="start"> <v-row justify="start" align="start">
<div v-for="day in week.days" :key="day.id"> <div v-for="day in week.days" :key="day.id">
<v-col cols="12"> <v-col cols="12">
<Day :day="day" :long="false" @addingJob="addJob" @sendInvites="setJobInvites" @deletingJob="deleteJob"/> <Day
:day="day"
:long="false"
@addingJob="addJob"
@sendInvites="setJobInvites"
@deletingJob="deleteJob"
@sendRequests="setJobRequests"
@deleteJobInvite="deleteInvite"
@deleteJobRequest="deleteRequest"
/>
</v-col> </v-col>
</div> </div>
</v-row> </v-row>
@ -112,7 +121,10 @@ export default {
deleteJob: 'jobs/deleteJob', deleteJob: 'jobs/deleteJob',
setJobInvites: 'jobInvites/setJobInvites', setJobInvites: 'jobInvites/setJobInvites',
getJobInvites: 'jobInvites/getJobInvites', getJobInvites: 'jobInvites/getJobInvites',
getJobRequests: 'jobRequests/getJobRequests' getJobRequests: 'jobRequests/getJobRequests',
setJobRequests: 'jobRequests/setJobRequests',
deleteInvite: 'jobInvites/deleteJobInviteFromMe',
deleteRequest: 'jobRequests/deleteJobRequestFromMe'
}), }),
changeMonth(value) { changeMonth(value) {
if (value === -1) { if (value === -1) {

View File

@ -84,28 +84,21 @@
>Einladen</v-btn >Einladen</v-btn
> >
</template> </template>
<v-card> <v-card :loading="jobInvitesLoading">
<v-card-title> <v-card-title>
Einladungen Einladungen
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-tooltip <v-div
bottom bottom
v-for="(invite, index) in getInvites(day.date)" v-for="(invite, index) in getInvites(day.date)"
:key="index" :key="index"
> >
<template v-slot:activator="{ on }"> <v-chip v-on="on" style="margin: 5px">
<v-chip {{ invite.to_user.firstname }}
v-on="on" {{ invite.to_user.lastname }}
close
style="margin: 5px"
@click:close="deleteInvite(invite)"
>
{{ invite.to_user.firstname }} {{ invite.to_user.lastname }}
</v-chip> </v-chip>
</template> </v-div>
<span>Klicken um Einladung zu widerrufen.</span>
</v-tooltip>
<v-divider style="margin-bottom: 5px" /> <v-divider style="margin-bottom: 5px" />
<v-autocomplete <v-autocomplete
v-model="job_invites" v-model="job_invites"
@ -134,17 +127,41 @@
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-menu> </v-menu>
<v-menu v-model="menu_request" :close-on-content-click="false" offset-y v-if="day.locked && userInWorker()"> <v-menu
v-model="menu_request"
:close-on-content-click="false"
offset-y
v-if="day.locked && userInWorker()"
>
<template v-slot:activator="{ on }"> <template v-slot:activator="{ on }">
<v-btn v-show="day.locked && userInWorker()" text v-on="on"> <v-btn v-show="day.locked && userInWorker()" text v-on="on">
Abgeben Abgeben
</v-btn> </v-btn>
</template> </template>
<v-card> <v-card :loading="jobRequestsLoading">
<v-card-title>
Dienstabgabenanfrage
</v-card-title>
<v-card-text> <v-card-text>
<div v-if="jobRequestsLoading">
<v-progress-circular indeterminate />
</div>
<div v-if="!jobRequestsLoading">
<v-div
bottom
v-for="(request, index) in getRequests(day.date)"
:key="index"
>
<v-chip v-on="on" style="margin: 5px">
{{ request.to_user.firstname }}
{{ request.to_user.lastname }}
</v-chip>
</v-div>
</div>
<v-divider style="margin-bottom: 5px" />
<v-autocomplete <v-autocomplete
v-model="job_requests" v-model="job_requests"
label="Einladungen senden an" label="Anfragen senden an"
return-object return-object
multiple multiple
filled filled
@ -202,9 +219,7 @@ export default {
//setInterval(() => {console.log(this.day.loading)},100) //setInterval(() => {console.log(this.day.loading)},100)
}, },
methods: { methods: {
...mapActions({ ...mapActions({}),
deleteInvite: 'jobInvites/deleteJobInviteFromMe'
}),
sendInvites() { sendInvites() {
var sendData = [] var sendData = []
this.job_invites.forEach(item => { this.job_invites.forEach(item => {
@ -305,7 +320,20 @@ export default {
month: sendData.on_date.getMonth() + 1, month: sendData.on_date.getMonth() + 1,
day: sendData.on_date.getDate() day: sendData.on_date.getDate()
} }
this.deleteInvite(sendData) this.$emit('deleteJobInvite', sendData)
},
deletingRequest(jobRequest) {
let sendData = { ...jobRequest }
sendData.on_date = {
year: sendData.on_date.getFullYear(),
month: sendData.on_date.getMonth() + 1,
day: sendData.on_date.getDate()
}
this.$emit('deleteJobRequest', sendData)
this.menu_request = false
setTimeout(() => {
this.menu_request = true
}, 200)
}, },
getJob_Kind() { getJob_Kind() {
var jobkinddate = this.day.jobkinddate.find(item => { var jobkinddate = this.day.jobkinddate.find(item => {
@ -361,7 +389,10 @@ export default {
activeUser: 'user/user', activeUser: 'user/user',
allUsers: 'usermanager/users', allUsers: 'usermanager/users',
getDay: 'jobInvites/getDayFromMe', getDay: 'jobInvites/getDayFromMe',
getInvites: 'jobInvites/getDayWorkerFromMe' getInvites: 'jobInvites/getDayWorkerFromMe',
getRequests: 'jobRequests/getDayWorkerFromMe',
jobInvitesLoading: 'jobInvites/jobInvitesLoading',
jobRequestsLoading: 'jobRequests/jobRequestsLoading'
}), }),
jobkindWithSpace() { jobkindWithSpace() {
var retVal = this.day.jobkinddate.filter(item => { var retVal = this.day.jobkinddate.filter(item => {