diff --git a/app/src/plugins/tm@dashboard/_components/z-timeline.vue b/app/src/plugins/tm@dashboard/_components/z-timeline.vue index c9fc2b3..45b31ae 100644 --- a/app/src/plugins/tm@dashboard/_components/z-timeline.vue +++ b/app/src/plugins/tm@dashboard/_components/z-timeline.vue @@ -30,7 +30,7 @@

{{ getHeadingDate(split.date) }}

-

{{ split.firstName }}

+

{{ split.name }}

@@ -42,7 +42,7 @@

{{ split.initials }}

-

{{split.name}}

+

{{split.fullname}}

{{split.unscheduledTime}} h

@@ -64,7 +64,7 @@

{{ event.subtask.master_task?.name || event.subtask.master_task }}

- {{ getUserInitials(event) }} + {{ event.initials }}
{{ event.start.toLocaleDateString('sk-SK') }}
@@ -189,10 +189,6 @@ export default { return date.toLocaleDateString('sk-SK') }, - getUserInitials(event) { - return event.name.charAt(0).toUpperCase() + event.surname.charAt(0).toUpperCase() - }, - getEventLenght(event) { return event.end.getTime() - event.start.getTime() }, diff --git a/app/src/plugins/tm@dashboard/tasks/_utils/timeline.utils.ts b/app/src/plugins/tm@dashboard/tasks/_utils/timeline.utils.ts index b4ec8e0..8f5e220 100644 --- a/app/src/plugins/tm@dashboard/tasks/_utils/timeline.utils.ts +++ b/app/src/plugins/tm@dashboard/tasks/_utils/timeline.utils.ts @@ -40,8 +40,6 @@ export default { start: addDays(new Date(timeblock.start), diffInDays), end: addDays(new Date(timeblock.end), diffInDays), master_task: subtask.master_task, - name: employee.name, - surname: employee.surname, date: new Date(timeblock.start), isWeekend: this.isWeekend(timeblock.start), initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(), diff --git a/app/src/plugins/tm@dashboard/tasks/tasks.vue b/app/src/plugins/tm@dashboard/tasks/tasks.vue index 198db94..f1b4ca2 100644 --- a/app/src/plugins/tm@dashboard/tasks/tasks.vue +++ b/app/src/plugins/tm@dashboard/tasks/tasks.vue @@ -47,12 +47,12 @@ export default { workingHours[task.split] += timelineUtils._getDifferenceInHours(task.end, task.start) }) - for (let i = 1; i <= 7; i++) { + for (let i = 0; i < 7; i++) { days.push({ - id: i , - name: this.filter.employee.name + " " + this.filter.employee.surname, + id: i + 1, + fullname: `${this.filter.employee.name} ${this.filter.employee.surname}`, initials: this.filter.employee.name.charAt(0).toUpperCase() + this.filter.employee.surname.charAt(0).toUpperCase(), - unscheduledTime: capacityPerDay - workingHours[i], + unscheduledTime: capacityPerDay - workingHours[i + 1], date: addDays(this.filter.start, i), isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i)) }) @@ -108,6 +108,7 @@ export default { try { const { subtasks } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`) this.config.scrollHour = this.filter.employee.work_start - 1 + this.config.date = this.filter.start this.subtasks = subtasks } catch (error) { this.$toast.error('Nepodarilo sa nacitat data!') diff --git a/app/src/plugins/tm@dashboard/teams/teams.vue b/app/src/plugins/tm@dashboard/teams/teams.vue index 6d2e78e..f53c7d4 100644 --- a/app/src/plugins/tm@dashboard/teams/teams.vue +++ b/app/src/plugins/tm@dashboard/teams/teams.vue @@ -10,8 +10,9 @@ import ATeamFilter from './_components/a-team-filter.vue' import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.vue' -import { setHours, setMinutes } from 'date-fns' +import { setHours, setMinutes, addDays } from 'date-fns' import moment from 'moment' +import timelineUtils from '../tasks/_utils/timeline.utils' export default { components: { @@ -35,30 +36,37 @@ export default { const days = [] this.filter.team.employees.forEach((employee, index) => { + let workingHours = 0 + const capacityPerDay = employee.work_end - employee.work_start + + this.timelineData.tasks.forEach(task => { + if (task?.subtask?.employee_id == employee.id) + workingHours += timelineUtils._getDifferenceInHours(task.end, task.start) + }) + days.push({ - id: index, - name: `${employee.name} ${employee.surname}`, + id: index + 1, + name: employee.name, + fullname: `${employee.name} ${employee.surname}`, initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(), - unscheduledTime: 111 + unscheduledTime: capacityPerDay - workingHours }) }) return days }, - unscheduledTime() { - return 222 - // if (!this.subtasks) return 0 - - // return timelineUtils.getUnscheduledTime(this.subtasks) - }, - - timelineData() { if (!this.subtasks) return - console.log([...this._generateNonWorking(), ...this._generateTasks()]) + // let unscheduledTime = 0 + // const tasks = [...this._generateNonWorking(), ...this._generateTasks()] + + // tasks.forEach(task => { + // if (!task.nonWorking) + // workingHours += timelineUtils._getDifferenceInHours(task.end, task.start) + // }) return { unscheduledTime: 333, @@ -79,7 +87,7 @@ export default { this.filter.team.employees.forEach((e, index) => { if (e.id == subtask.employee_id) { - split = index + split = index + 1 employee = e } }) @@ -93,11 +101,11 @@ export default { start: new Date(timeblock.start), end: new Date(timeblock.end), master_task: subtask.master_task, - name: employee.name, - surname: employee.surname, + name: employee?.name, + surname: employee?.surname, // date: new Date(timeblock.start), isWeekend: moment(timeblock.start).day() % 6 == 0, - initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(), + initials: employee?.name?.charAt(0)?.toUpperCase() + employee?.surname?.charAt(0)?.toUpperCase(), split: split, project_code: subtask.project_code, subtask: subtask, @@ -111,9 +119,10 @@ export default { }, _generateNonWorking() { - const tasks = [] - let earliestStartHour = null - const date = new Date(this.filter.start) + const tasks = [] + const date = new Date(this.filter.start) + let earliestStartHour = null + this.config.date = date this.filter.team.employees.forEach((employee, index) => { if (!earliestStartHour || employee.work_start < earliestStartHour) @@ -123,7 +132,7 @@ export default { title: "Non working hours", start: setMinutes(setHours(date, 0), 0), end: setMinutes(setHours(date, employee.work_start), 0), - split: index, + split: index + 1, nonWorking: true, draggable: false }) @@ -132,7 +141,7 @@ export default { title: "Non working hours", start: setMinutes(setHours(date, employee.work_end), 0), end: setMinutes(setHours(date, 23), 59), - split: index, + split: index + 1, nonWorking: true, draggable: false }) diff --git a/app/src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue b/app/src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue index 7e475c8..eaca7f9 100644 --- a/app/src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue +++ b/app/src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue @@ -28,7 +28,7 @@

Pridať dátum

- +
diff --git a/app/src/plugins/w/auth/auth.store.ts b/app/src/plugins/w/auth/auth.store.ts index f53cf88..a144723 100644 --- a/app/src/plugins/w/auth/auth.store.ts +++ b/app/src/plugins/w/auth/auth.store.ts @@ -1,5 +1,5 @@ import axios from '@/plugins/w/axios/models/axios' -import './refreshExpired' +// import './refreshExpired' export default { namespaced: true, @@ -35,7 +35,7 @@ export default { actions: { login({commit}: {commit: any}, credentials: any) { return new Promise((resolve, reject) => { - axios.post('v1/tokens/create', credentials) + axios.post('v1/tokens/create', {data: credentials}) .then((response: any) => { console.log(response) const token = response.token