[Teams] Calendar fix

This commit is contained in:
Matej Glasnák committed 2023-02-22 14:43:44 +01:00
1 parent e4abc1fc36
commit c3e7e70da6
6 files changed
+40 -36

No files matched your search

@@ -30,7 +30,7 @@
<p class="weekday-label">{{ getHeadingDate(split.date) }}</p> <p class="weekday-label">{{ getHeadingDate(split.date) }}</p>
</span> </span>
<span v-else class="d-flex align-center"> <span v-else class="d-flex align-center">
<p class="weekday-label">{{ split.firstName }}</p> <p class="weekday-label">{{ split.name }}</p>
</span> </span>
<span v-if="split.date"> <span v-if="split.date">
@@ -42,7 +42,7 @@
<p>{{ split.initials }}</p> <p>{{ split.initials }}</p>
</div> </div>
<div> <div>
<p class="mb-0 mt-0 unscheduled-time-name">{{split.name}}</p> <p class="mb-0 mt-0 unscheduled-time-name">{{split.fullname}}</p>
<h1 class="mb-0 mt-0">{{split.unscheduledTime}} h</h1> <h1 class="mb-0 mt-0">{{split.unscheduledTime}} h</h1>
</div> </div>
</div> </div>
@@ -64,7 +64,7 @@
<h3>{{ event.subtask.master_task?.name || event.subtask.master_task }}</h3> <h3>{{ event.subtask.master_task?.name || event.subtask.master_task }}</h3>
<div class="d-flex align-center event-details event-initials-wrapper"> <div class="d-flex align-center event-details event-initials-wrapper">
<div class="event-initials d-flex justify-center align-center"> <div class="event-initials d-flex justify-center align-center">
<small>{{ getUserInitials(event) }}</small> <small>{{ event.initials }}</small>
</div> </div>
<small class="event-initials-date">{{ event.start.toLocaleDateString('sk-SK') }}</small> <small class="event-initials-date">{{ event.start.toLocaleDateString('sk-SK') }}</small>
</div> </div>
@@ -189,10 +189,6 @@ export default {
return date.toLocaleDateString('sk-SK') return date.toLocaleDateString('sk-SK')
}, },
getUserInitials(event) {
return event.name.charAt(0).toUpperCase() + event.surname.charAt(0).toUpperCase()
},
getEventLenght(event) { getEventLenght(event) {
return event.end.getTime() - event.start.getTime() return event.end.getTime() - event.start.getTime()
}, },
@@ -40,8 +40,6 @@ export default {
start: addDays(new Date(timeblock.start), diffInDays), start: addDays(new Date(timeblock.start), diffInDays),
end: addDays(new Date(timeblock.end), diffInDays), end: addDays(new Date(timeblock.end), diffInDays),
master_task: subtask.master_task, master_task: subtask.master_task,
name: employee.name,
surname: employee.surname,
date: new Date(timeblock.start), date: new Date(timeblock.start),
isWeekend: this.isWeekend(timeblock.start), isWeekend: this.isWeekend(timeblock.start),
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(), initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
+5 -4
View File
@@ -47,12 +47,12 @@ export default {
workingHours[task.split] += timelineUtils._getDifferenceInHours(task.end, task.start) 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({ days.push({
id: i , id: i + 1,
name: this.filter.employee.name + " " + this.filter.employee.surname, fullname: `${this.filter.employee.name} ${this.filter.employee.surname}`,
initials: this.filter.employee.name.charAt(0).toUpperCase() + this.filter.employee.surname.charAt(0).toUpperCase(), 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), date: addDays(this.filter.start, i),
isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i)) isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i))
}) })
@@ -108,6 +108,7 @@ export default {
try { try {
const { subtasks } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`) 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 this.subtasks = subtasks
} catch (error) { } catch (error) {
this.$toast.error('Nepodarilo sa nacitat data!') this.$toast.error('Nepodarilo sa nacitat data!')
+29 -20
View File
@@ -10,8 +10,9 @@
import ATeamFilter from './_components/a-team-filter.vue' import ATeamFilter from './_components/a-team-filter.vue'
import ZTimeline from '@/plugins/tm@dashboard/_components/z-timeline.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 moment from 'moment'
import timelineUtils from '../tasks/_utils/timeline.utils'
export default { export default {
components: { components: {
@@ -35,30 +36,37 @@ export default {
const days = [] const days = []
this.filter.team.employees.forEach((employee, index) => { 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({ days.push({
id: index, id: index + 1,
name: `${employee.name} ${employee.surname}`, name: employee.name,
fullname: `${employee.name} ${employee.surname}`,
initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(), initials: employee.name.charAt(0).toUpperCase() + employee.surname.charAt(0).toUpperCase(),
unscheduledTime: 111 unscheduledTime: capacityPerDay - workingHours
}) })
}) })
return days return days
}, },
unscheduledTime() {
return 222
// if (!this.subtasks) return 0
// return timelineUtils.getUnscheduledTime(this.subtasks)
},
timelineData() { timelineData() {
if (!this.subtasks) if (!this.subtasks)
return 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 { return {
unscheduledTime: 333, unscheduledTime: 333,
@@ -79,7 +87,7 @@ export default {
this.filter.team.employees.forEach((e, index) => { this.filter.team.employees.forEach((e, index) => {
if (e.id == subtask.employee_id) { if (e.id == subtask.employee_id) {
split = index split = index + 1
employee = e employee = e
} }
}) })
@@ -93,11 +101,11 @@ export default {
start: new Date(timeblock.start), start: new Date(timeblock.start),
end: new Date(timeblock.end), end: new Date(timeblock.end),
master_task: subtask.master_task, master_task: subtask.master_task,
name: employee.name, name: employee?.name,
surname: employee.surname, surname: employee?.surname,
// date: new Date(timeblock.start), // date: new Date(timeblock.start),
isWeekend: moment(timeblock.start).day() % 6 == 0, 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, split: split,
project_code: subtask.project_code, project_code: subtask.project_code,
subtask: subtask, subtask: subtask,
@@ -112,8 +120,9 @@ export default {
_generateNonWorking() { _generateNonWorking() {
const tasks = [] const tasks = []
let earliestStartHour = null
const date = new Date(this.filter.start) const date = new Date(this.filter.start)
let earliestStartHour = null
this.config.date = date
this.filter.team.employees.forEach((employee, index) => { this.filter.team.employees.forEach((employee, index) => {
if (!earliestStartHour || employee.work_start < earliestStartHour) if (!earliestStartHour || employee.work_start < earliestStartHour)
@@ -123,7 +132,7 @@ export default {
title: "Non working hours", title: "Non working hours",
start: setMinutes(setHours(date, 0), 0), start: setMinutes(setHours(date, 0), 0),
end: setMinutes(setHours(date, employee.work_start), 0), end: setMinutes(setHours(date, employee.work_start), 0),
split: index, split: index + 1,
nonWorking: true, nonWorking: true,
draggable: false draggable: false
}) })
@@ -132,7 +141,7 @@ export default {
title: "Non working hours", title: "Non working hours",
start: setMinutes(setHours(date, employee.work_end), 0), start: setMinutes(setHours(date, employee.work_end), 0),
end: setMinutes(setHours(date, 23), 59), end: setMinutes(setHours(date, 23), 59),
split: index, split: index + 1,
nonWorking: true, nonWorking: true,
draggable: false draggable: false
}) })
@@ -28,7 +28,7 @@
<v-card> <v-card>
<div class="d-flex justify-space-between align-center"> <div class="d-flex justify-space-between align-center">
<h1>Pridať dátum</h1> <h1>Pridať dátum</h1>
<v-icon @click.stop="clsoeModal()" icon="mdi-close" size="large"></v-icon> <v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon>
</div> </div>
<v-card-actions class="mt-10 d-flex flex-column modal-content"> <v-card-actions class="mt-10 d-flex flex-column modal-content">
+2 -2
View File
@@ -1,5 +1,5 @@
import axios from '@/plugins/w/axios/models/axios' import axios from '@/plugins/w/axios/models/axios'
import './refreshExpired' // import './refreshExpired'
export default { export default {
namespaced: true, namespaced: true,
@@ -35,7 +35,7 @@ export default {
actions: { actions: {
login({commit}: {commit: any}, credentials: any) { login({commit}: {commit: any}, credentials: any) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.post('v1/tokens/create', credentials) axios.post('v1/tokens/create', {data: credentials})
.then((response: any) => { .then((response: any) => {
console.log(response) console.log(response)
const token = response.token const token = response.token