mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Blockers] Added blockers in tasks view
This commit is contained in:
1 parent
04c42c2762
commit
6654c32da7
9 files changed
+260
-97
No files matched your search
@@ -21,13 +21,17 @@ export default {
|
||||
},
|
||||
|
||||
generateTimelineEvents(subtasks, employee, date) {
|
||||
const events = []
|
||||
let events = []
|
||||
|
||||
subtasks.forEach(subtask => {
|
||||
subtask.timeblocks?.forEach((timeblock) => {
|
||||
events.push(this._composeTimelineEvent(subtask, employee, date, timeblock))
|
||||
})
|
||||
})
|
||||
if (subtask.type == 'blocker') {
|
||||
events = [...events, ...this._generateEventsFromBlocker(subtask, date)]
|
||||
} else {
|
||||
subtask.timeblocks?.forEach((timeblock) => {
|
||||
events.push(this._composeTimelineEvent(subtask, employee, date, timeblock))
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return events
|
||||
},
|
||||
@@ -50,30 +54,72 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
_generateEventsFromBlocker(blocker, date) {
|
||||
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 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'))
|
||||
const dEnd = new Date(moment(d).set({hours: end.hours(), minutes: end.minutes()}).format('YYYY-MM-DD HH:mm'))
|
||||
|
||||
return {
|
||||
blocker,
|
||||
split: this._getSplitFromDate(date, d),
|
||||
start: addDays(dStart, diffInDays),
|
||||
end: addDays(dEnd, diffInDays),
|
||||
date: new Date(d),
|
||||
type: 'blocker',
|
||||
initials: `${blocker.employee?.name[0]}${blocker.employee?.surname[0]}`,
|
||||
color: '#B00020',
|
||||
draggable: false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
console.log(blockers)
|
||||
|
||||
return blockers
|
||||
},
|
||||
|
||||
_getDatesInRange(start, end) {
|
||||
const dates = []
|
||||
|
||||
while (start <= end) {
|
||||
dates.push(moment(start).format('YYYY-MM-DD'))
|
||||
start.add(1, 'day')
|
||||
}
|
||||
|
||||
return dates
|
||||
},
|
||||
|
||||
generateTimelineNonWorkingHours(date, employee) {
|
||||
const nonWorkingHours = []
|
||||
const events = []
|
||||
|
||||
for (let i = 0; i < 7; i++) {
|
||||
nonWorkingHours.push({
|
||||
events.push({
|
||||
title: "Non working hours",
|
||||
start: setMinutes(setHours(date, 0), 0),
|
||||
end: setMinutes(setHours(date, employee.work_start), 0),
|
||||
nonWorking: true,
|
||||
type: 'non-working-hours',
|
||||
split: i + 1,
|
||||
draggable: false
|
||||
})
|
||||
|
||||
nonWorkingHours.push({
|
||||
events.push({
|
||||
title: "Non working hours",
|
||||
start: setMinutes(setHours(date, employee.work_end), 0),
|
||||
end: setMinutes(setHours(date, 23), 59),
|
||||
nonWorking: true,
|
||||
type: 'non-working-hours',
|
||||
split: i + 1,
|
||||
draggable: false
|
||||
})
|
||||
}
|
||||
|
||||
return nonWorkingHours
|
||||
return events
|
||||
},
|
||||
|
||||
_getSplitFromDate(date, start) {
|
||||
|
||||
Reference in new issue
Block a user