From aa86729f9a2ab95346a2851e3837de1c367aae17 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 20 Jun 2025 11:37:31 +0000
Subject: (대표님) 20250620 작업사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/vendor-quotations-table-columns.tsx      | 88 +++++++++++++---------
 1 file changed, 51 insertions(+), 37 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 ddee2317..b89f8953 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
@@ -15,7 +15,8 @@ import {
 } from "@/components/ui/tooltip"
 import { 
   TechSalesVendorQuotations, 
-  TECH_SALES_QUOTATION_STATUS_CONFIG
+  TECH_SALES_QUOTATION_STATUS_CONFIG,
+  TECH_SALES_QUOTATION_STATUSES
 } from "@/db/schema"
 import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"
 import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
@@ -70,14 +71,21 @@ export function getColumns({ router, openAttachmentsSheet, openItemsDialog }: Ge
         className="translate-y-0.5"
       />
     ),
-    cell: ({ row }) => (
-      <Checkbox
-        checked={row.getIsSelected()}
-        onCheckedChange={(value) => row.toggleSelected(!!value)}
+    cell: ({ row }) => {
+      const isRejected = row.original.status === TECH_SALES_QUOTATION_STATUSES.REJECTED;
+      const isAccepted = row.original.status === TECH_SALES_QUOTATION_STATUSES.ACCEPTED;
+      const isDisabled = isRejected || isAccepted;
+      
+      return (
+        <Checkbox
+          checked={row.getIsSelected()}
+          onCheckedChange={(value) => row.toggleSelected(!!value)}
           aria-label="행 선택"
-        className="translate-y-0.5"
-      />
-    ),
+          className="translate-y-0.5"
+          disabled={isDisabled}
+        />
+      );
+    },
     enableSorting: false,
     enableHiding: false,
     },
@@ -158,33 +166,33 @@ export function getColumns({ router, openAttachmentsSheet, openItemsDialog }: Ge
     //   enableSorting: true,
     //   enableHiding: true,
     // },
-    {
-      accessorKey: "itemName",
-      header: ({ column }) => (
-        <DataTableColumnHeaderSimple column={column} title="자재명" />
-      ),
-      cell: ({ row }) => {
-        const itemName = row.getValue("itemName") as string;
-        return (
-          <div className="min-w-48 max-w-64">
-            <TooltipProvider>
-              <Tooltip>
-                <TooltipTrigger asChild>
-                  <span className="truncate block text-sm">
-                    {itemName || "N/A"}
-                  </span>
-                </TooltipTrigger>
-                <TooltipContent>
-                  <p className="max-w-xs">{itemName || "N/A"}</p>
-                </TooltipContent>
-              </Tooltip>
-            </TooltipProvider>
-          </div>
-        );
-      },
-      enableSorting: true,
-      enableHiding: true,
-    },
+    // {
+    //   accessorKey: "itemName",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="자재명" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const itemName = row.getValue("itemName") as string;
+    //     return (
+    //       <div className="min-w-48 max-w-64">
+    //         <TooltipProvider>
+    //           <Tooltip>
+    //             <TooltipTrigger asChild>
+    //               <span className="truncate block text-sm">
+    //                 {itemName || "N/A"}
+    //               </span>
+    //             </TooltipTrigger>
+    //             <TooltipContent>
+    //               <p className="max-w-xs">{itemName || "N/A"}</p>
+    //             </TooltipContent>
+    //           </Tooltip>
+    //         </TooltipProvider>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
     {
       accessorKey: "projNm",
       header: ({ column }) => (
@@ -597,6 +605,9 @@ export function getColumns({ router, openAttachmentsSheet, openItemsDialog }: Ge
         const quotation = row.original;
         const rfqCode = quotation.rfqCode || "N/A";
         const tooltipText = `${rfqCode} 견적서 작성`;
+        const isRejected = quotation.status === "Rejected";
+        const isAccepted = quotation.status === "Accepted";
+        const isDisabled = isRejected || isAccepted;
       
       return (
           <div className="w-16">
@@ -607,16 +618,19 @@ export function getColumns({ router, openAttachmentsSheet, openItemsDialog }: Ge
                 variant="ghost"
                 size="icon"
                     onClick={() => {
-                      router.push(`/ko/partners/techsales/rfq-ship/${quotation.id}`);
+                      if (!isDisabled) {
+                        router.push(`/ko/partners/techsales/rfq-ship/${quotation.id}`);
+                      }
                     }}
                 className="h-8 w-8"
+                disabled={isDisabled}
               >
                 <Edit className="h-4 w-4" />
                 <span className="sr-only">견적서 작성</span>
               </Button>
             </TooltipTrigger>
             <TooltipContent>
-              <p>{tooltipText}</p>
+              <p>{isRejected ? "거절된 견적서는 편집할 수 없습니다" : isAccepted ? "승인된 견적서는 편집할 수 없습니다" : tooltipText}</p>
             </TooltipContent>
           </Tooltip>
         </TooltipProvider>
-- 
cgit v1.2.3

