From dadb31f3769d743caaf1fc0d7e804960bd1b8fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 23 Feb 2020 11:19:53 +0100 Subject: [PATCH] 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. --- src/components/user/Jobs/Day.vue | 48 ++++++------------- .../ServiceManagementComponents/Day.vue | 25 ++++++++-- src/store/modules/jobs.js | 4 +- src/store/modules/serviceManagement.js | 5 +- 4 files changed, 39 insertions(+), 43 deletions(-) diff --git a/src/components/user/Jobs/Day.vue b/src/components/user/Jobs/Day.vue index a7c8138..cd3edaa 100644 --- a/src/components/user/Jobs/Day.vue +++ b/src/components/user/Jobs/Day.vue @@ -14,38 +14,12 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{ worker.firstname }} {{ worker.lastname }} + {{ worker.firstname }} {{ worker.lastname }}
@@ -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() { diff --git a/src/components/vorstand/ServiceManagementComponents/Day.vue b/src/components/vorstand/ServiceManagementComponents/Day.vue index 2142525..264cfaa 100644 --- a/src/components/vorstand/ServiceManagementComponents/Day.vue +++ b/src/components/vorstand/ServiceManagementComponents/Day.vue @@ -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) { diff --git a/src/store/modules/jobs.js b/src/store/modules/jobs.js index 319a77b..0f35f6b 100644 --- a/src/store/modules/jobs.js +++ b/src/store/modules/jobs.js @@ -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) { diff --git a/src/store/modules/serviceManagement.js b/src/store/modules/serviceManagement.js index 2b1b82e..dde6eae 100644 --- a/src/store/modules/serviceManagement.js +++ b/src/store/modules/serviceManagement.js @@ -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' }) }