From 6c549b0f264e9be4d60af38f9efc05b189d6849f Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 5 Aug 2025 03:29:00 +0000
Subject: (최겸) 기술영업 견적 Result 전송 업데이트
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/accepted-quotations-table-columns.tsx    | 238 ++++++++++++++-------
 1 file changed, 156 insertions(+), 82 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 dae19395..d38981f6 100644
--- a/lib/tech-project-avl/table/accepted-quotations-table-columns.tsx
+++ b/lib/tech-project-avl/table/accepted-quotations-table-columns.tsx
@@ -9,12 +9,20 @@ import {
 } from "@/components/ui/dropdown-menu"
 import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
 
+// RFQ 아이템 정보 타입
+export interface RfqItemInfo {
+  itemCode: string
+  workType: string
+  itemList: string
+  subItemList: string
+  shipTypes: string
+}
+
 // Accepted Quotation 타입 정의
 export interface AcceptedQuotationItem {
   id: number
   rfqId: number
   vendorId: number
-  quotationCode: string | null
   quotationVersion: number | null
   totalPrice: string | null
   currency: string | null
@@ -44,6 +52,19 @@ export interface AcceptedQuotationItem {
   projNm: string | null
   pspid: string | null
   sector: string | null
+  
+  // RFQ 아이템 정보
+  rfqItems: RfqItemInfo[]
+  
+  // 확장된 아이템 정보
+  itemIndex: number
+  totalItems: number
+  isExpanded: boolean
+  itemCode: string
+  workType: string
+  itemList: string
+  subItemList: string
+  shipTypes: string
 }
 
 export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
@@ -76,130 +97,90 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
     enableHiding: false,
   }
 
-  // ----------------------------------------------------------------
-  // 2) actions 컬럼 (Dropdown 메뉴)
-  // ----------------------------------------------------------------
-  // const actionsColumn: ColumnDef<AcceptedQuotationItem> = {
-  //   id: "actions",
-  //   cell: ({ row }) => (
-  //     <DropdownMenu>
-  //       <DropdownMenuTrigger asChild>
-  //         <Button
-  //           aria-label="Open menu"
-  //           variant="ghost"
-  //           className="flex size-8 p-0 data-[state=open]:bg-muted"
-  //         >
-  //           <Ellipsis className="size-4" aria-hidden="true" />
-  //         </Button>
-  //       </DropdownMenuTrigger>
-  //       <DropdownMenuContent align="end" className="w-40">
-  //         <DropdownMenuItem
-  //           onSelect={() => setRowAction({ row, type: "open" })}
-  //         >
-  //           견적서 보기
-  //         </DropdownMenuItem>
-  //       </DropdownMenuContent>
-  //     </DropdownMenu>
-  //   ),
-  //   size: 40,
-  //   enableSorting: false,
-  //   enableHiding: false,
-  // }
-
   // ----------------------------------------------------------------
   // 3) 데이터 컬럼들 정의
   // ----------------------------------------------------------------
   const dataColumns: ColumnDef<AcceptedQuotationItem>[] = [
+    // 프로젝트 관련 컬럼
     {
-      accessorKey: "rfqCode",
+      accessorKey: "pspid",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="RFQ 코드" />
+        <DataTableColumnHeaderSimple column={column} title="프로젝트 코드" />
       ),
       cell: ({ row }) => (
         <div className="font-medium">
-          {row.original.rfqCode || "-"}
+          {row.original.pspid || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "RFQ 코드",
+        excelHeader: "프로젝트 코드",
       },
     },
     {
-      accessorKey: "description",
+      accessorKey: "projNm",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="RFQ 설명" />
+        <DataTableColumnHeaderSimple column={column} title="프로젝트명" />
       ),
       cell: ({ row }) => (
         <div className="max-w-32 truncate">
-          {row.original.description || "-"}
+          {row.original.projNm || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "RFQ 설명",
+        excelHeader: "프로젝트명",
       },
     },
+    // RFQ quotation 관련 컬럼
     {
-      accessorKey: "rfqType",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="RFQ 타입" />
-      ),
-      cell: ({ row }) => (
-        <div>
-          {row.original.rfqType || "-"}
-        </div>
-      ),
-      enableSorting: true,
-    },
-    {
-      accessorKey: "vendorName",
+      accessorKey: "rfqCode",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="업체명" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 코드" />
       ),
       cell: ({ row }) => (
         <div className="font-medium">
-          {row.original.vendorName}
+          {row.original.rfqCode || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "업체명",
+        excelHeader: "RFQ 코드",
       },
     },
     {
-      accessorKey: "vendorCode",
+      accessorKey: "description",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="업체 코드" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 제목" />
       ),
       cell: ({ row }) => (
-        <div>
-          {row.original.vendorCode || "-"}
+        <div className="max-w-32 truncate">
+          {row.original.description || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "업체 코드",
+        excelHeader: "RFQ 설명",
       },
     },
     {
-      accessorKey: "quotationCode",
+      accessorKey: "rfqType",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="견적서 코드" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 타입" />
       ),
       cell: ({ row }) => (
         <div>
-          {row.original.quotationCode || "-"}
+          {row.original.rfqType || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "견적서 코드",
+        excelHeader: "RFQ 타입",
       },
     },
     {
@@ -238,42 +219,43 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
         excelHeader: "상태",
       },
     },
