mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[tasks overview] praca s datami
This commit is contained in:
1 parent
7a4aed7919
commit
2150f464cd
5 files changed
+119
-104
No files matched your search
@@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<A-task-filter @weekChange="getWeekData" />
|
||||
<W-loadable :content="timelineData" class="w-loadable" empty-message="Nepodarilo sa nacitat data!">
|
||||
<Z-timeline :events="timelineData" />
|
||||
<Z-timeline :calData="timelineData" :calConfig="config" />
|
||||
</W-loadable>
|
||||
|
||||
<v-snackbar
|
||||
@@ -31,20 +31,40 @@ export default {
|
||||
timelineData: null,
|
||||
errorToast: false,
|
||||
dataLoaded: false,
|
||||
config: {
|
||||
date: new Date(),
|
||||
startHour: 8,
|
||||
endHour: 16,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getWeekData(week) {
|
||||
this.config.date = week.firstDay
|
||||
try {
|
||||
this.timelineData = await this.$axios.get_auth_data('v1/overview/tasks')
|
||||
console.log(this.timelineData)
|
||||
this.formatData()
|
||||
} catch(error) {
|
||||
this.timelineData = {}
|
||||
console.error(error)
|
||||
this.errorToast = true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
formatData() {
|
||||
// format events
|
||||
this.timelineData.dates.forEach(event => {
|
||||
event.start = new Date(event.starts_at)
|
||||
event.end = new Date(event.ends_at)
|
||||
delete event.starts_at
|
||||
delete event.ends_at
|
||||
})
|
||||
|
||||
// format working hours
|
||||
this.config.startHour = Number(this.timelineData.work_hours_from.split(':')[0]) - 1
|
||||
this.config.endHour = Number(this.timelineData.work_hours_to.split(':')[0]) + 1
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user