user kann versendete dienstübertragungsanfragen löschen

This commit is contained in:
Tim Gröger 2020-06-03 12:29:37 +02:00
parent 2401b949ce
commit 4d6db01bd3
5 changed files with 227 additions and 84 deletions

View File

@ -1,8 +1,10 @@
<template>
<div>
<v-row align="center" justify="center" v-if="jobInvitesLoading">
<v-progress-circular indeterminate color="grey" />
</v-row>
<v-card tile :loading="jobInvitesLoading">
<v-card-title>
Eingehende Einladungen
</v-card-title>
<v-card-text>
<v-expansion-panels>
<v-expansion-panel
v-for="jobInvite in jobInvitesToMe"
@ -17,16 +19,17 @@
{{ jobInvite.from_user.firstname }}
{{ jobInvite.from_user.lastname }}
</div>
<v-row
class="text-right"
style="margin-right: 5px"
v-show="userInWorker(jobInvite)"
>
<v-row class="text-right" style="margin-right: 5px">
<v-col>
<v-icon color="green">
<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-progress-circular indeterminate v-if="jobInvitesLoading"></v-progress-circular>
</v-col>
</v-row>
</v-expansion-panel-header>
@ -50,6 +53,8 @@
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-card-text>
</v-card>
</div>
</template>
@ -75,7 +80,7 @@ export default {
getJobInvites: 'jobInvites/getJobInvites',
addJob: 'jobInvites/addJob',
updateJobInviteToMe: 'jobInvites/updateJobInviteToMe',
deleteJob: 'jobInvites/deleteJob',
deleteJob: 'jobInvites/deleteJob'
}),
forceRender() {
setTimeout(() => {
@ -101,7 +106,6 @@ export default {
this.seenJobIvnite(jobInvite)
this.deleteJob(event)
this.forceRender()
},
userInWorker(jobinvite) {
var jobkinddate = jobinvite.day.jobkinddate.find(item => {

View File

@ -1,6 +1,6 @@
<template>
<div>
<v-card tile>
<v-card tile :loading="jobRequestsLoading">
<v-card-title>
Eingehende Anfragen
</v-card-title>
@ -11,18 +11,25 @@
:key="index"
>
<v-expansion-panel-header @click.once="seenJobRequest(jobrequest)">
<div>
{{ jobrequest.on_date.getDate() }}.{{
jobrequest.on_date.getMonth() + 1
}}.{{ jobrequest.on_date.getFullYear() }} von
{{ jobrequest.from_user.firstname }}
{{ jobrequest.from_user.lastname }}
<v-row class="text-right">
</div>
<v-row class="text-right" style="margin-right: 5px">
<v-col>
<v-progress-circular
indeterminate
v-if="jobRequestsLoading"
></v-progress-circular>
</v-col>
<v-col>
<v-icon color="green" v-show="userInWorker(jobrequest)">
{{ check }}
</v-icon>
</v-col>
</v-row>
</v-expansion-panel-header>
<v-expansion-panel-content>
@ -35,7 +42,11 @@
</v-btn>
</v-col>
</v-row>
<Day :day="jobrequest.day" :long="true" />
<Day
:day="jobrequest.day"
:long="true"
@sendRequests="sendingJobRequests(jobrequest, $event)"
/>
<v-row class="text-right">
<v-col>
<v-btn
@ -51,18 +62,74 @@
</v-expansion-panels>
</v-card-text>
</v-card>
<h1>
fromme
</h1>
<div v-for="(jobrequest, index) in jobRequestsFromMe" :key="index">
{{ jobrequest }}
<v-card tile :loading="jobRequestsLoading">
<v-card-title>
Ausgehende Anfragen
</v-card-title>
<v-card-text>
<v-expansion-panels>
<v-expansion-panel
v-for="(jobrequest, index) in jobRequestsFromMe"
:key="index"
>
<v-expansion-panel-header>
<div>
{{ jobrequest.on_date.getDate() }}.{{
jobrequest.on_date.getMonth() + 1
}}.{{ jobrequest.on_date.getFullYear() }} an
{{ jobrequest.to_user.firstname }}
{{ jobrequest.to_user.lastname }}
</div>
<v-row class="text-right" style="margin-right: 5px">
<v-col>
<v-progress-circular
indeterminate
v-if="jobRequestsLoading"
></v-progress-circular>
</v-col>
<v-col>
<v-icon color="green" v-show="jobrequest.accepted">
{{ check }}
</v-icon>
</v-col>
</v-row>
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-row class="text-right">
<v-col>
<v-btn icon @click="deleteJobRequestFromMe(jobrequest)">
<v-icon>
{{trashCan}}
</v-icon>
</v-btn>
</v-col>
</v-row>
<Day
:day="jobrequest.day"
:long="true"
@sendRequests="sendingJobRequests(jobrequest, $event)"
/>
<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>
</v-expansion-panels>
</v-card-text>
</v-card>
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import { mdiEyeOff, mdiEyeCheck } from '@mdi/js'
import { mdiEyeOff, mdiEyeCheck, mdiCheck, mdiTrashCan } from '@mdi/js'
import Day from '@/components/user/Jobs/Day'
export default {
name: 'JobTransfer',
@ -71,13 +138,17 @@ export default {
data() {
return {
notSeen: mdiEyeOff,
seen: mdiEyeCheck
seen: mdiEyeCheck,
check: mdiCheck,
trashCan: mdiTrashCan,
}
},
methods: {
...mapActions({
getJobRequests: 'jobRequests/getJobRequests',
updateJobRequestToMe: 'jobRequests/updateJobRequestToMe'
updateJobRequestToMe: 'jobRequests/updateJobRequestToMe',
setJobRequests: 'jobRequests/setJobRequests',
deleteJobRequestFromMe: 'jobRequests/deleteJobRequestFromMe'
}),
updatingAcceptedJobRequest(jobRequest) {
jobRequest.accepted = true
@ -96,6 +167,18 @@ export default {
jobRequest.watched = true
this.updateJobRequestToMe(jobRequest)
}
},
userInWorker(jobrequest) {
var jobkinddate = jobrequest.day.jobkinddate.find(item => {
return item.worker.find(workeritem => {
return workeritem.id === this.activeUser.id
})
})
return !!jobkinddate
},
sendingJobRequests(jobrequest, event) {
this.seenJobRequest(jobrequest)
this.setJobRequests(event)
}
},
computed: {
@ -103,7 +186,8 @@ export default {
jobRequestsToMe: 'jobRequests/jobRequestsToMe',
jobRequestsFromMe: 'jobRequests/jobRequestsFromMe',
jobRequestsLoading: 'jobRequests/jobRequestsLoading',
loading: 'user/loading'
loading: 'user/loading',
activeUser: 'user/user'
})
},
created() {

View File

@ -85,7 +85,6 @@ export default {
},
created() {
this.getActiveUser()
this.getJobInvites()
this.getAllJobKinds()
this.createMonth(this.date)
this.getDBUsers()
@ -112,7 +111,8 @@ export default {
addJob: 'jobs/addJob',
deleteJob: 'jobs/deleteJob',
setJobInvites: 'jobInvites/setJobInvites',
getJobInvites: 'jobInvites/getJobInvites'
getJobInvites: 'jobInvites/getJobInvites',
getJobRequests: 'jobRequests/getJobRequests'
}),
changeMonth(value) {
if (value === -1) {
@ -139,13 +139,13 @@ export default {
...mapGetters({
month: 'jobs/month',
startDate: 'jobs/getStartDate',
endDate: 'jobs/getEndDate'
endDate: 'jobs/getEndDate',
loading: 'user/loading'
})
},
watch: {
$route() {
this.getActiveUser()
this.getJobInvites()
this.date = new Date(
this.$route.params.year,
this.$route.params.month - 1,
@ -166,6 +166,12 @@ export default {
day: this.endDate.getDate()
}
})
},
loading(newValue) {
if(!newValue) {
this.getJobInvites()
this.getJobRequests()
}
}
}
}

View File

@ -134,7 +134,7 @@
</v-card-actions>
</v-card>
</v-menu>
<v-menu v-model="menu_request" :close-on-content-click="false" offset-y>
<v-menu v-model="menu_request" :close-on-content-click="false" offset-y v-if="day.locked && userInWorker()">
<template v-slot:activator="{ on }">
<v-btn v-show="day.locked && userInWorker()" text v-on="on">
Abgeben
@ -143,7 +143,7 @@
<v-card>
<v-card-text>
<v-autocomplete
v-model="job_invites"
v-model="job_requests"
label="Einladungen senden an"
return-object
multiple
@ -152,13 +152,13 @@
item-value="id"
chips
deletable-chips
:items="filteredDBUsers()"
:items="filteredDBUsersWithJobKind()"
>
</v-autocomplete>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text>
<v-btn text @click="sendRequests()">
Anfragen
</v-btn>
</v-card-actions>
@ -194,7 +194,8 @@ export default {
menu_invite: false,
menu_request: false,
update: 0,
job_invites: []
job_invites: [],
job_requests: []
}
},
created() {
@ -223,6 +224,26 @@ export default {
}, 200)
this.menu_invite = false
},
sendRequests() {
var sendData = []
this.job_requests.forEach(item => {
sendData.push({
from_user: this.activeUser,
to_user: item,
date: {
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
},
job_kind: this.getJob_Kind()
})
})
this.$emit('sendRequests', sendData)
setTimeout(() => {
this.job_requests = []
}, 200)
this.menu_request = false
},
color: day => {
if (day) {
if (day.date.getDay() === 0 || day.date.getDay() === 1) {
@ -286,6 +307,34 @@ export default {
}
this.deleteInvite(sendData)
},
getJob_Kind() {
var jobkinddate = this.day.jobkinddate.find(item => {
return item.worker.find(user => {
return this.activeUser.id === user.id
})
})
return jobkinddate.job_kind
},
filteredDBUsersWithJobKind() {
console.log(this.day.jobkinddate)
var retVal = this.filteredDBUsers()
var job_kind = this.getJob_Kind()
retVal = retVal.filter(user => {
if (job_kind.workgroup ? job_kind.workgroup.if === null : true) {
return true
} else {
if (user.workgroups ? user.workgroups.length > 0 : false) {
return user.workgroups.find(wg => {
return wg.id === job_kind.workgroup.id
})
}
}
return false
})
return retVal
},
filteredDBUsers() {
var retVal = this.allUsers.filter(user => {
var test = this.day.jobkinddate.find(item => {

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 = {