+    // 협력업체 관련 컬럼
     {
-      accessorKey: "projNm",
+      accessorKey: "vendorName",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="프로젝트명" />
+        <DataTableColumnHeaderSimple column={column} title="업체명" />
       ),
       cell: ({ row }) => (
-        <div className="max-w-32 truncate">
-          {row.original.projNm || "-"}
+        <div className="font-medium">
+          {row.original.vendorName}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "프로젝트명",
+        excelHeader: "업체명",
       },
     },
     {
-      accessorKey: "materialCode",
+      accessorKey: "vendorCode",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="자재 코드" />
+        <DataTableColumnHeaderSimple column={column} title="업체 코드" />
       ),
       cell: ({ row }) => (
-        <div className="max-w-32 truncate">
-          {row.original.materialCode || "-"}
+        <div>
+          {row.original.vendorCode || "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "자재 코드",
+        excelHeader: "업체 코드",
       },
     },
     {
       accessorKey: "vendorCountry",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="국가" />
+        <DataTableColumnHeaderSimple column={column} title="업체 국가" />
       ),
       cell: ({ row }) => (
         <div>
@@ -283,39 +265,131 @@ export function getColumns(): ColumnDef<AcceptedQuotationItem>[] {
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "국가",
+        excelHeader: "업체 국가",
+      },
+    },
+    // 아이템 관련 컬럼
+    {
+      accessorKey: "materialGroup",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="자재그룹" />
+      ),
+      cell: ({ row }) => {
+        return (
+          <div className="max-w-32 truncate">
+            {row.original.itemCode || "-"}
+          </div>
+        );
+      },
+      enableSorting: false,
+      enableHiding: true,
+      meta: {
+        excelHeader: "자재그룹",
+      },
+    },
+    {
+      accessorKey: "workType",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="공종" />
+      ),
+      cell: ({ row }) => {
+        return (
+          <div className="max-w-32 truncate">
+            {row.original.workType || "-"}
+          </div>
+        );
+      },
+      enableSorting: false,
+      enableHiding: true,
+      meta: {
+        excelHeader: "공종",
+      },
+    },
+    {
+      accessorKey: "shipType",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="선종" />
+      ),
+      cell: ({ row }) => {
+        return (
+          <div className="max-w-32 truncate">
+            {row.original.shipTypes || "-"}
+          </div>
+        );
+      },
+      enableSorting: false,
+      enableHiding: true,
+      meta: {
+        excelHeader: "선종",
+      },
+    },
+    {
+      accessorKey: "itemName",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="자재명" />
+      ),
+      cell: ({ row }) => {
+        return (
+          <div className="max-w-32 truncate">
+            {row.original.itemList || "-"}
+          </div>
+        );
+      },
+      enableSorting: false,
+      enableHiding: true,
+      meta: {
+        excelHeader: "자재명",
+      },
+    },
+    {
+      accessorKey: "itemDetail",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="자재명(상세)" />
+      ),
+      cell: ({ row }) => {
+        return (
+          <div className="max-w-32 truncate">
+            {row.original.subItemList || "-"}
+          </div>
+        );
+      },
+      enableSorting: false,
+      enableHiding: true,
+      meta: {
+        excelHeader: "자재명(상세)",
       },
     },
+    // metadata 관련 컬럼
     {
       accessorKey: "dueDate",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="마감일" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 마감일" />
       ),
       cell: ({ row }) => (
         <div>
-          {row.original.dueDate ? formatDate(row.original.dueDate, "KR") : "-"}
+          {row.original.dueDate ? formatDate(row.original.dueDate) : "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "마감일",
+        excelHeader: "RFQ 마감일",
       },
     },
     {
       accessorKey: "acceptedAt",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="승인일" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 승인일" />
       ),
       cell: ({ row }) => (
         <div>
-          {row.original.acceptedAt ? formatDate(row.original.acceptedAt, "KR") : "-"}
+          {row.original.acceptedAt ? formatDate(row.original.acceptedAt) : "-"}
         </div>
       ),
       enableSorting: true,
       enableHiding: true,
       meta: {
-        excelHeader: "승인일",
+        excelHeader: "RFQ 승인일",
       },
     },
   ]
-- 
cgit v1.2.3

