fixed, dass wenn die dienstübersicht neu geladen wird, man bei dem gleichen Monat bleibt

This commit is contained in:
Tim Gröger 2020-05-24 23:24:58 +02:00
parent b4f5735947
commit 6dd5f75d2e
7 changed files with 111 additions and 72 deletions

View File

@ -4,7 +4,7 @@
<v-toolbar-title>Dienstübersicht</v-toolbar-title> <v-toolbar-title>Dienstübersicht</v-toolbar-title>
<v-spacer /> <v-spacer />
<v-toolbar-items> <v-toolbar-items>
<v-btn text icon @click="changeMonth(-1)"> <v-btn text icon :to="{name: 'userJobs', params: {year: date.getFullYear(), month: date.getMonth()}}">
<v-icon>{{ keyboard_arrow_left }}</v-icon> <v-icon>{{ keyboard_arrow_left }}</v-icon>
</v-btn> </v-btn>
<v-list-item> <v-list-item>
@ -13,7 +13,7 @@
{{ date.getFullYear() }} {{ date.getFullYear() }}
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-btn text icon @click="changeMonth(1)"> <v-btn text icon :to="{name: 'userJobs', params: {year: date.getFullYear(), month: date.getMonth() +2}}">
<v-icon>{{ keyboard_arrow_right }}</v-icon> <v-icon>{{ keyboard_arrow_right }}</v-icon>
</v-btn> </v-btn>
</v-toolbar-items> </v-toolbar-items>
@ -52,7 +52,7 @@ export default {
return { return {
keyboard_arrow_left: mdiChevronLeft, keyboard_arrow_left: mdiChevronLeft,
keyboard_arrow_right: mdiChevronRight, keyboard_arrow_right: mdiChevronRight,
date: new Date(), date: new Date(this.$route.params.year, this.$route.params.month -1, 1),
monthArray: [ monthArray: [
'Januar', 'Januar',
'Februar', 'Februar',
@ -71,17 +71,6 @@ export default {
}, },
created() { created() {
this.getActiveUser() this.getActiveUser()
for (let intDate = 1; intDate < 7; intDate++) {
if (
new Date(
this.date.getFullYear(),
this.date.getMonth(),
intDate
).getDay() === 3
)
if (this.date.getDate() < intDate)
this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0)
}
this.getAllJobKinds() this.getAllJobKinds()
this.createMonth(this.date) this.createMonth(this.date)
this.getAllUsers() this.getAllUsers()
@ -140,6 +129,34 @@ export default {
startDate: 'jobs/getStartDate', startDate: 'jobs/getStartDate',
endDate: 'jobs/getEndDate' endDate: 'jobs/getEndDate'
}) })
},
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.getAllJobKinds()
this.createMonth(this.date)
this.getAllUsers()
this.getUsers({
from_date: {
year: this.startDate.getFullYear(),
month: this.startDate.getMonth() + 1,
day: this.startDate.getDate()
},
to_date: {
year: this.endDate.getFullYear(),
month: this.endDate.getMonth() + 1,
day: this.endDate.getDate()
}
})
this.getTransactJobs({
year: this.date.getFullYear(),
month: this.date.getMonth() + 1,
day: 1
})
}
} }
} }
</script> </script>

View File

@ -73,42 +73,47 @@
<v-btn text block @click="send">senden</v-btn> <v-btn text block @click="send">senden</v-btn>
</v-card-actions> </v-card-actions>
</div> </div>
<v-card-actions <v-card-actions class="text--secondary" v-if="!day.loading">
class="text--secondary" <div v-show="filterAddJob.length > 0 && !userInWorker()">
v-if="!day.loading"
v-show="filterAddJob.length > 0 && !userInWorker()"
>
<div>
<div>Hier kannst du dich zum Bardienst eintragen.</div> <div>Hier kannst du dich zum Bardienst eintragen.</div>
<v-spacer /> <v-spacer />
<v-menu <div class="text-right">
v-model="menu" <v-menu
open-on-hover v-model="menu"
close-on-click open-on-hover
close-on-content-click close-on-click
offset-y close-on-content-click
> offset-y
<template v-slot:activator="{ on }"> >
<v-btn <template v-slot:activator="{ on }">
text <v-spacer/>
v-on="on" <v-btn
v-show="filterAddJob.length > 0 && !userInWorker()" text
> v-on="on"
Eintragen v-show="filterAddJob.length > 0 && !userInWorker()"
</v-btn> >
</template> Eintragen
<v-list> </v-btn>
<v-list-item </template>
v-for="(jobkinddateitem, index) in filterAddJob" <v-list>
:key="index" <v-list-item
@click="addingJob(jobkinddateitem)" v-for="(jobkinddateitem, index) in filterAddJob"
> :key="index"
<v-list-item-title> @click="addingJob(jobkinddateitem)"
{{ jobkinddateitem.job_kind.name }} >
</v-list-item-title> <v-list-item-title>
</v-list-item> {{ jobkinddateitem.job_kind.name }}
</v-list> </v-list-item-title>
</v-menu> </v-list-item>
</v-list>
</v-menu>
</div>
</div>
<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> </div>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
@ -188,7 +193,6 @@ export default {
setTimeout(() => { setTimeout(() => {
this.update += 1 this.update += 1
}, 200) }, 200)
console.log('after adding Job', this.day.jobkinddate)
}, },
userInWorker() { userInWorker() {
var jobkinddate = this.day.jobkinddate.find(item => { var jobkinddate = this.day.jobkinddate.find(item => {
@ -196,7 +200,6 @@ export default {
return workeritem.id === this.activeUser.id return workeritem.id === this.activeUser.id
}) })
}) })
console.log('userin', !!jobkinddate, !jobkinddate)
return !!jobkinddate return !!jobkinddate
} }
}, },
@ -227,6 +230,16 @@ export default {
}) })
return test return test
}, },
jobkindWithSpace() {
var retVal = this.day.jobkinddate.filter(item => {
if (item.maxpersons <= item.worker.length)
return false
else
return true
})
return retVal
}
,
filterAddJob() { filterAddJob() {
var retVal = this.day.jobkinddate.filter(item => { var retVal = this.day.jobkinddate.filter(item => {
if (item.maxpersons <= item.worker.length) { if (item.maxpersons <= item.worker.length) {
@ -242,7 +255,6 @@ export default {
} }
} }
}) })
console.log('filterAddJob', retVal, retVal.length > 0, this.user.workgroups)
return retVal return retVal
} }
} }

