user können andere einladen, es gibt eine übersicht der einladungen mit notification, user kann sich in dienstübersicht ausloggen.

This commit is contained in:
Tim Gröger 2020-05-27 12:09:54 +02:00
parent 6dd5f75d2e
commit 057304c5be
20 changed files with 838 additions and 611 deletions

View File

@ -17,7 +17,7 @@
<v-btn icon v-if="isUser" disabled>
<v-icon>{{person}}</v-icon>
</v-btn>
<v-btn icon to="/pricelist">
<v-btn icon :to="{name: 'priceListNoLogin'}">
<v-icon>{{list}}</v-icon>
</v-btn>
</v-app-bar>

View File

@ -1,6 +1,6 @@
<template>
<v-list>
<v-list-item link to="/main/bar/geruecht">
<v-list-item link :to="{name: 'geruecht'}">
<v-list-item-icon>
<v-icon>{{ glass_mug_variant }}</v-icon>
</v-list-item-icon>

View File

@ -1,7 +1,7 @@
<template>
<div>
<v-list>
<v-list-item class="title" link to="/main/finanzer/overview">
<v-list-item class="title" link :to="{name: 'overview'}">
<v-list-item-icon>
<v-icon>{{home}}</v-icon>
</v-list-item-icon>

View File

@ -1,6 +1,6 @@
<template>
<v-list>
<v-list-item class="title" link to="/main/gastro/pricelist">
<v-list-item class="title" link :to="{name: 'gastroPricelist'}">
<v-list-item-icon>
<v-icon>{{list}}</v-icon>
</v-list-item-icon>

View File

@ -1,250 +0,0 @@
<template>
<div>
<v-toolbar>
<v-toolbar-title>
Dienstanfragen
</v-toolbar-title>
</v-toolbar>
<v-card tile flat>
<v-card-title>
Gesendete Anfragen
</v-card-title>
<v-progress-circular indeterminate v-if="transactJobsLoading" />
<div v-for="job in transactJobs" :key="transactJobs.indexOf(job)">
<v-expand-transition>
<v-card tile style="margin-top: 3px">
<v-card-text>
<v-row>
<v-col>
<v-combobox
outlined
label="An"
:value="job.to_user.firstname + ' ' + job.to_user.lastname"
readonly
append-icon
>
<template v-slot:selection="data">
<v-chip>
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
<v-col>
<v-combobox
outlined
label="Datum"
:value="
job.date.getDate() +
'.' +
(job.date.getMonth() + 1) +
'.' +
job.date.getFullYear()
"
readonly
append-icon
>
<template v-slot:selection="data">
<v-chip>
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
<v-col>
<v-combobox
outlined
label="Status"
:value="acceptedStatus(job)"
readonly
append-icon
>
<template v-slot:selection="data">
<v-chip :color="statusColor(job)">
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
</v-row>
</v-card-text>
<v-card-actions v-if="!job.answerd">
<v-spacer/>
<v-btn
@click="
deleteTransactJob({
username: job.to_user.username,
year: job.date.getFullYear(),
month: job.date.getMonth() + 1,
day: job.date.getDate()
})
"
>Stornieren
</v-btn
>
</v-card-actions>
</v-card>
</v-expand-transition>
</div>
</v-card>
<v-divider />
<v-card tile flat>
<v-card-title>
Eingehende Anfragen
</v-card-title>
<v-progress-circular indeterminate v-if="requestJobsLoading" />
<div v-for="job in requestJobs" :key="requestJobs.indexOf(job)">
<v-card tile style="margin-top: 3px">
<v-card-text>
<v-row>
<v-col>
<v-combobox
outlined
label="Von"
:value="
job.from_user.firstname + ' ' + job.from_user.lastname
"
readonly
append-icon
>
<template v-slot:selection="data">
<v-chip>
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
<v-col>
<v-combobox
outlined
label="Datum"
:value="
job.date.getDate() +
'.' +
(job.date.getMonth() + 1) +
'.' +
job.date.getFullYear()
"
readonly
append-icon
>
<template v-slot:selection="data">
<v-chip>
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
<v-col>
<v-combobox
outlined
label="Status"
:value="acceptedStatus(job)"
readonly
append-icon
>
<template v-slot:selection="data">
<v-chip :color="statusColor(job)">
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
</v-row>
</v-card-text>
<v-expand-transition>
<v-card-actions v-if="!job.answerd">
<v-spacer />
<v-btn
color="red"
@click="
answerJob({
username: job.from_user.username,
year: job.date.getFullYear(),
month: job.date.getMonth() + 1,
day: job.date.getDate(),
answer: false
})
"
>Ablehnen
</v-btn>
<v-btn
color="green"
@click="
answerJob({
username: job.from_user.username,
year: job.date.getFullYear(),
month: job.date.getMonth() + 1,
day: job.date.getDate(),
answer: true
})
"
>Annehmen
</v-btn>
</v-card-actions>
</v-expand-transition>
</v-card>
</div>
</v-card>
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'JobRequests',
methods: {
...mapActions({
getTransactJobs: 'requestJobs/getTransactJobs',
getRequestJobs: 'requestJobs/getRequestJobs',
answerJob: 'requestJobs/answerTransactJob',
deleteTransactJob: 'requestJobs/deleteTransactJob'
})
},
computed: {
...mapGetters({
transactJobs: 'requestJobs/transactJobs',
transactJobsLoading: 'requestJobs/transactJobsLoading',
requestJobs: 'requestJobs/requestJobs',
requestJobsLoading: 'requestJobs/requestJobsLoading'
}),
acceptedStatus() {
return job => {
if (!job.answerd) {
return 'gesendet'
}
if (job.answerd && job.accepted) {
return 'angenommen'
}
return 'abgelehnt'
}
},
statusColor() {
return job => {
if (!job.answerd) {
return
}
if (job.answerd && job.accepted) {
return 'green'
}
return 'red'
}
}
},
created() {
var now = new Date()
this.getTransactJobs({
year: now.getFullYear(),
month: now.getMonth() + 1,
day: now.getDate()
})
this.getRequestJobs({
year: now.getFullYear(),
month: now.getMonth() + 1,
day: now.getDate()
})
}
}
</script>
<style scoped></style>

