From 245a8a932e8417a0245a2bd9e7684426f4fec819 Mon Sep 17 00:00:00 2001 From: matthieu Date: Sun, 15 Mar 2026 18:09:20 +0100 Subject: [PATCH] feat(frontend) : integrate documents into TaskModal Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/components/task/TaskModal.vue | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/frontend/components/task/TaskModal.vue b/frontend/components/task/TaskModal.vue index 9f895ef..d640292 100644 --- a/frontend/components/task/TaskModal.vue +++ b/frontend/components/task/TaskModal.vue @@ -121,6 +121,30 @@ /> + + + + + + + import type { Task, TaskWrite } from '~/services/dto/task' +import type { TaskDocument } from '~/services/dto/task-document' import { useGiteaService } from '~/services/gitea' import type { TaskStatus } from '~/services/dto/task-status' import type { TaskEffort } from '~/services/dto/task-effort' @@ -339,6 +364,45 @@ watch(() => props.modelValue, async (open) => { }) const { create, update, remove } = useTaskService() +const { remove: removeDocument } = useTaskDocumentService() +const { t } = useI18n() + +const authStore = useAuthStore() +const isAdmin = computed(() => authStore.user?.roles?.includes('ROLE_ADMIN') ?? false) + +const documents = computed(() => props.task?.documents ?? []) +const previewDoc = ref(null) + +const previewIndex = computed(() => { + if (!previewDoc.value) return -1 + return documents.value.findIndex(d => d.id === previewDoc.value!.id) +}) + +function openPreview(doc: TaskDocument) { + previewDoc.value = doc +} + +function prevPreview() { + if (previewIndex.value > 0) { + previewDoc.value = documents.value[previewIndex.value - 1] + } +} + +function nextPreview() { + if (previewIndex.value < documents.value.length - 1) { + previewDoc.value = documents.value[previewIndex.value + 1] + } +} + +async function handleDeleteDocument(doc: TaskDocument) { + if (!confirm(t('taskDocuments.confirmDeleteMessage'))) return + await removeDocument(doc.id) + emit('saved') +} + +function handleDocumentUploaded() { + emit('saved') +} async function handleDelete() { if (!props.task) return