From cf8dac0c6490469dab88a560004b0c07dbd48612 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 18 Sep 2025 00:23:40 +0000
Subject: (대표님) rfq, 계약, 서명 등
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/tbe-last/table/tbe-last-table-columns.tsx | 49 +++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

(limited to 'lib/tbe-last/table/tbe-last-table-columns.tsx')

diff --git a/lib/tbe-last/table/tbe-last-table-columns.tsx b/lib/tbe-last/table/tbe-last-table-columns.tsx
index 726d8925..b18e51c0 100644
--- a/lib/tbe-last/table/tbe-last-table-columns.tsx
+++ b/lib/tbe-last/table/tbe-last-table-columns.tsx
@@ -86,6 +86,55 @@ export function getColumns({
       cell: ({ row }) => row.original.rfqCode,
       size: 120,
     },
+
+    {
+      id: "tbeRequired",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="TBE 필요" />
+      ),
+      cell: ({ row, table }) => {
+        const rfqCode = row.original.rfqCode;
+        const sessionStatus = row.original.sessionStatus;
+        
+        // 같은 RFQ의 첫 번째 행에만 체크박스 표시
+        const allRows = table.getRowModel().rows;
+        const isFirstInGroup = allRows.findIndex(
+          r => r.original.rfqCode === rfqCode
+        ) === allRows.indexOf(row);
+        
+        if (!isFirstInGroup) return null;
+        
+        // 같은 RFQ의 모든 row
+        const rfqRows = allRows.filter(
+          r => r.original.rfqCode === rfqCode
+        );
+        
+        const vendorCount = rfqRows.length;
+        
+        // 같은 RFQ의 row들이 선택되었는지 확인
+        const isChecked = rfqRows.every(r => r.getIsSelected());
+        const isIndeterminate = rfqRows.some(r => r.getIsSelected()) && !isChecked;
+        
+        return (
+          <div className="flex items-center gap-2">
+            <Checkbox
+              checked={isChecked}
+              indeterminate={isIndeterminate}
+              onCheckedChange={(checked) => {
+                // RFQ의 모든 벤더 선택/해제
+                rfqRows.forEach(r => {
+                  r.toggleSelected(!!checked);
+                });
+              }}
+            />
+            <span className="text-xs text-muted-foreground">
+              ({vendorCount} vendors)
+            </span>
+          </div>
+        );
+      },
+      size: 120,
+    },
     
     // RFQ Title
     {
-- 
cgit v1.2.3

