From 9cda8482660a87fd98c9ee43f507d75ff75b4e23 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 28 Nov 2025 03:12:57 +0000
Subject: (최겸) 구매 입찰 피드백 반영(90%)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/bidding/receive/biddings-receive-columns.tsx | 76 ++++++++++++++++--------
 1 file changed, 51 insertions(+), 25 deletions(-)

(limited to 'lib/bidding/receive/biddings-receive-columns.tsx')

diff --git a/lib/bidding/receive/biddings-receive-columns.tsx b/lib/bidding/receive/biddings-receive-columns.tsx
index 4bde849c..9650574a 100644
--- a/lib/bidding/receive/biddings-receive-columns.tsx
+++ b/lib/bidding/receive/biddings-receive-columns.tsx
@@ -58,6 +58,7 @@ type BiddingReceiveItem = {
 
 interface GetColumnsProps {
   setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<BiddingReceiveItem> | null>>
+  onParticipantClick?: (biddingId: number, participantType: 'expected' | 'participated' | 'declined' | 'pending') => void
 }
 
 // 상태별 배지 색상
@@ -89,7 +90,7 @@ const formatCurrency = (amount: string | number | null, currency = 'KRW') => {
   }).format(numAmount)
 }
 
-export function getBiddingsReceiveColumns({ setRowAction }: GetColumnsProps): ColumnDef<BiddingReceiveItem>[] {
+export function getBiddingsReceiveColumns({ setRowAction, onParticipantClick }: GetColumnsProps): ColumnDef<BiddingReceiveItem>[] {
 
   return [
     // ░░░ 선택 ░░░
@@ -195,24 +196,17 @@ export function getBiddingsReceiveColumns({ setRowAction }: GetColumnsProps): Co
         
         if (!startDate || !endDate) return <span className="text-muted-foreground">-</span>
         
-        const now = new Date()
         const startObj = new Date(startDate)
         const endObj = new Date(endDate)
-        
-        const isActive = now >= startObj && now <= endObj
-        const isPast = now > endObj
 
         // UI 표시용 KST 변환
         const formatKst = (d: Date) => new Date(d.getTime() + 9 * 60 * 60 * 1000).toISOString().slice(0, 16).replace('T', ' ')
         
         return (
           <div className="text-xs">
-            <div className={`${isActive ? 'text-green-600 font-medium' : isPast ? 'text-red-600' : 'text-gray-600'}`}>
+            <div>
               {formatKst(startObj)} ~ {formatKst(endObj)}
             </div>
-            {isActive && (
-              <Badge variant="default" className="text-xs mt-1">진행중</Badge>
-            )}
           </div>
         )
       },
@@ -251,10 +245,18 @@ export function getBiddingsReceiveColumns({ setRowAction }: GetColumnsProps): Co
       id: "participantExpected",
       header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="참여예정협력사" />,
       cell: ({ row }) => (
-        <div className="flex items-center gap-1">
-          <Users className="h-4 w-4 text-blue-500" />
-          <span className="text-sm font-medium">{row.original.participantExpected}</span>
-        </div>
+        <Button
+          variant="ghost"
+          size="sm"
+          className="h-auto p-1 hover:bg-blue-50"
+          onClick={() => onParticipantClick?.(row.original.id, 'expected')}
+          disabled={row.original.participantExpected === 0}
+        >
+          <div className="flex items-center gap-1">
+            <Users className="h-4 w-4 text-blue-500" />
+            <span className="text-sm font-medium">{row.original.participantExpected}</span>
+          </div>
+        </Button>
       ),
       size: 100,
       meta: { excelHeader: "참여예정협력사" },
@@ -265,10 +267,18 @@ export function getBiddingsReceiveColumns({ setRowAction }: GetColumnsProps): Co
       id: "participantParticipated",
       header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="참여협력사" />,
       cell: ({ row }) => (
-        <div className="flex items-center gap-1">
-          <CheckCircle className="h-4 w-4 text-green-500" />
-          <span className="text-sm font-medium">{row.original.participantParticipated}</span>
-        </div>
+        <Button
+          variant="ghost"
+          size="sm"
+          className="h-auto p-1 hover:bg-green-50"
+          onClick={() => onParticipantClick?.(row.original.id, 'participated')}
+          disabled={row.original.participantParticipated === 0}
+        >
+          <div className="flex items-center gap-1">
+            <CheckCircle className="h-4 w-4 text-green-500" />
+            <span className="text-sm font-medium">{row.original.participantParticipated}</span>
+          </div>
+        </Button>
       ),
       size: 100,
       meta: { excelHeader: "참여협력사" },
@@ -279,10 +289,18 @@ export function getBiddingsReceiveColumns({ setRowAction }: GetColumnsProps): Co
       id: "participantDeclined",
       header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="포기협력사" />,
       cell: ({ row }) => (
-        <div className="flex items-center gap-1">
-          <XCircle className="h-4 w-4 text-red-500" />
-          <span className="text-sm font-medium">{row.original.participantDeclined}</span>
-        </div>
+        <Button
+          variant="ghost"
+          size="sm"
+          className="h-auto p-1 hover:bg-red-50"
+          onClick={() => onParticipantClick?.(row.original.id, 'declined')}
+          disabled={row.original.participantDeclined === 0}
+        >
+          <div className="flex items-center gap-1">
+            <XCircle className="h-4 w-4 text-red-500" />
+            <span className="text-sm font-medium">{row.original.participantDeclined}</span>
+          </div>
+        </Button>
       ),
       size: 100,
       meta: { excelHeader: "포기협력사" },
@@ -293,10 +311,18 @@ export function getBiddingsReceiveColumns({ setRowAction }: GetColumnsProps): Co
       id: "participantPending",
       header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="미제출협력사" />,
       cell: ({ row }) => (
-        <div className="flex items-center gap-1">
-          <Clock className="h-4 w-4 text-yellow-500" />
-          <span className="text-sm font-medium">{row.original.participantPending}</span>
-        </div>
+        <Button
+          variant="ghost"
+          size="sm"
+          className="h-auto p-1 hover:bg-yellow-50"
+          onClick={() => onParticipantClick?.(row.original.id, 'pending')}
+          disabled={row.original.participantPending === 0}
+        >
+          <div className="flex items-center gap-1">
+            <Clock className="h-4 w-4 text-yellow-500" />
+            <span className="text-sm font-medium">{row.original.participantPending}</span>
+          </div>
+        </Button>
       ),
       size: 100,
       meta: { excelHeader: "미제출협력사" },
-- 
cgit v1.2.3

