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