feat(timeline): add support for showing draft tasks in employee timeline

This commit is contained in:
Matej Glasnák committed 2026-01-19 16:23:49 +01:00
1 parent ec4175230a
commit 959e3de901
3 files changed
+9 -1

No files matched your search

@@ -25,6 +25,7 @@ export function useEmployeeTimeline(
currentTimeblock: Ref<Timeblock | null>, currentTimeblock: Ref<Timeblock | null>,
otherLocalTimeblocks?: Ref<Timeblock[]>, otherLocalTimeblocks?: Ref<Timeblock[]>,
editingBlockerId?: Ref<number | null>, editingBlockerId?: Ref<number | null>,
showDraftTasks?: Ref<boolean>,
) { ) {
// Fetch employee's tasks for the selected date // Fetch employee's tasks for the selected date
const { const {
@@ -107,6 +108,7 @@ export function useEmployeeTimeline(
const emp = unref(employee); const emp = unref(employee);
const d = unref(date); const d = unref(date);
const excludeBlockerId = editingBlockerId ? unref(editingBlockerId) : null; const excludeBlockerId = editingBlockerId ? unref(editingBlockerId) : null;
const includeDrafts = showDraftTasks ? unref(showDraftTasks) : false;
if (!data || !conceptData || !emp || !d) { if (!data || !conceptData || !emp || !d) {
return []; return [];
@@ -115,7 +117,8 @@ export function useEmployeeTimeline(
const subtasks = [ const subtasks = [
...(data.subtasks || []), ...(data.subtasks || []),
...(data.blockers || []), ...(data.blockers || []),
...(conceptData.subtasks || []), // Only include concept tasks if showDraftTasks is true
...(includeDrafts ? (conceptData.subtasks || []) : []),
]; ];
const selectedDateStr = moment(d).format('YYYY-MM-DD'); const selectedDateStr = moment(d).format('YYYY-MM-DD');
@@ -117,6 +117,7 @@
:employee="employee" :employee="employee"
:deletable="false" :deletable="false"
:index="0" :index="0"
:show-draft-tasks="!!subtask.is_draft"
/> />
</v-card-text> </v-card-text>
@@ -77,6 +77,7 @@ interface Props {
currentIndex?: number; currentIndex?: number;
deletable?: boolean; deletable?: boolean;
index?: number; index?: number;
showDraftTasks?: boolean; // Whether to show draft/concept tasks on timeline
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
@@ -87,6 +88,7 @@ const props = withDefaults(defineProps<Props>(), {
currentIndex: 0, currentIndex: 0,
deletable: false, deletable: false,
index: 0, index: 0,
showDraftTasks: false,
}); });
const emit = defineEmits<{ const emit = defineEmits<{
@@ -238,6 +240,7 @@ const otherTimeblocksForSameDate = computed(() => {
// Use timeline composable // Use timeline composable
const editingBlockerIdRef = computed(() => props.editingBlockerId); const editingBlockerIdRef = computed(() => props.editingBlockerId);
const showDraftTasksRef = computed(() => props.showDraftTasks);
const { const {
isLoading, isLoading,
@@ -253,6 +256,7 @@ const {
timeblockRef, timeblockRef,
otherTimeblocksForSameDate, otherTimeblocksForSameDate,
editingBlockerIdRef, editingBlockerIdRef,
showDraftTasksRef,
); );
// Force refetch when date changes // Force refetch when date changes