mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
feat(timeline): enhance employee timeline with concept tasks integration and visual differentiation for draft tasks
This commit is contained in:
1 parent
78d4d3c970
commit
0d49225217
3 files changed
+66
-5
No files matched your search
@@ -62,17 +62,60 @@ export function useEmployeeTimeline(
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate timeline tasks from fetched data
|
const {
|
||||||
const timelineTasks = computed(() => {
|
data: conceptTasksData,
|
||||||
const data = unref(tasksData);
|
isLoading: conceptTasksLoading,
|
||||||
|
error: conceptTasksError,
|
||||||
|
refetch: conceptTasksRefetch,
|
||||||
|
} = useQuery({
|
||||||
|
queryKey: computed(() => [
|
||||||
|
'concept-employee-timeline',
|
||||||
|
unref(employee)?.id,
|
||||||
|
unref(date) ? moment(unref(date)).format('YYYY-MM-DD') : null,
|
||||||
|
]),
|
||||||
|
queryFn: async () => {
|
||||||
const emp = unref(employee);
|
const emp = unref(employee);
|
||||||
const d = unref(date);
|
const d = unref(date);
|
||||||
|
|
||||||
if (!data || !emp || !d) {
|
if (!emp?.id || !d) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dateStr = moment(d).format('YYYY-MM-DD');
|
||||||
|
const queryParams = new URLSearchParams({
|
||||||
|
start: dateStr,
|
||||||
|
end: dateStr,
|
||||||
|
employee_id: emp.id.toString(),
|
||||||
|
type: 'draft',
|
||||||
|
}).toString();
|
||||||
|
|
||||||
|
const response = await axios.get_auth(`v1/subtasks?${queryParams}`);
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
enabled: computed(() => {
|
||||||
|
const emp = unref(employee);
|
||||||
|
const d = unref(date);
|
||||||
|
return !!(emp?.id && d);
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Generate timeline tasks from fetched data
|
||||||
|
const timelineTasks = computed(() => {
|
||||||
|
const data = unref(tasksData);
|
||||||
|
const conceptData = unref(conceptTasksData);
|
||||||
|
const emp = unref(employee);
|
||||||
|
const d = unref(date);
|
||||||
|
|
||||||
|
if (!data || !conceptData || !emp || !d) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const subtasks = [...(data.subtasks || []), ...(data.blockers || [])];
|
const subtasks = [
|
||||||
|
...(data.subtasks || []),
|
||||||
|
...(data.blockers || []),
|
||||||
|
...(conceptData.subtasks || []),
|
||||||
|
];
|
||||||
|
|
||||||
const selectedDateStr = moment(d).format('YYYY-MM-DD');
|
const selectedDateStr = moment(d).format('YYYY-MM-DD');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -108,6 +151,7 @@ export function useEmployeeTimeline(
|
|||||||
date: new Date(subtask.start),
|
date: new Date(subtask.start),
|
||||||
project_code: null,
|
project_code: null,
|
||||||
subtask: subtask,
|
subtask: subtask,
|
||||||
|
is_draft: !!subtask.is_draft,
|
||||||
blocker: subtask,
|
blocker: subtask,
|
||||||
type,
|
type,
|
||||||
_timeblock_id: null,
|
_timeblock_id: null,
|
||||||
@@ -138,6 +182,7 @@ export function useEmployeeTimeline(
|
|||||||
date: new Date(timeblock.start),
|
date: new Date(timeblock.start),
|
||||||
project_code: subtask.project_code,
|
project_code: subtask.project_code,
|
||||||
subtask: subtask,
|
subtask: subtask,
|
||||||
|
is_draft: !!subtask.is_draft,
|
||||||
blocker: undefined,
|
blocker: undefined,
|
||||||
type,
|
type,
|
||||||
_timeblock_id: timeblock.id,
|
_timeblock_id: timeblock.id,
|
||||||
@@ -259,6 +304,10 @@ export function useEmployeeTimeline(
|
|||||||
error,
|
error,
|
||||||
refetch,
|
refetch,
|
||||||
|
|
||||||
|
conceptTasksLoading,
|
||||||
|
conceptTasksError,
|
||||||
|
conceptTasksRefetch,
|
||||||
|
|
||||||
// Timeline data
|
// Timeline data
|
||||||
timelineTasks,
|
timelineTasks,
|
||||||
scheduledTime,
|
scheduledTime,
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
'free_day',
|
'free_day',
|
||||||
'office365_blocker',
|
'office365_blocker',
|
||||||
].includes(task.type),
|
].includes(task.type),
|
||||||
|
'scheduled-block--concept': task.is_draft === true,
|
||||||
}"
|
}"
|
||||||
:style="{
|
:style="{
|
||||||
left: `${getTimePosition(task._real_start)}px`,
|
left: `${getTimePosition(task._real_start)}px`,
|
||||||
@@ -213,6 +214,7 @@ interface TimelineTask {
|
|||||||
subtask?: { title: string };
|
subtask?: { title: string };
|
||||||
blocker?: { type: string };
|
blocker?: { type: string };
|
||||||
type?: string;
|
type?: string;
|
||||||
|
is_draft?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CollisionSegment {
|
interface CollisionSegment {
|
||||||
@@ -883,6 +885,9 @@ defineExpose({
|
|||||||
border: 1px solid rgb(156, 0, 28)
|
border: 1px solid rgb(156, 0, 28)
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
|
|
||||||
|
&--concept
|
||||||
|
background: repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(127, 57, 251, 0.3) 10px, rgba(127, 57, 251, 0.3) 20px)
|
||||||
|
|
||||||
.other-timeblock
|
.other-timeblock
|
||||||
position: absolute
|
position: absolute
|
||||||
top: 5px
|
top: 5px
|
||||||
|
|||||||
@@ -242,6 +242,7 @@ const {
|
|||||||
freeTime: _freeTime,
|
freeTime: _freeTime,
|
||||||
timeblockDuration,
|
timeblockDuration,
|
||||||
refetch,
|
refetch,
|
||||||
|
conceptTasksRefetch,
|
||||||
} = useEmployeeTimeline(
|
} = useEmployeeTimeline(
|
||||||
employeeRef,
|
employeeRef,
|
||||||
dateRef,
|
dateRef,
|
||||||
@@ -255,10 +256,16 @@ watch(
|
|||||||
() => {
|
() => {
|
||||||
if (props.modelValue.date && props.employee?.id) {
|
if (props.modelValue.date && props.employee?.id) {
|
||||||
refetch();
|
refetch();
|
||||||
|
conceptTasksRefetch();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
refetch();
|
||||||
|
conceptTasksRefetch();
|
||||||
|
});
|
||||||
|
|
||||||
// All tasks from timelineTasks are already filtered for the selected date
|
// All tasks from timelineTasks are already filtered for the selected date
|
||||||
// Filter out timeblocks that are being edited or deleted locally
|
// Filter out timeblocks that are being edited or deleted locally
|
||||||
const scheduledBlocks = computed(() => {
|
const scheduledBlocks = computed(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user