diff options
Diffstat (limited to 'lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx')
| -rw-r--r-- | lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx b/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx index 7fdcc900..e9707a88 100644 --- a/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx +++ b/lib/tech-vendor-possible-items/table/possible-items-table-columns.tsx @@ -4,22 +4,8 @@ import { ColumnDef } from "@tanstack/react-table"; import { Checkbox } from "@/components/ui/checkbox";
import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header";
import Link from "next/link";
-// 타입만 import
-type TechVendorPossibleItemsData = {
- id: number;
- vendorId: number;
- vendorCode: string | null;
- vendorName: string;
- techVendorType: string;
- vendorStatus: string;
- itemCode: string;
- itemList: string | null;
- workType: string | null;
- shipTypes: string | null;
- subItemList: string | null;
- createdAt: Date;
- updatedAt: Date;
-};
+// 새로운 스키마에 맞는 타입 import
+import type { TechVendorPossibleItemsData } from "../service";
import { format } from "date-fns";
import { ko } from "date-fns/locale";
import { Badge } from "@/components/ui/badge";
@@ -153,6 +139,22 @@ export function getColumns(): ColumnDef<TechVendorPossibleItemsData>[] { },
},
{
+ accessorKey: "vendorEmail",
+ header: ({ column }) => (
+ <DataTableColumnHeaderSimple column={column} title="벤더이메일" />
+ ),
+ cell: ({ row }) => {
+ const vendorEmail = row.getValue("vendorEmail") as string | null;
+ return <div className="max-w-[200px] truncate">{vendorEmail || "-"}</div>;
+ },
+ filterFn: (row, id, value) => {
+ const vendorEmail = row.getValue(id) as string | null;
+ if (!value) return true;
+ if (!vendorEmail) return false;
+ return vendorEmail.toLowerCase().includes(value.toLowerCase());
+ },
+ },
+ {
accessorKey: "techVendorType",
header: ({ column }) => (
<DataTableColumnHeaderSimple column={column} title="벤더타입" />
@@ -216,29 +218,35 @@ export function getColumns(): ColumnDef<TechVendorPossibleItemsData>[] { },
},
- {
- accessorKey: "vendorStatus",
- header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="벤더상태" />
- ),
- cell: ({ row }) => {
- const vendorStatus = row.getValue("vendorStatus") as string;
- const getStatusColor = (status: string) => {
- switch (status) {
- case "ACTIVE": return "bg-green-100 text-green-800";
- case "PENDING_INVITE": return "bg-yellow-100 text-yellow-800";
- case "PENDING_REVIEW": return "bg-blue-100 text-blue-800";
- case "INACTIVE": return "bg-gray-100 text-gray-800";
- default: return "bg-gray-100 text-gray-800";
- }
- };
- return (
- <Badge className={getStatusColor(vendorStatus)}>
- {vendorStatus}
- </Badge>
- );
- },
- },
+ // {
+ // accessorKey: "vendorStatus",
+ // header: ({ column }) => (
+ // <DataTableColumnHeaderSimple column={column} title="벤더상태" />
+ // ),
+ // cell: ({ row }) => {
+ // const vendorStatus = row.getValue("vendorStatus") as string;
+ // const getStatusColor = (status: string) => {
+ // switch (status) {
+ // case "ACTIVE": return "bg-green-100 text-green-800";
+ // case "PENDING_INVITE": return "bg-yellow-100 text-yellow-800";
+ // case "PENDING_REVIEW": return "bg-blue-100 text-blue-800";
+ // case "INACTIVE": return "bg-gray-100 text-gray-800";
+ // default: return "bg-gray-100 text-gray-800";
+ // }
+ // };
+ // return (
+ // <Badge className={getStatusColor(vendorStatus)}>
+ // {vendorStatus}
+ // </Badge>
+ // );
+ // },
+ // filterFn: (row, id, value) => {
+ // const vendorStatus = row.getValue(id) as string;
+ // if (!value) return true;
+ // if (!vendorStatus) return false;
+ // return vendorStatus === value;
+ // },
+ // },
{
accessorKey: "createdAt",
header: ({ column }) => (
|