View File

@ -14,7 +14,7 @@
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>Finanzübersicht</v-list-item-title> <v-list-item-title>Finanzübersicht</v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item link to="/main/user/jobs"> <v-list-item link :to="{name: 'userJobs', params: {year: new Date().getFullYear(), month: new Date().getMonth() + 1}}">
<v-list-item-icon> <v-list-item-icon>
<v-icon> <v-icon>
{{ briefcase }} {{ briefcase }}

View File

@ -1,7 +1,6 @@
<template> <template>
<v-list> <v-list>
<v-list-item link to="/main/management/servicemanagement"> <v-list-item link :to="{name: 'serviceManagement', params: {year: new Date().getFullYear(), month: new Date().getMonth() + 1}}"> <v-list-item-icon>
<v-list-item-icon>
<v-icon>{{ work }}</v-icon> <v-icon>{{ work }}</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title> <v-list-item-title>

View File

@ -4,7 +4,7 @@
<v-toolbar-title>Dienstverwaltung</v-toolbar-title> <v-toolbar-title>Dienstverwaltung</v-toolbar-title>
<v-spacer /> <v-spacer />
<v-toolbar-items> <v-toolbar-items>
<v-btn text icon @click="changeMonth(-1)"> <v-btn text icon :to="{name: 'serviceManagement', params: {year: date.getFullYear(), month: date.getMonth()}}">
<v-icon>{{ keyboard_arrow_left }}</v-icon> <v-icon>{{ keyboard_arrow_left }}</v-icon>
</v-btn> </v-btn>
<v-list-item> <v-list-item>
@ -13,7 +13,7 @@
{{ date.getFullYear() }} {{ date.getFullYear() }}
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-btn text icon @click="changeMonth(1)"> <v-btn text icon :to="{name: 'serviceManagement', params: {year: date.getFullYear(), month: date.getMonth() + 2}}">
<v-icon>{{ keyboard_arrow_right }}</v-icon> <v-icon>{{ keyboard_arrow_right }}</v-icon>
</v-btn> </v-btn>
</v-toolbar-items> </v-toolbar-items>
@ -57,7 +57,7 @@ export default {
keyboard_arrow_left: mdiChevronLeft, keyboard_arrow_left: mdiChevronLeft,
keyboard_arrow_right: mdiChevronRight, keyboard_arrow_right: mdiChevronRight,
id: 0, id: 0,
date: new Date(), date: new Date(this.$route.params.year, this.$route.params.month -1, 1),
monthArray: [ monthArray: [
'Januar', 'Januar',
'Februar', 'Februar',
@ -75,17 +75,6 @@ export default {
} }
}, },
created() { created() {
for (let intDate = 1; intDate < 7; intDate++) {
if (
new Date(
this.date.getFullYear(),
this.date.getMonth(),
intDate
).getDay() === 3
)
if (this.date.getDate() < intDate)
this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0)
}
this.getAllJobKinds() this.getAllJobKinds()
this.createMonth(this.date) this.createMonth(this.date)
this.getAllUsers() this.getAllUsers()
@ -152,6 +141,27 @@ export default {
startDate: 'sm/getStartDate', startDate: 'sm/getStartDate',
endDate: 'sm/getEndDate' endDate: 'sm/getEndDate'
}) })
},
watch: {
$route() {
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(),
month: this.startDate.getMonth() + 1,
day: this.startDate.getDate()
},
to_date: {
year: this.endDate.getFullYear(),
month: this.endDate.getMonth() + 1,
day: this.endDate.getDate()
}
})
}
} }
} }
</script> </script>

View File

@ -1,7 +1,7 @@
//const main = 'https://192.168.5.128:5000/' //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 = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/' const main = 'https://groeger-clan.duckdns.org:5000/'
const url = { const url = {
login: main + 'login', login: main + 'login',

View File

@ -54,7 +54,8 @@ const routes = [
components: { nav: ManagementNavigation, default: BarView }, components: { nav: ManagementNavigation, default: BarView },
children: [ children: [
{ {
path: 'servicemanagement', name: 'serviceManagement',
path: 'servicemanagement/:year/:month',
component: ServiceManagement component: ServiceManagement
}, },
{ {
@ -92,7 +93,7 @@ const routes = [
component: Config component: Config
}, },
{ {
path: 'jobs', path: 'jobs/:year/:month',
name: 'userJobs', name: 'userJobs',
component: Jobs component: Jobs
}, },