From e5f4a774fabc17b5b18d50c96f5695d89dcabc86 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Mon, 2 Jun 2025 02:27:56 +0000
Subject: (김준회) 기술영업 조선 RFQ 에러 처리 및 필터와 소팅  처리
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/vendor-quotations-table-columns.tsx      | 255 +++++++++++++++++----
 1 file changed, 211 insertions(+), 44 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 109698ea..cf1dac42 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
@@ -13,24 +13,46 @@ import {
   TooltipProvider,
   TooltipTrigger,
 } from "@/components/ui/tooltip"
-import { DataTableColumnHeader } from "@/components/data-table/data-table-column-header"
 import { 
   TechSalesVendorQuotations, 
   TECH_SALES_QUOTATION_STATUS_CONFIG
 } 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"
 
 interface QuotationWithRfqCode extends TechSalesVendorQuotations {
+  // RFQ 관련 정보
   rfqCode?: string;
   materialCode?: string;
   dueDate?: Date;
   rfqStatus?: string;
+  
+  // 아이템 정보
   itemName?: string;
+  itemShipbuildingId?: number;
+  
+  // 프로젝트 정보
   projNm?: string;
+  pspid?: string;
+  sector?: string;
+  
+  // 벤더 정보
+  vendorName?: string;
+  vendorCode?: string;
+  
+  // 사용자 정보
+  createdByName?: string | null;
+  updatedByName?: string | null;
+  
+  // 견적 코드 및 버전
   quotationCode?: string | null;
   quotationVersion?: number | null;
+  
+  // 추가 상태 정보
   rejectionReason?: string | null;
   acceptedAt?: Date | null;
+  
+  // 첨부파일 개수
   attachmentCount?: number;
 }
 
@@ -65,23 +87,23 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     enableSorting: false,
     enableHiding: false,
     },
-    {
-      accessorKey: "id",
-      header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="ID" />
-      ),
-      cell: ({ row }) => (
-        <div className="w-20">
-          <span className="font-mono text-xs">{row.getValue("id")}</span>
-        </div>
-      ),
-      enableSorting: true,
-      enableHiding: true,
-    },
+    // {
+    //   accessorKey: "id",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="ID" />
+    //   ),
+    //   cell: ({ row }) => (
+    //     <div className="w-20">
+    //       <span className="font-mono text-xs">{row.getValue("id")}</span>
+    //     </div>
+    //   ),
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
     {
       accessorKey: "rfqCode",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="RFQ 번호" />
+        <DataTableColumnHeaderSimple column={column} title="RFQ 번호" />
       ),
       cell: ({ row }) => {
         const rfqCode = row.getValue("rfqCode") as string;
@@ -94,26 +116,58 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
       enableSorting: true,
       enableHiding: false,
     },
-    {
-      accessorKey: "materialCode",
-      header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="자재 코드" />
-      ),
-      cell: ({ row }) => {
-        const materialCode = row.getValue("materialCode") as string;
-        return (
-          <div className="min-w-32">
-            <span className="font-mono text-sm">{materialCode || "N/A"}</span>
-          </div>
-        );
-      },
-      enableSorting: true,
-      enableHiding: true,
-    },
+    // {
+    //   accessorKey: "vendorName",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="벤더명" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const vendorName = row.getValue("vendorName") as string;
+    //     return (
+    //       <div className="min-w-32">
+    //         <span className="text-sm">{vendorName || "N/A"}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: false,
+    // },
+    // {
+    //   accessorKey: "vendorCode",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="벤더 코드" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const vendorCode = row.getValue("vendorCode") as string;
+    //     return (
+    //       <div className="min-w-24">
+    //         <span className="font-mono text-sm">{vendorCode || "N/A"}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
+    // {
+    //   accessorKey: "materialCode",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="자재 코드" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const materialCode = row.getValue("materialCode") as string;
+    //     return (
+    //       <div className="min-w-32">
+    //         <span className="font-mono text-sm">{materialCode || "N/A"}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
     {
       accessorKey: "itemName",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="품목명" />
+        <DataTableColumnHeaderSimple column={column} title="자재명" />
       ),
       cell: ({ row }) => {
         const itemName = row.getValue("itemName") as string;
@@ -134,13 +188,13 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
           </div>
         );
       },
-      enableSorting: false,
+      enableSorting: true,
       enableHiding: true,
     },
     {
       accessorKey: "projNm",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="프로젝트명" />
+        <DataTableColumnHeaderSimple column={column} title="프로젝트명" />
       ),
       cell: ({ row }) => {
         const projNm = row.getValue("projNm") as string;
@@ -161,13 +215,45 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
           </div>
         );
       },
-      enableSorting: false,
+      enableSorting: true,
       enableHiding: true,
     },
