finished ##188

for sm only send year, month, day. But you have to decrement month to send, because month starts with 0.
Also you have to increment month to get.
This commit is contained in:
Tim Gröger 2020-02-23 11:19:53 +01:00
parent 62af175884
commit dadb31f376
4 changed files with 39 additions and 43 deletions

View File

@ -14,38 +14,12 @@
</v-expand-transition>
<v-expand-transition>
<div v-show="!day.loading">
<!-- <v-autocomplete-->
<!-- chips-->
<!-- return-object-->
<!-- multiple-->
<!-- v-model="day.worker"-->
<!-- item-text="fullName"-->
<!-- label="Dienste"-->
<!-- filled-->
<!-- color="green"-->
<!-- @input="searchInput = null"-->
<!-- :search-input.sync="searchInput"-->
<!-- @blur="focused = false"-->
<!-- @focus="focused = true"-->
<!-- disabled-->
<!-- >-->
<!-- <template v-slot:prepend-inner>-->
<!-- <v-icon>{{ account_add }}</v-icon>-->
<!-- </template>-->
<!-- <template v-slot:selection="data">-->
<!-- <v-chip v-bind="data.attrs" :input-value="data.selected" close>-->
<!-- {{ data.item.firstname }} {{ data.item.lastname }}-->
<!-- </v-chip>-->
<!-- </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-chip style="margin: 3px;" v-for="worker in day.worker" :key="day.worker.indexOf(worker)">{{ worker.firstname }} {{ worker.lastname }}</v-chip>
<v-chip
style="margin: 3px;"
v-for="worker in day.worker"
:key="day.worker.indexOf(worker)"
>{{ worker.firstname }} {{ worker.lastname }}</v-chip
>
</div>
</v-expand-transition>
</v-card-text>
@ -71,7 +45,10 @@ export default {
this.setLoading(this.day.date)
this.getUser({
date: this.day.date.getTime() / 1000,
startdatetime: this.day.date
startdatetime: this.day.date,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
},
methods: {
@ -108,7 +85,10 @@ export default {
day() {
this.getUser({
date: this.day.date.getTime() / 1000,
startdatetime: this.day.date
startdatetime: this.day.date,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
},
worker() {

View File

@ -78,7 +78,10 @@ export default {
this.setLoading(this.day.date)
this.getUser({
date: this.day.date.getTime() / 1000,
startdatetime: this.day.date
startdatetime: this.day.date,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
},
methods: {
@ -99,7 +102,10 @@ export default {
this.deleteUser({
startdatetime: this.day.date,
date: this.day.date.getTime() / 1000,
user: deletedUser
user: deletedUser,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
},
test(event) {
@ -139,7 +145,10 @@ export default {
addedUser = newValue[user]
this.addUser({
date: this.day.date.getTime() / 1000,
user: addedUser
user: addedUser,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
}
}
@ -151,7 +160,10 @@ export default {
this.deleteUser({
startdatetime: this.day.date,
date: this.day.date.getTime() / 1000,
user: deletedUser
user: deletedUser,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
}
}
@ -160,7 +172,10 @@ export default {
day() {
this.getUser({
date: this.day.date.getTime() / 1000,
startdatetime: this.day.date
startdatetime: this.day.date,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
})
},
focused(newVal, oldValue) {

View File

@ -25,7 +25,7 @@ const mutations = {
let week = { id: id, days: {} }
for (let intDay = startDate; intDay <= days + 7; intDay++) {
if (end) break
let currentDate = new Date(year, mon, intDay, 12)
let currentDate = new Date(year, mon, intDay)
switch (currentDate.getDay()) {
case 1:
@ -106,7 +106,7 @@ const mutations = {
state.month = month
},
updateMonth: (state, data) => {
const date = new Date(data.startdatetime)
const date = new Date(data.start.year, data.start.month - 1, data.start.day)
const user = data.user
for (let week = 0; week < state.month.length; week++) {
for (let day in state.month[week].days) {

View File

@ -34,7 +34,7 @@ const mutations = {
let week = { id: id, days: {} }
for (let intDay = startDate; intDay <= days + 7; intDay++) {
if (end) break
let currentDate = new Date(year, mon, intDay, 12)
let currentDate = new Date(year, mon, intDay)
switch (currentDate.getDay()) {
case 1:
@ -148,7 +148,7 @@ const mutations = {
}
},
updateMonth: (state, data) => {
const date = new Date(data.startdatetime)
const date = new Date(data.start.year, data.start.month - 1, data.start.day)
const user = data.user
for (let week = 0; week < state.month.length; week++) {
for (let day in state.month[week].days) {
@ -223,6 +223,7 @@ const actions = {
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
console.log(response.data)
for (let item = 0; item < response.data.length; item++) {
commit('updateMonth', { ...response.data[item], com: 'add' })
}