mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
feat(timeline): fixed task timeblocks timeline to display draft timeblocks
This commit is contained in:
1 parent
0c407cb903
commit
ec4175230a
1 file changed
+16
-2
@@ -170,8 +170,22 @@ export function useEmployeeTimeline(
|
|||||||
tasks.push(task);
|
tasks.push(task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Process regular subtasks with timeblocks array
|
// Determine the correct timeblocks array based on task type
|
||||||
subtask.timeblocks?.forEach((timeblock: any) => {
|
let timeblocks: any[] | undefined;
|
||||||
|
|
||||||
|
// For draft tasks with employees array, get timeblocks from the matching employee
|
||||||
|
if (subtask.is_draft && Array.isArray(subtask.employees)) {
|
||||||
|
const employeeData = subtask.employees.find(
|
||||||
|
(empData: any) => Number(empData.id) === Number(emp.id),
|
||||||
|
);
|
||||||
|
timeblocks = employeeData?.timeblocks;
|
||||||
|
} else {
|
||||||
|
// For regular tasks, use root-level timeblocks array
|
||||||
|
timeblocks = subtask.timeblocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process timeblocks (same logic for both regular and concept tasks)
|
||||||
|
timeblocks?.forEach((timeblock: any) => {
|
||||||
const timeblockDateStr = moment(timeblock.start).format(
|
const timeblockDateStr = moment(timeblock.start).format(
|
||||||
'YYYY-MM-DD',
|
'YYYY-MM-DD',
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user