From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 28 Apr 2025 02:13:30 +0000 Subject: ~20250428 작업사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/pq/client-pq-input-wrapper.tsx | 24 ++++++++++++------------ components/pq/pq-review-detail.tsx | 9 ++++++++- components/pq/pq-review-table.tsx | 6 +++++- 3 files changed, 25 insertions(+), 14 deletions(-) (limited to 'components/pq') diff --git a/components/pq/client-pq-input-wrapper.tsx b/components/pq/client-pq-input-wrapper.tsx index 89f0fa78..42d2420d 100644 --- a/components/pq/client-pq-input-wrapper.tsx +++ b/components/pq/client-pq-input-wrapper.tsx @@ -9,7 +9,7 @@ import { PQGroupData, ProjectPQ } from "@/lib/pq/service" import { useRouter, useSearchParams } from "next/navigation" interface ClientPQWrapperProps { - allPQData: PQGroupData[] + pqData: PQGroupData[] // 변경: allPQData → pqData (현재 선택된 PQ 데이터) projectPQs: ProjectPQ[] vendorId: number rawSearchParams: { @@ -18,7 +18,7 @@ interface ClientPQWrapperProps { } export function ClientPQWrapper({ - allPQData, + pqData, projectPQs, vendorId, rawSearchParams @@ -28,16 +28,12 @@ export function ClientPQWrapper({ // 클라이언트 측에서 projectId 파싱 const projectId = projectIdParam ? parseInt(projectIdParam, 10) : undefined - + // 현재 프로젝트 정보 찾기 const currentProject = projectId ? projectPQs.find(p => p.projectId === projectId) : null - - // 필요한 경우 여기서 PQ 데이터를 필터링할 수 있음 - // 예: 모든 데이터를 가져왔는데 현재 projectId에 따라 필터링이 필요한 경우 - // const filteredPQData = projectId ? allPQData.filter(...) : allPQData; - + return ( {/* 헤더 - 프로젝트 정보 포함 */} @@ -54,7 +50,7 @@ export function ClientPQWrapper({ PQ에 적절한 응답을 제출하시기 바랍니다.

- + {/* 일반/프로젝트 PQ 선택 탭 */} {projectPQs.length > 0 && (
@@ -65,7 +61,11 @@ export function ClientPQWrapper({ {projectPQs.map(project => ( - + {project.projectCode} @@ -75,11 +75,11 @@ export function ClientPQWrapper({
)} - + {/* PQ 입력 탭 */} }> (data) @@ -272,7 +277,9 @@ export default function VendorPQAdminReview({ vendorId: vendor.id, projectId: pqType === 'project' ? projectId : undefined, comment: itemComments, - generalComment: requestComment || undefined + generalComment: requestComment || undefined, + reviewerName, + reviewerId }); if (res.ok) { diff --git a/components/pq/pq-review-table.tsx b/components/pq/pq-review-table.tsx index e778cf91..08b4de61 100644 --- a/components/pq/pq-review-table.tsx +++ b/components/pq/pq-review-table.tsx @@ -25,6 +25,7 @@ import { addReviewCommentAction, getItemReviewLogsAction } from "@/lib/pq/servic import { useToast } from "@/hooks/use-toast" import { formatDate } from "@/lib/utils" import { downloadFileAction } from "@/lib/downloadFile" +import { useSession } from "next-auth/react" interface ReviewLog { id: number @@ -189,6 +190,9 @@ function ItemReviewButton({ answerId, checkPoint, onCommentAdded }: ItemReviewBu const [newComment, setNewComment] = React.useState(""); const [isLoading, setIsLoading] = React.useState(false); const [hasComments, setHasComments] = React.useState(false); + const { data: session } = useSession() + const reviewerName = session?.user?.name || "Unknown Reviewer" + const reviewerId = session?.user?.id // If there's no answerId, item wasn't answered if (!answerId) { @@ -258,7 +262,7 @@ function ItemReviewButton({ answerId, checkPoint, onCommentAdded }: ItemReviewBu const res = await addReviewCommentAction({ answerId, comment: newComment, - reviewerName: "AdminUser", + reviewerName, }); if (res.ok) { -- cgit v1.2.3