From 33be47506f0aa62b969d82521580a29e95080268 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 13 Aug 2025 11:05:09 +0000
Subject: (대표님) 입찰, 법무검토, EDP 변경사항 대응, dolce 개선, form-data
 개선, 정규업체 등록관리 추가 (최겸) pq 미사용 컴포넌트 및 페이지 제거, 파일
 라우트에 pq 적용
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/form-data/form-data-table.tsx | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'components/form-data/form-data-table.tsx')

diff --git a/components/form-data/form-data-table.tsx b/components/form-data/form-data-table.tsx
index be37de7a..b2fadacf 100644
--- a/components/form-data/form-data-table.tsx
+++ b/components/form-data/form-data-table.tsx
@@ -33,6 +33,8 @@ import {
 } from "lucide-react";
 import { toast } from "sonner";
 import {
+  getPackageCodeById,
+  getProjectById,
   getProjectCodeById,
   getReportTempList,
   sendFormDataToSEDP,
@@ -220,6 +222,8 @@ export default function DynamicTable({
   // SEDP compare dialog state 
   const [sedpCompareOpen, setSedpCompareOpen] = React.useState(false);
   const [projectCode, setProjectCode] = React.useState<string>('');
+  const [projectType, setProjectType] = React.useState<string>('plant');
+  const [packageCode, setPackageCode] = React.useState<string>('');
 
   // 새로 추가된 Template 다이얼로그 상태
   const [templateDialogOpen, setTemplateDialogOpen] = React.useState(false);
@@ -255,12 +259,26 @@ export default function DynamicTable({
     getTempCount();
   }, [contractItemId, formId, tempUpDialog]);
 
+  React.useEffect(() => {
+    const getPackageCode = async () => {
+      try {
+        const packageCode = await getPackageCodeById(contractItemId);
+        setPackageCode(packageCode || ''); // 빈 문자열이나 다른 기본값
+      } catch (error) {
+        console.error('패키지 조회 실패:', error);
+        setPackageCode('');
+      }
+    };
+  
+    getPackageCode();
+  }, [contractItemId])
   // Get project code when component mounts
   React.useEffect(() => {
     const getProjectCode = async () => {
       try {
-        const code = await getProjectCodeById(projectId);
-        setProjectCode(code);
+        const project = await getProjectById(projectId);
+        setProjectCode(project.code);
+        setProjectType(project.type);
       } catch (error) {
         console.error("Error fetching project code:", error);
         toast.error("Failed to fetch project code");
@@ -911,6 +929,7 @@ export default function DynamicTable({
         formCode={formCode}
         formName={`Form ${formCode}`}
         contractItemId={contractItemId}
+        packageCode={packageCode}
         open={addTagDialogOpen}
         onOpenChange={setAddTagDialogOpen}
       />
@@ -982,6 +1001,8 @@ export default function DynamicTable({
         projectCode={projectCode}
         formCode={formCode}
         fetchTagDataFromSEDP={fetchTagDataFromSEDP}
+        projectType={projectType}
+        packageCode={packageCode}
       />
 
       {/* Other dialogs */}
-- 
cgit v1.2.3

