From de2ac5a2860bc25180971e7a11f852d9d44675b7 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 6 Aug 2025 04:23:40 +0000
Subject: (대표님) 정기평가, 법적검토, 정책, 가입관련 처리 및 관련 컴포넌트
 추가, 메뉴 변경
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/accepted-quotations-table-columns.tsx    | 298 +++++++++++++--------
 1 file changed, 184 insertions(+), 114 deletions(-)

(limited to 'lib/tech-project-avl/table/accepted-quotations-table-columns.tsx')

diff --git a/lib/tech-project-avl/table/accepted-quotations-table-columns.tsx b/lib/tech-project-avl/table/accepted-quotations-table-columns.tsx
index d38981f6..e73c2163 100644
--- a/lib/tech-project-avl/table/accepted-quotations-table-columns.tsx
+++ b/lib/tech-project-avl/table/accepted-quotations-table-columns.tsx
@@ -47,11 +47,21 @@ export interface AcceptedQuotationItem {
   vendorCode: string | null
   vendorEmail: string | null
   vendorCountry: string | null
+  vendorFlags: {
+    isCustomerPreferred?: boolean;
+    isNewDiscovery?: boolean;
+    isProjectApproved?: boolean;
+    isShiProposal?: boolean;
+  } | null // 벤더 플래그 (JSON)
   
   // Project 정보
   projNm: string | null
   pspid: string | null
   sector: string | null
+  kunnrNm: string | null // 선주명
+  ptype: string | null // 선종코드
+  ptypeNm: string | null // 선종명
+  pjtType: string | null // 프로젝트 타입
   
   // RFQ 아이템 정보
   rfqItems: RfqItemInfo[]
@@ -101,7 +111,24 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
   // 3) 데이터 컬럼들 정의
   // ----------------------------------------------------------------
   const dataColumns: ColumnDef<AcceptedQuotationItem>[] = [
-    // 프로젝트 관련 컬럼
+    // 프로젝트 타입
+    {
+      accessorKey: "pjtType",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="프로젝트 타입" />
+      ),
+      cell: ({ row }) => (
+        <div className="font-medium">
+          {row.original.pjtType || "-"}
+        </div>
+      ),
+      enableSorting: true,
+      enableHiding: true,
+      meta: {
+        excelHeader: "프로젝트 타입",
+      },
+    },
+    // 프로젝트 코드
     {
       accessorKey: "pspid",
       header: ({ column }) => (
@@ -118,6 +145,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "프로젝트 코드",
       },
     },
+    // 프로젝트명
     {
       accessorKey: "projNm",
       header: ({ column }) => (
@@ -134,7 +162,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "프로젝트명",
       },
     },
-    // RFQ quotation 관련 컬럼
+    // RFQ 코드
     {
       accessorKey: "rfqCode",
       header: ({ column }) => (
@@ -151,6 +179,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "RFQ 코드",
       },
     },
+    // RFQ 제목
     {
       accessorKey: "description",
       header: ({ column }) => (
@@ -164,111 +193,10 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "RFQ 설명",
-      },
-    },
-    {
-      accessorKey: "rfqType",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="RFQ 타입" />
-      ),
-      cell: ({ row }) => (
-        <div>
-          {row.original.rfqType || "-"}
-        </div>
-      ),
-      enableSorting: true,
-      enableHiding: true,
-      meta: {
-        excelHeader: "RFQ 타입",
-      },
-    },
-    {
-      accessorKey: "totalPrice",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="총 금액" />
-      ),
-      cell: ({ row }) => {
-        const price = row.original.totalPrice;
-        const currency = row.original.currency || "USD";
-        return (
-          <div className="text-right font-medium">
-            {price ? `${Number(price).toLocaleString()} ${currency}` : "-"}
-          </div>
-        );
-      },
-      enableSorting: true,
-      enableHiding: true,
-      meta: {
-        excelHeader: "총 금액",
-      },
-    },
-    {
-      accessorKey: "status",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="상태" />
-      ),
-      cell: ({ row }) => (
-        <Badge variant="default" className="bg-green-100 text-green-800">
-          {row.original.status}
-        </Badge>
-      ),
-      enableSorting: true,
-      enableHiding: true,
-      meta: {
-        excelHeader: "상태",
+        excelHeader: "RFQ 제목",
       },
     },
-    // 협력업체 관련 컬럼
-    {
-      accessorKey: "vendorName",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="업체명" />
-      ),
-      cell: ({ row }) => (
-        <div className="font-medium">
-          {row.original.vendorName}
-        </div>
-      ),
-      enableSorting: true,
-      enableHiding: true,
-      meta: {
-        excelHeader: "업체명",
-      },
-    },
-    {
-      accessorKey: "vendorCode",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="업체 코드" />
-      ),
-      cell: ({ row }) => (
-        <div>
-          {row.original.vendorCode || "-"}
-        </div>
-      ),
-      enableSorting: true,
-      enableHiding: true,
-      meta: {
-        excelHeader: "업체 코드",
-      },
-    },
-    {
-      accessorKey: "vendorCountry",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="업체 국가" />
-      ),
-      cell: ({ row }) => (
-        <div>
-          {row.original.vendorCountry || "-"}
-        </div>
-      ),
-      enableSorting: true,
-      enableHiding: true,
-      meta: {
-        excelHeader: "업체 국가",
-      },
-    },
-    // 아이템 관련 컬럼
+    // 자재그룹
     {
       accessorKey: "materialGroup",
       header: ({ column }) => (
@@ -287,6 +215,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "자재그룹",
       },
     },
+    // 공종
     {
       accessorKey: "workType",
       header: ({ column }) => (
@@ -305,6 +234,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "공종",
       },
     },