View File

@ -0,0 +1,118 @@
<template>
<div>
<v-row align="center" justify="center" v-if="jobInvitesLoading">
<v-progress-circular indeterminate color="grey" />
</v-row>
<v-expansion-panels>
<v-expansion-panel
v-for="jobInvite in jobInvitesToMe"
:key="jobInvite.id"
@click="seenJobIvnite(jobInvite)"
>
<v-expansion-panel-header>
<div>
{{ jobInvite.on_date.getDate() }}.{{
jobInvite.on_date.getMonth() + 1
}}.{{ jobInvite.on_date.getFullYear() }} von
{{ jobInvite.from_user.firstname }}
{{ jobInvite.from_user.lastname }}
</div>
<v-row
style="margin-right: 5px"
v-show="userInWorker(jobInvite)"
>
<v-spacer />
<v-icon color="green">
{{ check }}
</v-icon>
</v-row>
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-row>
<v-spacer />
<v-btn text @click="updatingJobInvite(jobInvite)">
<v-icon>
{{ jobInvite.watched ? seen : notSeen }}
</v-icon>
</v-btn>
</v-row>
<Day
v-bind:day="jobInvite.day"
:long="true"
@addingJob="addingJob(jobInvite, $event)"
/>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex'
import { mdiEyeOff, mdiEyeCheck, mdiCheck } from '@mdi/js'
import Day from '@/components/user/Jobs/Day'
export default {
name: 'JobInvites',
components: { Day },
data() {
return {
notSeen: mdiEyeOff,
seen: mdiEyeCheck,
check: mdiCheck,
showNotSeen: false,
showSeen: false,
update: 0
}
},
methods: {
...mapActions({
getJobInvites: 'jobInvites/getJobInvites',
addJob: 'jobInvites/addJob',
updateJobInviteToMe: 'jobInvites/updateJobInviteToMe'
}),
forceRender() {
setTimeout(() => {
this.update += 0
}, 500)
},
updatingJobInvite(jobInvite) {
jobInvite.watched = !jobInvite.watched
this.updateJobInviteToMe(jobInvite)
},
seenJobIvnite(jobInvite) {
if (!jobInvite.watched) {
jobInvite.watched = true
this.updateJobInviteToMe(jobInvite)
}
},
addingJob(jobInvite, event) {
this.seenJobIvnite(jobInvite)
this.addJob(event)
this.forceRender()
},
userInWorker(jobinvite) {
var jobkinddate = jobinvite.day.jobkinddate.find(item => {
return item.worker.find(workeritem => {
return workeritem.id === this.activeUser.id
})
})
return !!jobkinddate
}
},
computed: {
...mapGetters({
jobInvitesFromMe: 'jobInvites/jobInvitesFromMe',
jobInvitesToMe: 'jobInvites/jobInvitesToMe',
jobInvitesLoading: 'jobInvites/jobInvitesLoading',
activeUser: 'user/user'
})
},
created() {
setTimeout(() => {
this.getJobInvites(new Date())
}, 200)
}
}
</script>
<style scoped></style>

View File

@ -0,0 +1,17 @@
<template>
<div>
<h1>
Transfer
</h1>
</div>
</template>
<script>
export default {
name: "JobTransfer"
}
</script>
<style scoped>
</style>

View File

