[Projects] Added filters

This commit is contained in:
Matej Glasnák committed 2023-03-01 14:19:33 +01:00
1 parent 919b2eebbe
commit 302286bff8
29 files changed
+508 -350

No files matched your search

+8 -12
View File
@@ -9,10 +9,8 @@
import ATaskFilter from './_components/a-tasks-filter.vue'
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue'
import { addDays, subDays } from 'date-fns'
import { mapGetters } from 'vuex'
import moment from 'moment'
import timelineUtils from './_utils/timeline.utils'
import tmUtils from '@/plugins/tm@_utils/tm.utils'
export default {
components: {
@@ -81,21 +79,18 @@ export default {
},
mounted() {
this.$events.on('on-subtask-edited', (subtask) => {
this.subtasks = this.subtasks.map(st => {
if (st.id == subtask.id)
return subtask
return st
})
this.$events.on('on-subtask-edited', () => {
this.onFilterChanged(this.filter)
})
},
unmounted() {
this.$events.off('on-subtask-edited')
},
methods: {
async onFilterChanged(filter) {
this.filter = filter
const urlQueryObject = {}
if (filter.start) urlQueryObject.start = moment(filter.start).format('YYYY-MM-DD')
@@ -106,10 +101,11 @@ export default {
try {
const { subtasks } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
this.config.scrollHour = this.filter.employee.work_start - 1
this.config.scrollHour = this.filter?.employee.work_start - 1
this.config.date = this.filter.start
this.subtasks = subtasks
} catch (error) {
console.log(error)
this.$toast.error('Nepodarilo sa nacitat data!')
}
}