+    // 선종
     {
       accessorKey: "shipType",
       header: ({ column }) => (
@@ -323,6 +253,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "선종",
       },
     },
+    // 자재명
     {
       accessorKey: "itemName",
       header: ({ column }) => (
@@ -341,6 +272,7 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "자재명",
       },
     },
+    // 자재명(상세)
     {
       accessorKey: "itemDetail",
       header: ({ column }) => (
@@ -359,37 +291,175 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "자재명(상세)",
       },
     },
-    // metadata 관련 컬럼
+    // 협력업체명
     {
-      accessorKey: "dueDate",
+      accessorKey: "vendorName",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="RFQ 마감일" />
+        <DataTableColumnHeaderSimple column={column} title="협력업체명" />
+      ),
+      cell: ({ row }) => (
+        <div className="font-medium">
+          {row.original.vendorName}
+        </div>
+      ),
+      enableSorting: true,
+      enableHiding: true,
+      meta: {
+        excelHeader: "협력업체명",
+      },
+    },
+                // 벤더 유형
+            {
+              accessorKey: "vendorFlags",
+              header: ({ column }) => (
+                <DataTableColumnHeaderSimple column={column} title="벤더 유형" />
+              ),
+              cell: ({ row }) => {
+                const vendorFlags = row.original.vendorFlags;
+                
+                if (!vendorFlags) {
+                  return <div className="text-muted-foreground">-</div>;
+                }
+                
+                const activeFlags = [];
+                
+                if (vendorFlags.isCustomerPreferred) {
+                  activeFlags.push({ key: "isCustomerPreferred", label: "고객선호", variant: "outline" as const });
+                }
+                if (vendorFlags.isNewDiscovery) {
+                  activeFlags.push({ key: "isNewDiscovery", label: "신규발굴", variant: "outline" as const });
+                }
+                if (vendorFlags.isProjectApproved) {
+                  activeFlags.push({ key: "isProjectApproved", label: "프로젝트승인", variant: "outline" as const });
+                }
+                if (vendorFlags.isShiProposal) {
+                  activeFlags.push({ key: "isShiProposal", label: "SHI제안", variant: "outline" as const });
+                }
+                
+                if (activeFlags.length === 0) {
+                  return <div className="text-muted-foreground">-</div>;
+                }
+                
+                return (
+                  <div className="flex flex-wrap gap-1">
+                    {activeFlags.map((flag) => (
+                      <Badge key={flag.key} variant={flag.variant} className="text-xs">
+                        {flag.label}
+                      </Badge>
+                    ))}
+                  </div>
+                );
+              },
+              enableSorting: true,
+              enableHiding: true,
+              meta: {
+                excelHeader: "협력업체 유형",
+              },
+            },
+    // 협력업체 코드
+    {
+      accessorKey: "vendorCode",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="협력업체 코드" />
       ),
       cell: ({ row }) => (
         <div>
-          {row.original.dueDate ? formatDate(row.original.dueDate) : "-"}
+          {row.original.vendorCode || "-"}
+        </div>
+      ),
+      enableSorting: true,
+      enableHiding: true,
+      meta: {
+        excelHeader: "협력업체 코드",
+      },
+    },
+    // 협력업체 국가
+    {
+      accessorKey: "vendorCountry",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="협력업체 국가" />
+      ),
+      cell: ({ row }) => (
+        <div>
+          {row.original.vendorCountry || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "RFQ 마감일",
+        excelHeader: "협력업체 국가",
       },
     },
+        // 총 금액
+        {
+          accessorKey: "totalPrice",
+          header: ({ column }) => (
+            <DataTableColumnHeaderSimple column={column} title="총 금액" />
+          ),
+          cell: ({ row }) => {
+            const price = row.original.totalPrice;
+            const currency = row.original.currency || "USD";
+            return (
+              <div className="text-right font-medium">
+                {price ? `${Number(price).toLocaleString()} ${currency}` : "-"}
+              </div>
+            );
+          },
+          enableSorting: true,
+          enableHiding: true,
+          meta: {
+            excelHeader: "총 금액",
+          },
+        },
+        // 상태
+        {
+          accessorKey: "status",
+          header: ({ column }) => (
+            <DataTableColumnHeaderSimple column={column} title="상태" />
+          ),
+          cell: ({ row }) => {
+            const status = row.original.status;
+            let badgeVariant: "default" | "secondary" | "destructive" | "outline" = "default";
+            let badgeClassName = "";
+            
+            if (status === "Submitted") {
+              badgeVariant = "secondary";
+              badgeClassName = "bg-blue-100 text-blue-800";
+            } else if (status === "Accepted") {
+              badgeVariant = "default";
+              badgeClassName = "bg-green-100 text-green-800";
+            } else {
+              badgeVariant = "outline";
+              badgeClassName = "bg-gray-100 text-gray-800";
+            }
+            
+            return (
+              <Badge variant={badgeVariant} className={badgeClassName}>
+                {status}
+              </Badge>
+            );
+          },
+          enableSorting: true,
+          enableHiding: true,
+          meta: {
+            excelHeader: "상태",
+          },
+        },
+    // RFQ 제출일
     {
-      accessorKey: "acceptedAt",
+      accessorKey: "submittedAt",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="RFQ 승인일" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 제출일" />
       ),
       cell: ({ row }) => (
         <div>
-          {row.original.acceptedAt ? formatDate(row.original.acceptedAt) : "-"}
+          {row.original.submittedAt ? formatDate(row.original.submittedAt) : "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "RFQ 승인일",
+        excelHeader: "RFQ 제출일",
       },
     },
   ]
-- 
cgit v1.2.3

