mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[Blockers] Implemented homeoffice, adhoc, vacation blockers
This commit is contained in:
1 parent
4a9dfc6520
commit
b6f2249440
4 files changed
+26
-23
No files matched your search
@@ -26,7 +26,7 @@
|
|||||||
<template v-slot:split-label="{ split }">
|
<template v-slot:split-label="{ split }">
|
||||||
<div class="w-100 h-100 d-flex flex-column">
|
<div class="w-100 h-100 d-flex flex-column">
|
||||||
<span v-if="split.date" class="d-flex align-center">
|
<span v-if="split.date" class="d-flex align-center">
|
||||||
<img v-if="getHeadingDate(split.date) == 'Dnes'" :src="require('@/plugins/app/_img/icons/home.svg')" class="mr-2">
|
<img v-if="split.isHomeoffice" :src="require('@/plugins/app/_img/icons/home.svg')" class="mr-2">
|
||||||
<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">
|
||||||
@@ -64,16 +64,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="event.blocker?.type != 'home_office'" class="custom-event-body w-100 h-100 d-flex flex-column justify-space-between" :class="{'short-event' : getEventLength(event) <= 9000000, 'mini-event' : getEventLength(event) <= 5400000, 'micro-event' : getEventLength(event) <= 3600000}" :style="{backgroundColor: event.color || event.subtask.color}">
|
<div v-else-if="['subtask', 'blocker', 'adhoc', 'vacation'].includes(event.type)" class="custom-event-body w-100 h-100 d-flex flex-column justify-space-between" :class="{'short-event' : getEventLength(event) <= 9000000, 'mini-event' : getEventLength(event) <= 5400000, 'micro-event' : getEventLength(event) <= 3600000}" :style="{backgroundColor: event.color || event.subtask.color}">
|
||||||
<div class="event-content" :class="event.type || 'subtask'">
|
<div class="event-content" :class="{'is-blocker': event.isBlocker}">
|
||||||
<template v-if="event.type == 'blocker'">
|
<template v-if="event.type == 'subtask'">
|
||||||
<h3>{{ event.blocker.name }}</h3>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<small v-if="event.subtask.project_code" class="project-code">{{ event.subtask.project_code }}</small>
|
<small v-if="event.subtask.project_code" class="project-code">{{ event.subtask.project_code }}</small>
|
||||||
<h3>{{ event.subtask.master_task?.name || event.subtask.master_task }}</h3>
|
<h3>{{ event.subtask.master_task?.name || event.subtask.master_task }}</h3>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<h3>{{ event.blocker.name }}</h3>
|
||||||
|
</template>
|
||||||
|
|
||||||
<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">
|
||||||
@@ -209,11 +209,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
taskClicked(subtask) {
|
taskClicked(subtask) {
|
||||||
if (subtask.type == 'non-working-hours') return
|
// console.log('task clicked')
|
||||||
// console.log("task", task)
|
|
||||||
if (subtask.end.getTime() - subtask.start.getTime() <= 3600000) {
|
|
||||||
// console.log("ShortTask")
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
eventFocused(event) {
|
eventFocused(event) {
|
||||||
@@ -385,7 +381,7 @@ export default {
|
|||||||
padding: 20px 10px
|
padding: 20px 10px
|
||||||
|
|
||||||
.event-content
|
.event-content
|
||||||
&.blocker
|
&.is-blocker
|
||||||
*
|
*
|
||||||
color: #ffffff !important
|
color: #ffffff !important
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,10 @@ export default {
|
|||||||
generateTimelineEvents(subtasks, employee, date) {
|
generateTimelineEvents(subtasks, employee, date) {
|
||||||
let events = []
|
let events = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subtasks.forEach(subtask => {
|
subtasks.forEach(subtask => {
|
||||||
if (subtask.type == 'blocker') {
|
if (['blocker', 'adhoc', 'home_office', 'vacation'].includes(subtask.type)) {
|
||||||
events = [...events, ...this._generateEventsFromBlocker(subtask, date)]
|
events = [...events, ...this._generateEventsFromBlocker(subtask, date)]
|
||||||
} else {
|
} else {
|
||||||
subtask.timeblocks?.forEach((timeblock) => {
|
subtask.timeblocks?.forEach((timeblock) => {
|
||||||
@@ -50,6 +52,7 @@ export default {
|
|||||||
split: this._getSplitFromDate(date, timeblock.start),
|
split: this._getSplitFromDate(date, timeblock.start),
|
||||||
project_code: subtask.project_code,
|
project_code: subtask.project_code,
|
||||||
subtask: subtask,
|
subtask: subtask,
|
||||||
|
type: 'subtask',
|
||||||
_timeblock_id: timeblock.id
|
_timeblock_id: timeblock.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -58,8 +61,7 @@ export default {
|
|||||||
const start = moment(blocker.start)
|
const start = moment(blocker.start)
|
||||||
const end = moment(blocker.end)
|
const end = moment(blocker.end)
|
||||||
|
|
||||||
const dates = start == end ? [moment(start).format('YYYY-MM-DD')] : this._getDatesInRange(start, end)
|
const dates = start.isSame(end, 'date') ? [moment(start).format('YYYY-MM-DD')] : this._getDatesInRange(start, end)
|
||||||
|
|
||||||
const blockers = dates.map(d => {
|
const blockers = dates.map(d => {
|
||||||
const diffInDays = differenceInCalendarDays(date, new Date(d))
|
const diffInDays = differenceInCalendarDays(date, new Date(d))
|
||||||
const dStart = new Date(moment(d).set({hours: start.hours(), minutes: start.minutes()}).format('YYYY-MM-DD HH:mm'))
|
const dStart = new Date(moment(d).set({hours: start.hours(), minutes: start.minutes()}).format('YYYY-MM-DD HH:mm'))
|
||||||
@@ -71,7 +73,8 @@ export default {
|
|||||||
start: addDays(dStart, diffInDays),
|
start: addDays(dStart, diffInDays),
|
||||||
end: addDays(dEnd, diffInDays),
|
end: addDays(dEnd, diffInDays),
|
||||||
date: new Date(d),
|
date: new Date(d),
|
||||||
type: 'blocker',
|
type: blocker.type,
|
||||||
|
isBlocker: true,
|
||||||
initials: `${blocker.employee?.name[0]}${blocker.employee?.surname[0]}`,
|
initials: `${blocker.employee?.name[0]}${blocker.employee?.surname[0]}`,
|
||||||
color: '#B00020',
|
color: '#B00020',
|
||||||
draggable: false
|
draggable: false
|
||||||
@@ -117,8 +120,6 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(events)
|
|
||||||
|
|
||||||
return events
|
return events
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,18 @@ export default {
|
|||||||
splitDays() {
|
splitDays() {
|
||||||
const days = []
|
const days = []
|
||||||
const workingHours = {}
|
const workingHours = {}
|
||||||
|
const homeoffice = {}
|
||||||
|
|
||||||
|
console.log(this.timelineData.tasks.filter(task => task.type != 'subtask' && task.type != 'non-working-hours'))
|
||||||
|
|
||||||
this.timelineData.tasks.forEach(task => {
|
this.timelineData.tasks.forEach(task => {
|
||||||
if (!workingHours[task.split])
|
if (!workingHours[task.split])
|
||||||
workingHours[task.split] = 0
|
workingHours[task.split] = 0
|
||||||
|
|
||||||
|
if (task.type == 'home_office') {
|
||||||
|
return homeoffice[task.split] = true
|
||||||
|
}
|
||||||
|
|
||||||
if (task.type == 'non-working-hours' || task.subtask?.is_finished || task.blocker?.is_finished)
|
if (task.type == 'non-working-hours' || task.subtask?.is_finished || task.blocker?.is_finished)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -56,6 +63,7 @@ export default {
|
|||||||
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: workingHours[i + 1],
|
unscheduledTime: workingHours[i + 1],
|
||||||
date: addDays(this.filter.start, i),
|
date: addDays(this.filter.start, i),
|
||||||
|
isHomeoffice: homeoffice[i],
|
||||||
isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i))
|
isWeekend: timelineUtils.isWeekend(addDays(this.filter.start, i))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -123,7 +131,7 @@ export default {
|
|||||||
const { subtasks, blockers } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
|
const { subtasks, blockers } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
|
||||||
this.config.scrollHour = (this.filter?.employee.work_start / 60) - 1
|
this.config.scrollHour = (this.filter?.employee.work_start / 60) - 1
|
||||||
this.config.date = this.filter.start
|
this.config.date = this.filter.start
|
||||||
this.subtasks = [...subtasks, ...blockers.map(blocker => ({...blocker, type: 'blocker'}))]
|
this.subtasks = [...subtasks, ...blockers]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error('Nepodarilo sa nacitat data!')
|
this.$toast.error('Nepodarilo sa nacitat data!')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,8 +206,6 @@ export default {
|
|||||||
if (mastertask?.id) {
|
if (mastertask?.id) {
|
||||||
this.mastertask = await this.$axios.get_auth_data(`v1/mastertasks/${mastertask.id}`)
|
this.mastertask = await this.$axios.get_auth_data(`v1/mastertasks/${mastertask.id}`)
|
||||||
|
|
||||||
console.log(this.mastertask)
|
|
||||||
|
|
||||||
// TODO zmazat ked zacne prichadzat project_id a team_id
|
// TODO zmazat ked zacne prichadzat project_id a team_id
|
||||||
const project = this.projects.find((project) => project.code == this.mastertask.project_code)
|
const project = this.projects.find((project) => project.code == this.mastertask.project_code)
|
||||||
this.mastertask.project_id = project.id
|
this.mastertask.project_id = project.id
|
||||||
|
|||||||
Reference in new issue
Block a user