From c5002d77087b256599b174ada611621657fcc523 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Sun, 15 Jun 2025 04:40:22 +0000
Subject: (최겸) 기술영업 조선,해양RFQ 수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/vendor-quotations-table-columns.tsx      | 71 ++++++++++++++++++----
 1 file changed, 59 insertions(+), 12 deletions(-)

(limited to 'lib/techsales-rfq/vendor-response/table/vendor-quotations-table-columns.tsx')

diff --git a/lib/techsales-rfq/vendor-response/table/vendor-quotations-table-columns.tsx b/lib/techsales-rfq/vendor-response/table/vendor-quotations-table-columns.tsx
index cf1dac42..ddee2317 100644
--- a/lib/techsales-rfq/vendor-response/table/vendor-quotations-table-columns.tsx
+++ b/lib/techsales-rfq/vendor-response/table/vendor-quotations-table-columns.tsx
@@ -2,7 +2,7 @@
 
 import * as React from "react"
 import { type ColumnDef } from "@tanstack/react-table"
-import { Edit, Paperclip } from "lucide-react"
+import { Edit, Paperclip, Package } from "lucide-react"
 import { formatCurrency, formatDate, formatDateTime } from "@/lib/utils"
 import { Badge } from "@/components/ui/badge"
 import { Button } from "@/components/ui/button"
@@ -29,7 +29,8 @@ interface QuotationWithRfqCode extends TechSalesVendorQuotations {
   
   // 아이템 정보
   itemName?: string;
-  itemShipbuildingId?: number;
+
+  itemCount?: number;
   
   // 프로젝트 정보
   projNm?: string;
@@ -44,14 +45,6 @@ interface QuotationWithRfqCode extends TechSalesVendorQuotations {
   createdByName?: string | null;
   updatedByName?: string | null;
   
-  // 견적 코드 및 버전
-  quotationCode?: string | null;
-  quotationVersion?: number | null;
-  
-  // 추가 상태 정보
-  rejectionReason?: string | null;
-  acceptedAt?: Date | null;
-  
   // 첨부파일 개수
   attachmentCount?: number;
 }
@@ -59,9 +52,10 @@ interface QuotationWithRfqCode extends TechSalesVendorQuotations {
 interface GetColumnsProps {
   router: AppRouterInstance;
   openAttachmentsSheet: (rfqId: number) => void;
+  openItemsDialog: (rfq: { id: number; rfqCode?: string; status?: string; rfqType?: "SHIP" | "TOP" | "HULL"; }) => void;
 }
 
-export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): ColumnDef<QuotationWithRfqCode>[] {
+export function getColumns({ router, openAttachmentsSheet, openItemsDialog }: GetColumnsProps): ColumnDef<QuotationWithRfqCode>[] {
   return [
     {
     id: "select",
@@ -151,7 +145,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     // {
     //   accessorKey: "materialCode",
     //   header: ({ column }) => (
-    //     <DataTableColumnHeaderSimple column={column} title="자재 코드" />
+    //     <DataTableColumnHeaderSimple column={column} title="자재 그룹" />
     //   ),
     //   cell: ({ row }) => {
     //     const materialCode = row.getValue("materialCode") as string;
@@ -250,6 +244,59 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     //   enableSorting: true,
     //   enableHiding: true,
     // },
+    {
+      id: "items",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="아이템" />
+      ),
+      cell: ({ row }) => {
+        const quotation = row.original
+        const itemCount = quotation.itemCount || 0
+
+        const handleClick = () => {
+          const rfq = {
+            id: quotation.rfqId,
+            rfqCode: quotation.rfqCode,
+            status: quotation.rfqStatus,
+            rfqType: "SHIP" as const, // 기본값
+          }
+          openItemsDialog(rfq)
+        }
+
+        return (
+          <div className="w-20">
+            <TooltipProvider>
+              <Tooltip>
+                <TooltipTrigger asChild>
+                  <Button
+                    variant="ghost"
+                    size="sm"
+                    className="relative h-8 w-8 p-0 group"
+                    onClick={handleClick}
+                    aria-label={`View ${itemCount} items`}
+                  >
+                    <Package className="h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors" />
+                    {itemCount > 0 && (
+                      <span className="pointer-events-none absolute -top-1 -right-1 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-primary px-1 text-[0.625rem] font-medium leading-none text-primary-foreground">
+                        {itemCount}
+                      </span>
+                    )}
+                    <span className="sr-only">
+                      {itemCount > 0 ? `${itemCount} 아이템` : "아이템 없음"}
+                    </span>
+                  </Button>
+                </TooltipTrigger>
+                <TooltipContent>
+                  <p>{itemCount > 0 ? `${itemCount}개 아이템 보기` : "아이템 없음"}</p>
+                </TooltipContent>
+              </Tooltip>
+            </TooltipProvider>
+          </div>
+        )
+      },
+      enableSorting: false,
+      enableHiding: true,
+    },
     {
       id: "attachments",
       header: ({ column }) => (
-- 
cgit v1.2.3

