summaryrefslogtreecommitdiff
path: root/lib/rfq-last/attachment/rfq-attachments-table.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rfq-last/attachment/rfq-attachments-table.tsx')
-rw-r--r--lib/rfq-last/attachment/rfq-attachments-table.tsx128
1 files changed, 81 insertions, 47 deletions
diff --git a/lib/rfq-last/attachment/rfq-attachments-table.tsx b/lib/rfq-last/attachment/rfq-attachments-table.tsx
index 155fd412..09c9fe35 100644
--- a/lib/rfq-last/attachment/rfq-attachments-table.tsx
+++ b/lib/rfq-last/attachment/rfq-attachments-table.tsx
@@ -50,6 +50,7 @@ import { AddAttachmentDialog } from "./add-attachment-dialog";
import { UpdateRevisionDialog } from "./update-revision-dialog";
import { toast } from "sonner";
import { RevisionHistoryDialog } from "./revision-historty-dialog";
+import { createFilterFn } from "@/components/client-data-table/table-filters";
// 타입 정의
interface RfqAttachment {
@@ -238,6 +239,7 @@ export function RfqAttachmentsTable({
{
accessorKey: "serialNo",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="일련번호" />,
+ filterFn: createFilterFn("text"), // 추가
cell: ({ row }) => (
<span className="font-mono text-sm">{row.original.serialNo || "-"}</span>
),
@@ -248,6 +250,7 @@ export function RfqAttachmentsTable({
{
accessorKey: "originalFileName",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="파일명" />,
+ filterFn: createFilterFn("text"), // 추가
cell: ({ row }) => {
const file = row.original;
return (
@@ -266,6 +269,7 @@ export function RfqAttachmentsTable({
{
accessorKey: "description",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="설명" />,
+ filterFn: createFilterFn("text"), // 추가
cell: ({ row }) => (
<div className="max-w-[200px] truncate" title={row.original.description || ""}>
{row.original.description || "-"}
@@ -276,6 +280,7 @@ export function RfqAttachmentsTable({
{
accessorKey: "currentRevision",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="리비전" />,
+ filterFn: createFilterFn("text"), // 추가
cell: ({ row }) => {
const revision = row.original.currentRevision;
return revision ? (
@@ -291,6 +296,7 @@ export function RfqAttachmentsTable({
{
accessorKey: "fileSize",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="크기" />,
+ filterFn: createFilterFn("number"), // number 타입으로 변경
cell: ({ row }) => (
<span className="text-sm text-muted-foreground">
{formatFileSize(row.original.fileSize)}
@@ -299,14 +305,50 @@ export function RfqAttachmentsTable({
size: 80,
},
{
+ accessorKey: "fileType",
+ header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="파일 타입" />,
+ filterFn: createFilterFn("select"), // 추가
+ cell: ({ row }) => {
+ const fileType = row.original.fileType;
+ if (!fileType) return <span className="text-muted-foreground">-</span>;
+
+ const type = fileType.toLowerCase();
+ let displayType = "기타";
+ let color = "text-gray-500";
+
+ if (type.includes('pdf')) {
+ displayType = "PDF";
+ color = "text-red-500";
+ } else if (type.includes('excel') || ['xls', 'xlsx'].includes(type)) {
+ displayType = "Excel";
+ color = "text-green-500";
+ } else if (type.includes('word') || ['doc', 'docx'].includes(type)) {
+ displayType = "Word";
+ color = "text-blue-500";
+ } else if (type.includes('image') || ['jpg', 'jpeg', 'png', 'gif'].includes(type)) {
+ displayType = "이미지";
+ color = "text-purple-500";
+ }
+
+ return (
+ <Badge variant="outline" className={cn("text-xs", color)}>
+ {displayType}
+ </Badge>
+ );
+ },
+ size: 100,
+ },
+ {
accessorKey: "createdByName",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="업로드자" />,
+ filterFn: createFilterFn("text"), // 추가
cell: ({ row }) => row.original.createdByName || "-",
size: 100,
},
{
accessorKey: "createdAt",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="업로드일" />,
+ filterFn: createFilterFn("date"), // date 타입으로 변경
cell: ({ row }) => {
const date = row.original.createdAt;
return date ? (
@@ -334,6 +376,7 @@ export function RfqAttachmentsTable({
{
accessorKey: "updatedAt",
header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="수정일" />,
+ filterFn: createFilterFn("date"), // date 타입으로 변경
cell: ({ row }) => {
const date = row.original.updatedAt;
return date ? format(new Date(date), "MM-dd HH:mm") : "-";
@@ -341,46 +384,37 @@ export function RfqAttachmentsTable({
size: 100,
},
{
+ accessorKey: "revisionComment",
+ header: ({ column }) => <ClientDataTableColumnHeaderSimple column={column} title="리비전 코멘트" />,
+ filterFn: createFilterFn("text"), // 추가
+ cell: ({ row }) => {
+ const comment = row.original.revisionComment;
+ return comment ? (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="text-sm truncate max-w-[150px] block cursor-help">
+ {comment}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-[300px]">
+ <p className="text-sm">{comment}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ) : (
+ <span className="text-muted-foreground">-</span>
+ );
+ },
+ size: 150,
+ },
+ {
id: "actions",
header: "작업",
cell: ({ row }) => {
return (
<DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" className="h-8 w-8 p-0">
- <span className="sr-only">메뉴 열기</span>
- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
- <path d="M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path>
- </svg>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={() => handleAction({ row, type: "download" })}>
- <Download className="mr-2 h-4 w-4" />
- 다운로드
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => handleAction({ row, type: "preview" })}>
- <Eye className="mr-2 h-4 w-4" />
- 미리보기
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem onClick={() => handleAction({ row, type: "history" })}>
- <History className="mr-2 h-4 w-4" />
- 리비전 이력
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => handleAction({ row, type: "update" })}>
- <Upload className="mr-2 h-4 w-4" />
- 새 버전 업로드
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={() => handleAction({ row, type: "delete" })}
- className="text-red-600"
- >
- <Trash2 className="mr-2 h-4 w-4" />
- 삭제
- </DropdownMenuItem>
- </DropdownMenuContent>
+ {/* ... 기존 드롭다운 메뉴 내용 ... */}
</DropdownMenu>
);
},
@@ -394,18 +428,18 @@ export function RfqAttachmentsTable({
{ id: "originalFileName", label: "파일명", type: "text" },
{ id: "description", label: "설명", type: "text" },
{ id: "currentRevision", label: "리비전", type: "text" },
- {
- id: "fileType",
- label: "파일 타입",
- type: "select",
- options: [
- { label: "PDF", value: "pdf" },
- { label: "Excel", value: "xlsx" },
- { label: "Word", value: "docx" },
- { label: "이미지", value: "image" },
- { label: "기타", value: "other" },
- ]
- },
+ // {
+ // id: "fileType",
+ // label: "파일 타입",
+ // type: "select",
+ // options: [
+ // { label: "PDF", value: "pdf" },
+ // { label: "Excel", value: "xlsx" },
+ // { label: "Word", value: "docx" },
+ // { label: "이미지", value: "image" },
+ // { label: "기타", value: "other" },
+ // ]
+ // },
{ id: "createdByName", label: "업로드자", type: "text" },
{ id: "createdAt", label: "업로드일", type: "date" },
{ id: "updatedAt", label: "수정일", type: "date" },