@ -4,7 +4,14 @@
<v-toolbar-title>Dienstübersicht</v-toolbar-title>
<v-spacer />
<v-toolbar-items>
<v-btn text icon :to="{name: 'userJobs', params: {year: date.getFullYear(), month: date.getMonth()}}">
<v-btn
text
icon
:to="{
name: 'userJobs',
params: { year: date.getFullYear(), month: date.getMonth() }
}"
>
<v-icon>{{ keyboard_arrow_left }}</v-icon>
</v-btn>
<v-list-item>
@ -13,7 +20,14 @@
{{ date.getFullYear() }}
</v-list-item-title>
</v-list-item>
<v-btn text icon :to="{name: 'userJobs', params: {year: date.getFullYear(), month: date.getMonth() +2}}">
<v-btn
text
icon
:to="{
name: 'userJobs',
params: { year: date.getFullYear(), month: date.getMonth() + 2 }
}"
>
<v-icon>{{ keyboard_arrow_right }}</v-icon>
</v-btn>
</v-toolbar-items>
@ -32,7 +46,7 @@
<v-row justify="start" align="start">
<div v-for="day in week.days" :key="day.id">
<v-col>
<Day v-bind:day="day" />
<Day :day="day" :long="false" @addingJob="addJob" @sendInvites="setJobInvites" @deletingJob="deleteJob"/>
</v-col>
</div>
</v-row>
@ -52,7 +66,7 @@ export default {
return {
keyboard_arrow_left: mdiChevronLeft,
keyboard_arrow_right: mdiChevronRight,
date: new Date(this.$route.params.year, this.$route.params.month -1, 1),
date: new Date(this.$route.params.year, this.$route.params.month - 1, 1),
monthArray: [
'Januar',
'Februar',
@ -71,9 +85,10 @@ export default {
},
created() {
this.getActiveUser()
this.getJobInvites()
this.getAllJobKinds()
this.createMonth(this.date)
this.getAllUsers()
this.getDBUsers()
this.getUsers({
from_date: {
year: this.startDate.getFullYear(),
@ -86,21 +101,18 @@ export default {
day: this.endDate.getDate()
}
})
this.getTransactJobs({
year: this.date.getFullYear(),
month: this.date.getMonth() + 1,
day: 1
})
},
methods: {
...mapActions({
getActiveUser: 'user/getUser',
getTransactJobs: 'requestJobs/getTransactJobs',
createMonth: 'jobs/createMonth',
getAllUsers: 'jobs/getAllUsers',
getUsers: 'jobs/getUsers',
getDBUsers: 'usermanager/getUsersWithExtern',
getDBUsers: 'usermanager/getUsers',
getAllJobKinds: 'jkm/getAllJobKinds',
addJob: 'jobs/addJob',
deleteJob: 'jobs/deleteJob',
setJobInvites: 'jobInvites/setJobInvites',
getJobInvites: 'jobInvites/getJobInvites'
}),
changeMonth(value) {
if (value === -1) {
@ -133,12 +145,15 @@ export default {
watch: {
$route() {
this.getActiveUser()
console.log(this.$route.params)
console.log(this.date)
this.date = new Date(this.$route.params.year, this.$route.params.month - 1, 1)
this.getJobInvites()
this.date = new Date(
this.$route.params.year,
this.$route.params.month - 1,
1
)
this.getAllJobKinds()
this.createMonth(this.date)
this.getAllUsers()
this.getDBUsers()
this.getUsers({
from_date: {
year: this.startDate.getFullYear(),
@ -151,11 +166,6 @@ export default {
day: this.endDate.getDate()
}
})
this.getTransactJobs({
year: this.date.getFullYear(),
month: this.date.getMonth() + 1,
day: 1
})
}
}
}

View File

@ -1,19 +1,23 @@
<template>
<div v-if="day">
<v-card :color="color(day)" max-width="250px" min-width="250px">
<v-card
:color="color(day)"
:max-width="long ? '' : '250px'"
:min-width="long ? '' : '250px'"
>
<v-card-title v-if="day.date" class="subtitle-1 font-weight-bold">
{{ day.name }} den {{ day.date.getDate() }}.{{
day.date.getMonth() + 1
}}.{{ day.date.getFullYear() }}
{{ name }} den {{ day.date.getDate() }}.{{ day.date.getMonth() + 1 }}.{{
day.date.getFullYear()
}}
</v-card-title>
<v-card-text>
<v-expand-transition>
<v-row align="center" justify="center" v-if="day.loading">
<v-row align="center" justify="center" v-if="dayLoading">
<v-progress-circular indeterminate color="grey" />
</v-row>
</v-expand-transition>
<v-expand-transition>
<div v-show="!day.loading">
<div v-show="!dayLoading">
<div
v-for="(jobkinddateitem, index) in day.jobkinddate"
:key="index"
@ -43,41 +47,8 @@
</div>
</v-expand-transition>
</v-card-text>
<div v-if="userInWorker() && day.locked">
<v-card-actions class="text--secondary">
<v-autocomplete
return-object
v-model="requestUser"
:items="specifiedUsers"
item-text="fullName"
label="Dienstanfrage"
filled
color="green"
@input="searchInput = null"
:search-input.sync="searchInput"
>
<template v-slot:prepend-inner>
<v-icon>{{ account_add }}</v-icon>
</template>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title
>{{ data.item.firstname }}
{{ data.item.lastname }}</v-list-item-title
>
</v-list-item-content>
</template>
</v-autocomplete>
</v-card-actions>
<v-card-actions>
<v-btn text block @click="send">senden</v-btn>
</v-card-actions>
</div>
<v-card-actions class="text--secondary" v-if="!day.loading">
<div v-show="filterAddJob.length > 0 && !userInWorker()">
<div>Hier kannst du dich zum Bardienst eintragen.</div>
<v-card-actions class="text--secondary" v-if="!dayLoading">
<v-spacer />
<div class="text-right">
<v-menu
v-model="menu"
open-on-hover
@ -86,11 +57,10 @@
offset-y
>
<template v-slot:activator="{ on }">
<v-spacer/>
<v-btn
text
v-on="on"
v-show="filterAddJob.length > 0 && !userInWorker()"
v-show="filterAddJob.length > 0 && !userInWorker() && !day.locked"
>
Eintragen
</v-btn>
@ -107,26 +77,82 @@
</v-list-item>
</v-list>
</v-menu>
</div>
</div>
<v-menu v-model="menu_invite" :close-on-content-click="false">
<template v-slot:activator="{ on }">
<v-btn
v-show="
jobkindWithSpace.length !== 0 && !day.locked && userInWorker()
"
text
v-on="on"
>Einladen</v-btn
>
</template>
<v-card>
<v-card-title>
Einladungen
</v-card-title>
<v-card-text>
<v-tooltip
bottom
v-for="(invite, index) in getInvites(day.date)"
:key="index"
>
<template v-slot:activator="{ on }">
<v-chip
v-on="on"
close
style="margin: 5px"
@click:close="deleteInvite(invite)"
>
{{ invite.to_user.firstname }} {{ invite.to_user.lastname }}
</v-chip>
</template>
<span>Klicken um Einladung zu widerrufen.</span>
</v-tooltip>
<v-divider style="margin-bottom: 5px" />
<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
:disabled="job_invites.length === 0"
@click="sendInvites()"
>
{{ job_invites.length >= 1 ? 'Einladungen' : 'Einladung' }}
senden
</v-btn>
</v-card-actions>
</v-card>
</v-menu>
<v-btn v-show="!day.locked && userInWorker()" text @click="deletingJob()">Austragen</v-btn>
<v-spacer/>
<div v-show="userInWorker()">
<v-btn v-show="jobkindWithSpace.length !== 0" text>Einladen</v-btn>
<v-btn v-show="day.locked" text>Abgeben</v-btn>
</div>
<v-btn v-show="day.locked && userInWorker()" text>Abgeben</v-btn>
</v-card-actions>
</v-card>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex'
import { mapGetters, mapActions } from 'vuex'
import { mdiAccountPlus } from '@mdi/js'
export default {
name: 'Day',
props: {
day: Object
day: Object,
long: Boolean
},
data() {
return {
@ -134,29 +160,33 @@ export default {
searchInput: null,
requestUser: null,
menu: false,
update: 0
menu_invite: false,
update: 0,
job_invites: []
}
},
created() {
this.setLoading(this.day.date)
},
methods: {
...mapActions({
setLoading: 'jobs/setDayLoading',
setNotLoading: 'jobs/setDayNotLoading',
addJob: 'jobs/addJob',
deleteJob: 'jobs/deleteJob',
transactJob: 'jobs/transactJob'
deleteInvite: 'jobInvites/deleteJobInviteFromMe'
}),
send() {
this.transactJob({
user: this.requestUser.username,
sendInvites() {
var sendData = []
this.job_invites.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()
}
})
this.requestUser = null
this.searchInput = null
})
this.$emit('sendInvites', sendData)
setTimeout(() => {
this.job_invites = []
}, 200)
this.menu_invite = false
},
color: day => {
if (day) {
@ -183,7 +213,7 @@ export default {
return worker.username === this.activeUser.username
},
addingJob(jobkinddateitem) {
this.addJob({
this.$emit('addingJob', {
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate(),
@ -194,6 +224,16 @@ export default {
this.update += 1
}, 200)
},
deletingJob() {
this.$emit('deletingJob', {
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
setTimeout(() => {
this.update += 1
})
},
userInWorker() {
var jobkinddate = this.day.jobkinddate.find(item => {
return item.worker.find(workeritem => {
@ -201,45 +241,31 @@ export default {
})
})
return !!jobkinddate
},
deletingInvite(jobInvite) {
let sendData = { ...jobInvite }
sendData.on_date = {
year: sendData.on_date.getFullYear(),
month: sendData.on_date.getMonth() + 1,
day: sendData.on_date.getDate()
}
this.deleteInvite(sendData)
}
},
computed: {
...mapGetters({
disabled: 'jobs/disabled',
activeUser: 'user/user',
allUsers: 'jobs/allUsers',
transactJobs: 'requestJobs/transactJobs'
allUsers: 'usermanager/users',
getDay: 'jobInvites/getDayFromMe',
getInvites: 'jobInvites/getDayWorkerFromMe'
}),
specifiedUsers() {
var users = [...this.allUsers]
for (var i in this.day.worker) {
var worker = users.find(a => {
return a.username === this.day.worker[i].username
})
var index = users.indexOf(worker)
if (worker) users.splice(index, 1)
}
return users
},
canDelete() {
var transactJob = this.transactJobs.filter(a => {
return a.date - this.day.date === 0
})
var test = transactJob.find(a => {
return a.accepted && a.answerd
})
return test
},
jobkindWithSpace() {
var retVal = this.day.jobkinddate.filter(item => {
if (item.maxpersons <= item.worker.length)
return false
else
return true
if (item.maxpersons <= item.worker.length) return false
else return true
})
return retVal
}
,
},
filterAddJob() {
var retVal = this.day.jobkinddate.filter(item => {
if (item.maxpersons <= item.worker.length) {
@ -256,6 +282,39 @@ 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'
else if (name === 1) return 'Montag'
else if (name === 2) return 'Dienstag'
else if (name === 3) return 'Mittwoche'
else if (name == 4) return 'Donnerstag'
else if (name === 5) return 'Freitag'
else return 'Samstag'
},
dayLoading() {
return this.day.loading
}
}
}

View File

@ -0,0 +1,50 @@
<template>
<div>
<v-bottom-navigation v-model="bottom_nav">
<v-btn :to="{ name: 'jobRequests', params: { kind: 'jobInvites' } }">
<v-badge color="red" :content="news" :value="news !== 0">Diensteinladungen</v-badge>
</v-btn>
<v-btn :to="{ name: 'jobRequests', params: { kind: 'jobTransfer' } }"
>Dienstübertragung</v-btn
>
</v-bottom-navigation>
<JobInvites v-if="kind === 'jobInvites'"></JobInvites>
<JobTransfer v-if="kind === 'jobTransfer'"></JobTransfer>
</div>
</template>
<script>
import JobInvites from '@/components/user/JobRequests/JobInvites'
import JobTransfer from '@/components/user/JobRequests/JobTransfer'
import { mapActions, mapGetters } from 'vuex'
export default {
name: 'JobsRequest',
components: { JobTransfer, JobInvites },
data() {
return {
bottom_nav: true,
kind: this.$route.params.kind
}
},
methods: {
...mapActions({
getUser: 'user/getUser'
})
},
computed: {
...mapGetters({
news: 'jobInvites/news'
})
},
created() {
this.getUser()
},
watch: {
$route() {
this.kind = this.$route.params.kind
}
}
}
</script>
<style scoped></style>

View File

@ -8,13 +8,22 @@
Home
</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/user/overview">
<v-list-item link :to="{ name: 'userOverview' }">
<v-list-item-icon>
<v-icon>{{ bank }}</v-icon>
</v-list-item-icon>
<v-list-item-title>Finanzübersicht</v-list-item-title>
</v-list-item>
<v-list-item link :to="{name: 'userJobs', params: {year: new Date().getFullYear(), month: new Date().getMonth() + 1}}">
<v-list-item
link
:to="{
name: 'userJobs',
params: {
year: new Date().getFullYear(),
month: new Date().getMonth() + 1
}
}"
>
<v-list-item-icon>
<v-icon>
{{ briefcase }}
@ -22,15 +31,20 @@
</v-list-item-icon>
<v-list-item-title>Dienstübersicht</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/user/jobRequests">
<v-list-item
link
:to="{ name: 'jobRequests', params: { kind: 'jobInvites' } }"
>
<v-list-item-icon>
<v-badge overlap color="red" :content="news" :value="news !== 0">
<v-icon>
{{ switchAccount }}
</v-icon>
</v-badge>
</v-list-item-icon>
<v-list-item-title>Dienstanfragen</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/user/config">
<v-list-item link :to="{ name: 'userConfig' }">
<v-list-item-icon>
<v-icon>{{ account_card_details }}</v-icon>
</v-list-item-icon>
@ -47,6 +61,8 @@ import {
mdiBriefcase,
mdiAccountSwitch
} from '@mdi/js'
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'UserNavigation',
data() {
@ -57,6 +73,24 @@ export default {
briefcase: mdiBriefcase,
switchAccount: mdiAccountSwitch
}
},
methods: {
...mapActions({
getJobInvites: 'jobInvites/getJobInvites',
getUser: 'user/getUser'
})
},
computed: {
...mapGetters({
news: 'jobInvites/news'
})
},
created() {
this.getUser()
setTimeout(() => {
this.getJobInvites()
}, 500)
}
}
</script>

View File

@ -7,7 +7,7 @@
Dienstverwaltung
</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/management/usermanager">
<v-list-item link :to="{name: 'userManager'}">
<v-list-item-icon>
<v-icon>{{list}}</v-icon>
</v-list-item-icon>
@ -15,7 +15,7 @@
Benutzerliste
</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/management/workgroupmanagement">
<v-list-item link :to="{name: 'workgroupManagement'}">
<v-list-item-icon>
<v-icon>{{group}}</v-icon>
</v-list-item-icon>
@ -23,7 +23,7 @@
Arbeitsgruppen
</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/management/jobkindmanagement">
<v-list-item link :to="{name: 'jobkindManagement'}">
<v-list-item-icon>
<v-icon>???</v-icon>
</v-list-item-icon>

View File

@ -1,7 +1,7 @@
//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 = 'https://groeger-clan.duckdns.org:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/'
const url = {
login: main + 'login',
@ -61,12 +61,11 @@ const url = {
job: main + 'user/job',
jobs: main + 'user/jobs',
addJob: main + 'user/addJob',
getJobOnDates: main + 'user/jobsOnDates',
deleteJob: main + 'user/deleteJob',
transactJob: main + 'user/transactJob',
answerTransactJob: main + 'user/answerTransactJob',
jobRequests: main + 'user/jobRequests',
getTransactJobs: main + 'user/getTransactJobs',
deleteTransactJobs: main + 'user/deleteTransactJob',
getJobInvites: main + 'user/getJobInvites',
setJobInvites: main + 'user/JobInvites',
deletJobInvite: main + 'user/deleteJobInvite',
storno: main + 'user/storno',
getAllStatus: main + 'getAllStatus',
getStatus: main + 'getStatus',

View File

@ -17,7 +17,6 @@ import User from '../components/finanzer/User'
import ServiceManagement from '../components/vorstand/ServiceManagement'
import Config from '@/components/user/Config'
import Jobs from '@/components/user/Jobs'
import JobRequests from '@/components/user/JobRequests'
import PriceList from '@/components/pricelist/PriceList'
import ManagementNavigation from '@/components/vorstand/ManagementNavigation'
import GastroNavigation from '@/components/gastro/GastroNavigation'
@ -25,26 +24,29 @@ import PriceListView from '@/views/contents/PriceListView'
import UserManager from '@/components/vorstand/UserManager'
import WorkgroupManagement from "@/components/vorstand/WorkgroupManagement";
import JobKindManager from "@/components/vorstand/JobKindManager";
import JobsRequest from "@/components/user/JobsRequest";
Vue.use(VueRouter)
const rootPath = ''
const routes = [
{
path: '/cookies',
path: rootPath + '/cookies',
name: 'cookies'
},
{
path: '/pricelist',
path: rootPath + '/pricelist',
name: 'priceListNoLogin',
component: PriceListView
},
{
path: '/login',
path: rootPath + '/login',
name: 'login',
component: Login
},
{
path: '/main',
path: rootPath + '/main',
name: 'main',
component: MainView,
children: [
@ -60,14 +62,17 @@ const routes = [
},
{
path: 'usermanager',
name: 'userManager',
component: UserManager
},
{
path: 'workgroupmanagement',
name: 'workgroupManagement',
component: WorkgroupManagement
},
{
path: 'jobkindmanagement',
name: 'jobkindManagement',
component: JobKindManager
}
]
@ -98,9 +103,9 @@ const routes = [
component: Jobs
},
{
path: 'jobRequests',
path: 'jobRequests/:kind',
name: 'jobRequests',
component: JobRequests
component: JobsRequest
}
]
},
@ -123,6 +128,7 @@ const routes = [
children: [
{
path: 'overview',
name: 'overview',
component: Overview
},
{

View File

@ -6,11 +6,11 @@ import barUsers from '@/store/modules/barUsers'
import user from '@/store/modules/user'
import sm from '@/store/modules/serviceManagement'
import jobs from '@/store/modules/jobs'
import requestJobs from '@/store/modules/jobRequests'
import priceList from '@/store/modules/pricelist'
import usermanager from '@/store/modules/userManager'
import wm from '@/store/modules/workgroupManagement'
import jkm from '@/store/modules/jobkindManager'
import jobInvites from "@/store/modules/jobInvites";
Vue.use(Vuex)
@ -22,10 +22,10 @@ export default new Vuex.Store({
user,
sm,
jobs,
requestJobs,
priceList,
usermanager,
wm,
jkm
jkm,
jobInvites
}
})

View File

@ -0,0 +1,344 @@
import axios from 'axios'
import url from '@/plugins/routes'
const state = {
jobInvitesFromMe: [],
jobInvitesToMe: [],
jobInvitesLoading: false
}
const mutations = {
setJobInvitesFromMe: (state, jobInvites) => {
state.jobInvitesFromMe = jobInvites
state.jobInvitesFromMe.forEach(item => {
item.on_date = new Date(
item.on_date.year,
item.on_date.month - 1,
item.on_date.day
)
item.day = {
date: new Date(),
worker: [],
loading: false,
locked: false,
jobkinddate: []
}
})
},
setJobInvitesToMe: (state, jobInvites) => {
state.jobInvitesToMe = jobInvites
state.jobInvitesToMe.forEach(item => {
item.on_date = new Date(
item.on_date.year,
item.on_date.month - 1,
item.on_date.day
)
item.day = {
date: new Date(),
worker: [],
loading: false,
locked: false,
jobkinddate: []
}
})
},
setJobInvitesLoading: (state, value) => {
state.jobInvitesLoading = value
},
updateJobInviteToMe: (state, jobInvite) => {
state.jobInvitesToMe.forEach(item => {
if (item.id === jobInvite.id) {
item.watched = jobInvite.watched
}
})
},
updateMonthWorker: (state, { workers, date, getters, from_me }) => {
let mop
if (from_me) {
mop = getters.getDayFromMe(date)
} else {
mop = getters.getDayToMe(date)
}
mop.forEach(a => {
let day = a.day
day.jobkinddate.forEach(item => {
var filtered = workers.filter(worker => {
return item.job_kind.id === (worker.job_kind ? worker.job_kind.id : 1)
})
var filteredWorkers = []
filtered.forEach(item => {
filteredWorkers.push(item.user)
})
filteredWorkers.forEach(worker => {
if (
!item.worker.find(a => {
return a.id === worker.id
})
) {
item.worker.push(worker)
}
})
item.worker.forEach(worker => {
if (
!filteredWorkers.find(a => {
return a.id === worker.id
})
) {
item.worker.splice(item.worker.indexOf(worker), 1)
}
})
})})
},
updateMonthLocked: (state, { locked, date, getters, from_me }) => {
let mop
if (from_me) {
mop = getters.getDayFromMe(date)
} else {
mop = getters.getDayToMe(date)
}
mop.forEach(a => {
let day = a.day
day.locked = !!locked
})
},
updateMonthJobkind: (state, { data, date, getters, from_me }) => {
let mop
if (from_me) {
mop = getters.getDayFromMe(date)
} else {
mop = getters.getDayToMe(date)
}
mop.forEach(a => {
let day = a.day
day.date = date
var backup = []
for (let jobkind in day.jobkinddate) {
if (day.jobkinddate[jobkind].worker !== undefined) {
backup.push({
id: day.jobkinddate[jobkind].job_kind.id,
worker: day.jobkinddate[jobkind].worker,
backupWorker: day.jobkinddate[jobkind].backupWorker
})
} else {
backup.push({
id: day.jobkinddate[jobkind].job_kind.id,
worker: [],
backupWorker: []
})
}
}
day.jobkinddate = [...data]
var test = day.jobkinddate.find(jobkind => {
return jobkind.job_kind.id === 1
})
if (!test) {
day.jobkinddate.push({
id: -1,
job_kind: { id: 1, name: 'Bardienst' },
maxpersons: 2,
daydate: {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate()
},
worker: [],
backupWorker: []
})
}
for (var jobkind in day.jobkinddate) {
var worker = backup.find(item => {
return item.id === day.jobkinddate[jobkind].job_kind.id
})
day.jobkinddate[jobkind].worker = worker ? worker.worker : []
day.jobkinddate[jobkind].backupWorker = worker ? worker.backupWorker : []
}
})
},
setDayLoading: (state, { getters, date, value }) => {
let day = getters.getDayToMe(date)
day.forEach(a => {
a.day.loading = value
})
},
deleteJobInviteFromMe: (state, jobinvite) => {
var item = state.jobInvitesFromMe.find(item => {
return item.id === jobinvite.id
})
state.jobInvitesFromMe.splice(item, 1)
}
}
const actions = {
async getJobInvites({ commit, dispatch, rootState, getters }) {
try {
const date = new Date()
const from_me = await axios.post(
url.user.getJobInvites,
{
from_user: rootState.user.user,
date: {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate()
}
},
{ headers: { Token: rootState.login.user.accessToken } }
)
const workers_from_me = await axios.post(
url.user.getJobOnDates,
from_me.data,
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setJobInvitesFromMe', from_me.data)
workers_from_me.data.forEach(item => {
var date = new Date(
item.day.date.year,
item.day.date.month - 1,
item.day.date.day
)
commit('updateMonthJobkind', { data: item.jobkinddate, 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(
url.user.getJobInvites,
{
to_user: rootState.user.user,
date: {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate()
}
},
{ headers: { Token: rootState.login.user.accessToken } }
)
const workers_to_me = await axios.post(
url.user.getJobOnDates,
to_me.data,
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setJobInvitesToMe', to_me.data)
workers_to_me.data.forEach(item => {
var date = new Date(
item.day.date.year,
item.day.date.month - 1,
item.day.date.day
)
commit('updateMonthJobkind', { data: item.jobkinddate, 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 })
})
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async setJobInvites({ commit, dispatch, rootState }, data) {
try {
commit('setJobInvitesLoading', true)
const response = await axios.put(url.user.setJobInvites, data, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setJobInvitesFromMe', response.data)
commit('setJobInvitesLoading', false)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async addJob({ commit, rootState, dispatch, getters }, data) {
var date = new Date(data.year, data.month - 1, data.day)
commit('setDayLoading', { date, getters, value: true })
try {
const response = await axios.post(
url.user.addJob,
{ ...data },
{
headers: { Token: rootState.login.user.accessToken }
}
)
commit('updateMonthWorker', {
workers: [...response.data],
date: new Date(data.year, data.month - 1, data.day),
getters, from_me: false
})
commit('setDayLoading', { date, getters, value: false })
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async updateJobInviteToMe({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(url.user.setJobInvites, data, {
headers: { Token: rootState.login.user.accessToken }
})
commit('updateJobInviteToMe', response.data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async deleteJobInviteFromMe({ commit, rootState, dispatch}, data) {
try {
await axios.post(url.user.deletJobInvite, data, {headers: {Token: rootState.login.user.accessToken}})
commit('deleteJobInviteFromMe', data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
}
}
const getters = {
jobInvitesFromMe: state => {
return state.jobInvitesFromMe
},
jobInvitesToMe: state => {
return state.jobInvitesToMe
},
jobInvitesLoading: state => {
return state.jobInvitesLoading
},
getDayToMe: state => {
return date => {
return state.jobInvitesToMe.filter(item => {
return item.on_date - date === 0
})
}
},
getDayFromMe: state => {
return date => {
return state.jobInvitesFromMe.filter(item => {
return item.on_date - date === 0
})
}
},
getDayWorkerFromMe: state => {
return date => {
return state.jobInvitesFromMe.filter(jobInvite => {
return jobInvite.on_date - date === 0
})
}
},
news: state => {
var test = state.jobInvitesToMe.filter(item => {
return !item.watched
})
return test.length
}
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}

View File

@ -1,161 +0,0 @@
import axios from 'axios'
import url from '@/plugins/routes'
const state = {
transactJobs: [],
transactJobsLoading: false,
requestJobs: [],
requestJobsLoading: false
}
const mutations = {
setTransactJobs: (state, data) => {
var list = []
for (var i in data) {
list.push({
date: new Date(
data[i].date.year,
data[i].date.month - 1,
data[i].date.day
),
from_user: data[i].from_user,
to_user: data[i].to_user,
accepted: data[i].accepted,
answerd: data[i].answerd
})
}
state.transactJobs = list
},
setRequestJobs: (state, data) => {
var list = []
for (var i in data) {
list.push({
date: new Date(
data[i].date.year,
data[i].date.month - 1,
data[i].date.day
),
from_user: data[i].from_user,
to_user: data[i].to_user,
accepted: data[i].accepted,
answerd: data[i].answerd
})
}
state.requestJobs = list
},
setTransactJobsLoading: (state, value) => {
state.transactJobsLoading = value
},
setRequestJobsLoading: (state, value) => {
state.requestJobsLoading = value
},
updateRequestJob: (state, data) => {
const date = new Date(data.date.year, data.date.month - 1, data.date.day)
for (var i in state.requestJobs) {
if (
state.requestJobs[i].date - date === 0 &&
state.requestJobs[i].from_user.username === data.from_user.username
) {
state.requestJobs[i].accepted = data.accepted
state.requestJobs[i].answerd = data.answerd
break
}
}
},
deleteTransactJobactJob: (state, data) => {
const date = new Date(data.year, data.month - 1, data.day)
var job = state.transactJobs.find(a => {
return a.date - date === 0 && a.to_user.username === data.username
})
var index = state.transactJobs.indexOf(job)
if (job) state.transactJobs.splice(index, 1)
}
}
const actions = {
async getTransactJobs({ commit, rootState, dispatch }, data) {
commit('setTransactJobsLoading', true)
try {
const response = await axios.post(
url.user.getTransactJobs,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setTransactJobs', response.data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
commit('setTransactJobsLoading', false)
}
commit('setTransactJobsLoading', false)
},
async getRequestJobs({ commit, rootState, dispatch }, data) {
commit('setRequestJobsLoading', true)
try {
const response = await axios.post(
url.user.jobRequests,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setRequestJobs', response.data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
commit('setRequestJobsLoading', false)
}
commit('setRequestJobsLoading', false)
},
async answerTransactJob({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.user.answerTransactJob,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateRequestJob', response.data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
}
},
async deleteTransactJob({ commit, rootState, dispatch }, data) {
try {
await axios.post(
url.user.deleteTransactJobs,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('deleteTransactJobactJob', data)
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
}
}
}
const getters = {
transactJobs: state => {
return state.transactJobs
},
transactJobsLoading: state => {
return state.transactJobsLoading
},
requestJobs: state => {
return state.requestJobs
},
requestJobsLoading: state => {
return state.requestJobsLoading
}
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}

View File

@ -184,7 +184,6 @@ const mutations = {
}
})
})
console.log(day)
},
updateMonthLocked: (state, { locked, date, getters }) => {
var day = getters.getDay(date)
@ -234,7 +233,6 @@ const mutations = {
day.jobkinddate[jobkind].worker = worker ? worker.worker : []
day.jobkinddate[jobkind].backupWorker = worker ? worker.backupWorker : []
}
},
setAllDayLoading: state => {
for (let week = 0; week < state.month.length; week++) {
@ -324,7 +322,6 @@ const actions = {
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
console.log(response.data)
for (var day in response.data) {
var date = new Date(
response.data[day].day.date.year,
@ -365,7 +362,6 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
}
)
console.log(response.data)
commit('updateMonthWorker', {
workers: [...response.data],
date: new Date(data.year, data.month - 1, data.day),
@ -379,20 +375,27 @@ const actions = {
}
},
// eslint-disable-next-line no-unused-vars
async deleteJob({ commit, rootState, dispatch }, data) {
async deleteJob({ commit, rootState, dispatch, getters }, data) {
var date = new Date(data.year, data.month - 1, data.day)
commit('setDayLoading', {date, getters})
try {
await axios.post(
const response = await axios.post(
url.user.deleteJob,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
{
headers: { Token: rootState.login.user.accessToken }
}
)
commit('updateMonth', {
start: { ...data },
user: rootState.login.user,
com: 'delete'
console.log(response.data)
commit('updateMonthWorker', {
workers: [...response.data],
date: new Date(data.year, data.month - 1, data.day),
getters
})
commit('setDayNotLoading', {date, getters})
dispatch('getLifeTime', null, { root: true })
} catch (e) {
console.log(e)
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}

View File

@ -127,7 +127,6 @@ const mutations = {
}
}
state.month = month
console.log(month)
},
setStartEndDate: week => {
if (week.days.monday) {
@ -292,7 +291,6 @@ const actions = {
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
console.log(response.data)
for (var day in response.data) {
var date = new Date(
response.data[day].day.date.year,

View File

@ -18,13 +18,13 @@
{{user.firstname}} {{user.lastname}}
</v-list-item-title>
</v-list-item>
<v-list-item :disabled="lockedBar" v-if="isUser" class="title" link to="/main/user/add">
<v-list-item :disabled="lockedBar" v-if="isUser" class="title" link :to="{name: 'add'}">
<v-list-item-icon>
<v-icon>{{person}}</v-icon>
</v-list-item-icon>
<v-list-item-title>{{user.firstname}} {{user.lastname}}</v-list-item-title>
</v-list-item>
<v-list-item v-if="isBar" class="title" link to="/main/bar/geruecht">
<v-list-item v-if="isBar" class="title" link :to="{name: 'geruecht'}">
<v-list-item-icon>
<v-icon>{{glass_cocktail}}</v-icon>
</v-list-item-icon>
@ -32,7 +32,7 @@
Bar
</v-list-item-title>
</v-list-item>
<v-list-item :disabled="lockedBar" v-if="isManagement" class="title" link to="/main/management/servicemanagement">
<v-list-item :disabled="lockedBar" v-if="isManagement" class="title" link :to="{name: 'serviceManagement', params: {year: new Date().getFullYear(), month: new Date().getMonth() + 1}}">
<v-list-item-icon>
<v-icon>{{king}}</v-icon>
</v-list-item-icon>
@ -40,7 +40,7 @@
Vorstand
</v-list-item-title>
</v-list-item>
<v-list-item :disabled="lockedBar" v-if="isGastro" class="title" link to="/main/gastro/pricelist">
<v-list-item :disabled="lockedBar" v-if="isGastro" class="title" link :to="{name: 'gastroPricelist'}">
<v-list-item-icon>
<v-icon>{{gastro}}</v-icon>
</v-list-item-icon>
@ -48,7 +48,7 @@
Gastro
</v-list-item-title>
</v-list-item>
<v-list-item :disabled="lockedBar" v-if="isFinanzer" class="title" link to="/main/finanzer/overview">
<v-list-item :disabled="lockedBar" v-if="isFinanzer" class="title" link :to="{name: 'overview'}">
<v-list-item-icon>
<v-icon>{{attach_money}}</v-icon>
</v-list-item-icon>