From fb3fe1031c2d0af47f437abcd1e9e50cc7bd1129 Mon Sep 17 00:00:00 2001 From: poyrazavsever Date: Fri, 5 Jun 2026 09:47:49 +0300 Subject: [PATCH] feat(tasks): add create task functionality and revalidation for project tasks --- .../projects/[id]/project-detail-client.tsx | 157 +++++++++++++++++- app/(dashboard)/projects/projects-client.tsx | 9 + app/(dashboard)/tasks/actions.ts | 13 ++ 3 files changed, 171 insertions(+), 8 deletions(-) diff --git a/app/(dashboard)/projects/[id]/project-detail-client.tsx b/app/(dashboard)/projects/[id]/project-detail-client.tsx index 5b395ad..0253def 100644 --- a/app/(dashboard)/projects/[id]/project-detail-client.tsx +++ b/app/(dashboard)/projects/[id]/project-detail-client.tsx @@ -6,7 +6,7 @@ import { deleteProjectPlanningSectionRecord, updateProjectPlanningSectionRecord, } from "@/app/(dashboard)/projects/actions"; -import { completeTaskRecord } from "@/app/(dashboard)/tasks/actions"; +import { completeTaskRecord, createTaskRecord } from "@/app/(dashboard)/tasks/actions"; import { Badge, Button, Card, CardContent, Input, Label, Textarea } from "poyraz-ui/atoms"; import { Dialog, @@ -306,7 +306,9 @@ export function ProjectDetailClient({ /> ) : null} - {activeTab === "tasks" ? : null} + {activeTab === "tasks" ? ( + + ) : null} {activeTab === "finance" ? : null} ); @@ -496,15 +498,26 @@ function SectionDialog({ ); } -function TaskPanel({ projectId, tasks }: { projectId: string; tasks: ProjectDetailTaskItem[] }) { +function TaskPanel({ + projectId, + clientId, + tasks, +}: { + projectId: string; + clientId: string | null; + tasks: ProjectDetailTaskItem[]; +}) { return ( -
-

Proje görevleri

-

- Bu proje ile bağlantılı görevler aynı task modülünden beslenir. -

+
+
+

Proje görevleri

+

+ Bu proje ile bağlantılı görevler aynı task modülünden beslenir. +

+
+
{tasks.length > 0 ? ( @@ -569,6 +582,134 @@ function TaskPanel({ projectId, tasks }: { projectId: string; tasks: ProjectDeta ); } +function ProjectTaskDialog({ + projectId, + clientId, +}: { + projectId: string; + clientId: string | null; +}) { + const [open, setOpen] = useState(false); + const [isSubmitting, setIsSubmitting] = useState(false); + + async function handleSubmit(formData: FormData) { + setIsSubmitting(true); + + try { + await createTaskRecord(formData); + setOpen(false); + } finally { + setIsSubmitting(false); + } + } + + return ( + + + + + +
+ + {clientId ? : null} + + Projeye görev ekle + + Yeni görev bu proje ile ilişkilendirilerek görev modülüne kaydedilir. + + + +
+
+ + +
+
+ +