flaschengeist-frontend/src/components/vorstand/ServiceManagement.vue

131 lines
3.4 KiB
Vue
Raw Normal View History

2020-01-18 11:49:49 +00:00
<template>
<div>
<v-toolbar>
<v-toolbar-title>
Dienstverwaltung
</v-toolbar-title>
<v-spacer />
<v-toolbar-items>
<v-btn text icon @click="changeMonth(-1)">
<v-icon>{{ keyboard_arrow_left }}</v-icon>
</v-btn>
<v-list-item>
<v-list-item-title class="title">
{{ monthArray[date.getMonth()] }} {{ date.getFullYear() }}
</v-list-item-title>
</v-list-item>
<v-btn text icon @click="changeMonth(1)">
<v-icon>{{ keyboard_arrow_right }}</v-icon>
</v-btn>
</v-toolbar-items>
<v-spacer />
<v-toolbar-items>
<v-btn text @click="lockDays(true)">Monat sperren</v-btn>
<v-btn text @click="lockDays(false)">Monat freigeben</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-card v-for="week in month" :key="month.indexOf(week)" tile flat>
<v-card-title class="subtitle-1 font-weight-bold">
Woche vom {{ week.startDate.getDate() }}.{{
week.startDate.getMonth() + 1
}}.{{ week.startDate.getFullYear() }} bis
{{ week.endDate.getDate() }}.{{ week.endDate.getMonth() + 1 }}.{{
week.endDate.getFullYear()
}}
</v-card-title>
<v-card-text>
<v-row justify="start" align="start">
<div v-for="day in week.days" :key="day.id">
<v-col>
<Day v-bind:day="day" />
</v-col>
</div>
</v-row>
</v-card-text>
</v-card>
2020-01-18 11:49:49 +00:00
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
2020-02-22 10:14:54 +00:00
import { mdiChevronLeft, mdiChevronRight } from '@mdi/js'
2020-01-18 11:49:49 +00:00
import Day from './ServiceManagementComponents/Day'
export default {
name: 'ServiceManagement',
components: { Day },
data() {
return {
keyboard_arrow_left: mdiChevronLeft,
keyboard_arrow_right: mdiChevronRight,
2020-01-18 11:49:49 +00:00
id: 0,
date: new Date(),
monthArray: [
2020-01-19 20:31:48 +00:00
'Januar',
'Februar',
'März',
'April',
'Mai',
'Juni',
'Juli',
'August',
'September',
'Oktober',
'November',
'Dezember'
2020-01-18 11:49:49 +00:00
]
}
},
created() {
2020-03-01 20:45:11 +00:00
for (let intDate = 1; intDate < 7; intDate++) {
if (
new Date(
this.date.getFullYear(),
this.date.getMonth(),
intDate
).getDay() === 3
)
2020-03-01 20:45:11 +00:00
if (this.date.getDate() < intDate)
this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0)
}
2020-01-18 11:49:49 +00:00
this.createMonth(this.date)
this.getAllUsers()
},
methods: {
...mapActions({
createMonth: 'sm/createMonth',
2020-02-24 11:19:13 +00:00
getAllUsers: 'sm/getAllUsers',
lockDay: 'sm/lockDay'
2020-01-18 11:49:49 +00:00
}),
changeMonth(value) {
if (value === -1) {
2020-01-19 20:31:48 +00:00
this.date = new Date(this.date.getFullYear(), this.date.getMonth() - 1)
2020-01-18 11:49:49 +00:00
} else {
2020-01-19 20:31:48 +00:00
this.date = new Date(this.date.getFullYear(), this.date.getMonth() + 1)
2020-01-18 11:49:49 +00:00
}
this.createMonth(this.date)
2020-02-24 11:19:13 +00:00
},
lockDays(value) {
for (var week in this.month) {
for (var dayint in this.month[week].days) {
var day = this.month[week].days[dayint]
this.lockDay({
year: day.date.getFullYear(),
month: day.date.getMonth() + 1,
day: day.date.getDate(),
locked: value
})
2020-02-24 11:19:13 +00:00
}
}
2020-01-18 11:49:49 +00:00
}
},
computed: {
...mapGetters({
2020-02-22 10:14:54 +00:00
month: 'sm/month'
})
2020-01-18 11:49:49 +00:00
}
}
</script>
<style scoped></style>