From 95866a13ba4e1c235373834460aa284b763fe0d9 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 23 Jun 2025 09:03:29 +0000
Subject: (최겸) 기술영업 RFQ 개발(0620 요구사항, 첨부파일, REV 등)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/techsales-rfq/table/rfq-table-column.tsx | 99 ++++++++++++++++++++++++++--
 1 file changed, 95 insertions(+), 4 deletions(-)

(limited to 'lib/techsales-rfq/table/rfq-table-column.tsx')

diff --git a/lib/techsales-rfq/table/rfq-table-column.tsx b/lib/techsales-rfq/table/rfq-table-column.tsx
index 51c143a4..3009e036 100644
--- a/lib/techsales-rfq/table/rfq-table-column.tsx
+++ b/lib/techsales-rfq/table/rfq-table-column.tsx
@@ -6,13 +6,14 @@ import { formatDate, formatDateTime } from "@/lib/utils"
 import { Checkbox } from "@/components/ui/checkbox"
 import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
 import { DataTableRowAction } from "@/types/table"
-import { Paperclip, Package } from "lucide-react"
+import { Paperclip, Package, FileText, BarChart3 } from "lucide-react"
 import { Button } from "@/components/ui/button"
 
 // 기본적인 RFQ 타입 정의 (rfq-table.tsx 파일과 일치해야 함)
 type TechSalesRfq = {
   id: number
   rfqCode: string | null
+  description: string | null
   dueDate: Date
   rfqSendDate: Date | null
   status: "RFQ Created" | "RFQ Vendor Assignned" | "RFQ Sent" | "Quotation Analysis" | "Closed"
@@ -33,6 +34,8 @@ type TechSalesRfq = {
   projMsrm: number
   ptypeNm: string
   attachmentCount: number
+  hasTbeAttachments: boolean
+  hasCbeAttachments: boolean
   quotationCount: number
   itemCount: number
   // 나머지 필드는 사용할 때마다 추가
@@ -41,7 +44,7 @@ type TechSalesRfq = {
 
 interface GetColumnsProps {
   setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<TechSalesRfq> | null>>;
-  openAttachmentsSheet: (rfqId: number) => void;
+  openAttachmentsSheet: (rfqId: number, attachmentType?: 'RFQ_COMMON' | 'TBE_RESULT' | 'CBE_RESULT') => void;
   openItemsDialog: (rfq: TechSalesRfq) => void;
 }
 
@@ -109,6 +112,18 @@ export function getColumns({
       enableResizing: true,
       size: 120,
     },
+    {
+      accessorKey: "description",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="RFQ Title" />
+      ),
+      cell: ({ row }) => <div>{row.getValue("description")}</div>,
+      meta: {
+        excelHeader: "RFQ Title"
+      },
+      enableResizing: true,
+      size: 200,
+    },
     {
       accessorKey: "projNm",
       header: ({ column }) => (
@@ -286,14 +301,14 @@ export function getColumns({
     {
       id: "attachments",
       header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="첨부파일" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 첨부파일" />
       ),
       cell: ({ row }) => {
         const rfq = row.original
         const attachmentCount = rfq.attachmentCount || 0
 
         const handleClick = () => {
-          openAttachmentsSheet(rfq.id)
+          openAttachmentsSheet(rfq.id, 'RFQ_COMMON')
         }
 
         return (
@@ -325,5 +340,81 @@ export function getColumns({
         excelHeader: "첨부파일"
       },
     },
+    {
+      id: "tbe-attachments",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="TBE 결과" />
+      ),
+      cell: ({ row }) => {
+        const rfq = row.original
+        const hasTbeAttachments = rfq.hasTbeAttachments
+        
+        const handleClick = () => {
+          openAttachmentsSheet(rfq.id, 'TBE_RESULT')
+        }
+
+        return (
+          <Button
+            variant="ghost"
+            size="sm"
+            className="relative h-8 w-8 p-0 group"
+            onClick={handleClick}
+            aria-label={hasTbeAttachments ? "TBE 첨부파일 있음" : "TBE 첨부파일 추가"}
+          >
+            <FileText className="h-4 w-4 text-muted-foreground group-hover:text-green-600 transition-colors" />
+            {hasTbeAttachments && (
+              <span className="pointer-events-none absolute -top-1 -right-1 inline-flex h-3 w-3 rounded-full bg-red-500"></span>
+            )}
+            <span className="sr-only">
+              {hasTbeAttachments ? "TBE 첨부파일 있음" : "TBE 첨부파일 추가"}
+            </span>
+          </Button>
+        )
+      },
+      enableSorting: false,
+      enableResizing: false,
+      size: 80,
+      meta: {
+        excelHeader: "TBE 결과"
+      },
+    },
+    {
+      id: "cbe-attachments",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="CBE 결과" />
+      ),
+      cell: ({ row }) => {
+        const rfq = row.original
+        const hasCbeAttachments = rfq.hasCbeAttachments
+
+        const handleClick = () => {
+          openAttachmentsSheet(rfq.id, 'CBE_RESULT')
+        }
+
+        return (
+          <Button
+            variant="ghost"
+            size="sm"
+            className="relative h-8 w-8 p-0 group"
+            onClick={handleClick}
+            aria-label={hasCbeAttachments ? "CBE 첨부파일 있음" : "CBE 첨부파일 추가"}
+          >
+            <BarChart3 className="h-4 w-4 text-muted-foreground group-hover:text-blue-600 transition-colors" />
+            {hasCbeAttachments && (
+              <span className="pointer-events-none absolute -top-1 -right-1 inline-flex h-3 w-3 rounded-full bg-red-500"></span>
+            )}
+            <span className="sr-only">
+              {hasCbeAttachments ? "CBE 첨부파일 있음" : "CBE 첨부파일 추가"}
+            </span>
+          </Button>
+        )
+      },
+      enableSorting: false,
+      enableResizing: false,
+      size: 80,
+      meta: {
+        excelHeader: "CBE 결과"
+      },
+    },
   ]
 }
\ No newline at end of file
-- 
cgit v1.2.3

