1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
"use client";
import React from "react";
import { ColumnDef } from "@tanstack/react-table";
import { Badge } from "@/components/ui/badge";
import type { SwpFileApiResponse } from "@/lib/swp/api-client";
export const swpInboxDocumentColumns: ColumnDef<SwpFileApiResponse>[] = [
{
accessorKey: "STAT_NM",
header: "Latest File Status of Latest Revision",
cell: ({ row }) => {
const statNm = row.original.STAT_NM;
const stat = row.original.STAT;
const displayStatus = statNm || stat || "-";
if (!stat) return displayStatus;
// Determine color based on STAT code
const color =
stat === "SCW03" || stat === "SCW08" ? "bg-green-100 text-green-800" : // Complete, Checked
stat === "SCW02" ? "bg-blue-100 text-blue-800" : // Processing
stat === "SCW01" ? "bg-yellow-100 text-yellow-800" : // Standby
stat === "SCW04" || stat === "SCW05" || stat === "SCW06" ? "bg-red-100 text-red-800" : // Reject, Error Zip, Error Meta
stat === "SCW07" ? "bg-purple-100 text-purple-800" : // Send for Eng Verification
stat === "SCW09" ? "bg-gray-100 text-gray-800" : // Cancelled
stat === "SCW00" ? "bg-orange-100 text-orange-800" : // Upload
"bg-gray-100 text-gray-800"; // Others
return (
<Badge variant="outline" className={color}>
{displayStatus}
</Badge>
);
},
size: 120,
},
{
accessorKey: "OWN_DOC_NO",
header: "OWN_DOC_NO",
cell: ({ row }) => (
<div className="font-mono text-sm">{row.original.OWN_DOC_NO || "-"}</div>
),
size: 250,
},
{
accessorKey: "FILE_NM",
header: "File Name",
cell: ({ row }) => (
<div className="max-w-md truncate" title={row.original.FILE_NM}>
{row.original.FILE_NM}
</div>
),
size: 300,
},
{
accessorKey: "STAGE",
header: "Stage",
cell: ({ row }) => {
const stage = row.original.STAGE;
if (!stage) return "-";
const color =
stage === "IFC" ? "bg-green-100 text-green-800" :
stage === "IFA" ? "bg-blue-100 text-blue-800" :
"bg-gray-100 text-gray-800";
return (
<Badge variant="outline" className={color}>
{stage}
</Badge>
);
},
size: 80,
},
{
accessorKey: "REV_NO",
header: "REV",
cell: ({ row }) => row.original.REV_NO || "-",
size: 80,
},
{
accessorKey: "ACTV_NO",
header: "Activity",
cell: ({ row }) => {
const actvNo = row.original.ACTV_NO;
if (!actvNo) return <span className="text-muted-foreground">-</span>;
return <div className="font-mono text-xs">{actvNo}</div>;
},
size: 120,
},
{
accessorKey: "FILE_SZ",
header: "File Size",
cell: ({ row }) => {
const size = row.original.FILE_SZ;
if (!size) return "-";
const bytes = parseInt(size);
if (isNaN(bytes)) return size;
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
},
size: 100,
},
{
accessorKey: "NOTE1",
header: "DC Note",
cell: ({ row }) => {
const note1 = row.original.NOTE1;
if (!note1) return <span className="text-muted-foreground">-</span>;
return (
<div className="max-w-md truncate" title={note1}>
{note1}
</div>
);
},
size: 200,
},
{
accessorKey: "CRTE_DTM",
header: "Created Date",
cell: ({ row }) => {
const date = row.original.CRTE_DTM;
if (!date) return "-";
try {
return new Date(date).toLocaleString("ko-KR", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
});
} catch {
return date;
}
},
size: 150,
},
];
|