diff --git a/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue b/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue index 8b42396..09dcd59 100644 --- a/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue +++ b/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue @@ -33,9 +33,9 @@ import { addDays, subDays } from 'date-fns' export default { props: { unscheduledTime: { - type: Number, + type: String, default() { - return 0 + return '0' } } }, @@ -59,11 +59,17 @@ export default { }, created() { - this._getEmployees() - this._getWeek() + this._getData() }, methods: { + async _getData() { + await this._getEmployees() + this._getWeek() + this.$nextTick(() => { + this.$emit('dataChanged', {firstDay: this.firstDay, employeeId: this.selectedEmployee}) + }) + }, async _getEmployees() { this.employees = await this.$axios.get_auth_data('v1/employees') this.employees.forEach(employee => { @@ -71,12 +77,12 @@ export default { }) }, - _getWeek() { + _getWeek(emitDataChanged = true) { this.firstDay = subDays(this.date, 1) this.lastDay = addDays(this.date, 5) - this.$emit('weekChange', {firstDay: this.firstDay, lastDay: this.lastDay}) this.selectedDate = String(this.firstDay.toLocaleDateString('sk-SK') + ' - ' + this.lastDay.toLocaleDateString('sk-SK')) + if (emitDataChanged) this.$emit('dataChanged', {firstDay: this.firstDay, employeeId: this.selectedEmployee}) }, prevWeek() { @@ -88,6 +94,12 @@ export default { this.date = addDays(this.date, 7) this._getWeek() } + }, + + watch: { + selectedTeam() { + this.$emit('dataChanged', {firstDay: this.firstDay, employeeId: this.selectedEmployee}) + } } } diff --git a/app/src/plugins/tm@dashboard/tasks/tasks.vue b/app/src/plugins/tm@dashboard/tasks/tasks.vue index 44cf48a..15678c9 100644 --- a/app/src/plugins/tm@dashboard/tasks/tasks.vue +++ b/app/src/plugins/tm@dashboard/tasks/tasks.vue @@ -1,6 +1,6 @@