[Blockers] Implemented homeoffice, adhoc, vacation blockers

This commit is contained in:
Matej Glasnák committed 2023-04-11 15:14:57 +02:00
1 parent 4a9dfc6520
commit b6f2249440
4 files changed
+26 -23

No files matched your search

@@ -23,8 +23,10 @@ export default {
generateTimelineEvents(subtasks, employee, date) {
let events = []
subtasks.forEach(subtask => {
if (subtask.type == 'blocker') {
if (['blocker', 'adhoc', 'home_office', 'vacation'].includes(subtask.type)) {
events = [...events, ...this._generateEventsFromBlocker(subtask, date)]
} else {
subtask.timeblocks?.forEach((timeblock) => {
@@ -50,6 +52,7 @@ export default {
split: this._getSplitFromDate(date, timeblock.start),
project_code: subtask.project_code,
subtask: subtask,
type: 'subtask',
_timeblock_id: timeblock.id
}
},
@@ -58,8 +61,7 @@ export default {
const start = moment(blocker.start)
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 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'))
@@ -71,7 +73,8 @@ export default {
start: addDays(dStart, diffInDays),
end: addDays(dEnd, diffInDays),
date: new Date(d),
type: 'blocker',
type: blocker.type,
isBlocker: true,
initials: `${blocker.employee?.name[0]}${blocker.employee?.surname[0]}`,
color: '#B00020',
draggable: false
@@ -117,8 +120,6 @@ export default {
})
}
console.log(events)
return events
},