+    // {
+    //   accessorKey: "quotationCode",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="견적서 번호" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const quotationCode = row.getValue("quotationCode") as string;
+    //     return (
+    //       <div className="min-w-32">
+    //         <span className="font-mono text-sm">{quotationCode || "미부여"}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
+    // {
+    //   accessorKey: "quotationVersion",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="버전" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const quotationVersion = row.getValue("quotationVersion") as number;
+    //     return (
+    //       <div className="w-16 text-center">
+    //         <span className="text-sm">{quotationVersion || 1}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
     {
       id: "attachments",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="첨부파일" />
+        <DataTableColumnHeaderSimple column={column} title="첨부파일" />
       ),
       cell: ({ row }) => {
         const quotation = row.original
@@ -216,7 +302,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     {
       accessorKey: "status",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="상태" />
+        <DataTableColumnHeaderSimple column={column} title="상태" />
       ),
       cell: ({ row }) => {
         const status = row.getValue("status") as string;
@@ -243,7 +329,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     {
       accessorKey: "currency",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="통화" />
+        <DataTableColumnHeaderSimple column={column} title="통화" />
       ),
       cell: ({ row }) => {
         const currency = row.getValue("currency") as string;
@@ -259,7 +345,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     {
       accessorKey: "totalPrice",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="총액" />
+        <DataTableColumnHeaderSimple column={column} title="총액" />
       ),
       cell: ({ row }) => {
         const totalPrice = row.getValue("totalPrice") as string;
@@ -287,7 +373,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     {
       accessorKey: "validUntil",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="유효기간" />
+        <DataTableColumnHeaderSimple column={column} title="유효기간" />
       ),
       cell: ({ row }) => {
         const validUntil = row.getValue("validUntil") as Date;
@@ -305,7 +391,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     {
       accessorKey: "submittedAt",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="제출일" />
+        <DataTableColumnHeaderSimple column={column} title="제출일" />
       ),
       cell: ({ row }) => {
         const submittedAt = row.getValue("submittedAt") as Date;
@@ -320,10 +406,28 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
       enableSorting: true,
       enableHiding: true,
     },
+    // {
+    //   accessorKey: "acceptedAt",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="승인일" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const acceptedAt = row.getValue("acceptedAt") as Date;
+    //     return (
+    //       <div className="w-36">
+    //         <span className="text-sm">
+    //           {acceptedAt ? formatDateTime(acceptedAt) : "미승인"}
+    //         </span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
     {
       accessorKey: "dueDate",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="마감일" />
+        <DataTableColumnHeaderSimple column={column} title="마감일" />
       ),
       cell: ({ row }) => {
         const dueDate = row.getValue("dueDate") as Date;
@@ -340,10 +444,41 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
       enableSorting: true,
       enableHiding: true,
     },
+    // {
+    //   accessorKey: "rejectionReason",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="반려사유" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const rejectionReason = row.getValue("rejectionReason") as string;
+    //     return (
+    //       <div className="min-w-48 max-w-64">
+    //         {rejectionReason ? (
+    //           <TooltipProvider>
+    //             <Tooltip>
+    //               <TooltipTrigger asChild>
+    //                 <span className="truncate block text-sm text-red-600">
+    //                   {rejectionReason}
+    //                 </span>
+    //               </TooltipTrigger>
+    //               <TooltipContent>
+    //                 <p className="max-w-xs">{rejectionReason}</p>
+    //               </TooltipContent>
+    //             </Tooltip>
+    //           </TooltipProvider>
+    //         ) : (
+    //           <span className="text-sm text-muted-foreground">N/A</span>
+    //         )}
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: false,
+    //   enableHiding: true,
+    // },
     {
       accessorKey: "createdAt",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="생성일" />
+        <DataTableColumnHeaderSimple column={column} title="생성일" />
       ),
       cell: ({ row }) => {
         const createdAt = row.getValue("createdAt") as Date;
@@ -361,7 +496,7 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
     {
       accessorKey: "updatedAt",
       header: ({ column }) => (
-        <DataTableColumnHeader column={column} title="수정일" />
+        <DataTableColumnHeaderSimple column={column} title="수정일" />
       ),
       cell: ({ row }) => {
         const updatedAt = row.getValue("updatedAt") as Date;
@@ -376,6 +511,38 @@ export function getColumns({ router, openAttachmentsSheet }: GetColumnsProps): C
       enableSorting: true,
       enableHiding: true,
     },
+    // {
+    //   accessorKey: "createdByName",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="생성자" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const createdByName = row.getValue("createdByName") as string;
+    //     return (
+    //       <div className="w-24">
+    //         <span className="text-sm">{createdByName || "N/A"}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
+    // {
+    //   accessorKey: "updatedByName",
+    //   header: ({ column }) => (
+    //     <DataTableColumnHeaderSimple column={column} title="수정자" />
+    //   ),
+    //   cell: ({ row }) => {
+    //     const updatedByName = row.getValue("updatedByName") as string;
+    //     return (
+    //       <div className="w-24">
+    //         <span className="text-sm">{updatedByName || "N/A"}</span>
+    //       </div>
+    //     );
+    //   },
+    //   enableSorting: true,
+    //   enableHiding: true,
+    // },
     {
     id: "actions",
       header: "작업",
-- 
cgit v1.2.3

