summaryrefslogtreecommitdiff
path: root/lib/vendor-document-list/table/enhanced-doc-table-columns.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor-document-list/table/enhanced-doc-table-columns.tsx')
-rw-r--r--lib/vendor-document-list/table/enhanced-doc-table-columns.tsx114
1 files changed, 103 insertions, 11 deletions
diff --git a/lib/vendor-document-list/table/enhanced-doc-table-columns.tsx b/lib/vendor-document-list/table/enhanced-doc-table-columns.tsx
index 534a80a0..c8487d82 100644
--- a/lib/vendor-document-list/table/enhanced-doc-table-columns.tsx
+++ b/lib/vendor-document-list/table/enhanced-doc-table-columns.tsx
@@ -30,7 +30,9 @@ import {
FileText,
Eye,
Edit,
- Trash2
+ Trash2,
+ Building,
+ Code
} from "lucide-react"
import { cn } from "@/lib/utils"
@@ -140,7 +142,11 @@ export function getUpdatedEnhancedColumns({
setRowAction,
projectType
}: GetColumnsProps): ColumnDef<EnhancedDocumentsView>[] {
- return [
+ const isPlantProject = projectType === "plant"
+
+
+ // 기본 컬럼들
+ const baseColumns: ColumnDef<EnhancedDocumentsView>[] = [
// 체크박스 선택
{
id: "select",
@@ -177,13 +183,8 @@ export function getUpdatedEnhancedColumns({
cell: ({ row }) => {
const doc = row.original
return (
- <div className="flex flex-col gap-1 items-start"> {/* ✅ items-start 추가 */}
+ <div className="flex flex-col gap-1 items-start">
<span className="font-mono text-sm font-medium">{doc.docNumber}</span>
- {/* {doc.currentStagePriority && (
- <Badge variant={getPriorityColor(doc.currentStagePriority)} className="self-start inline-flex w-auto shrink-0 whitespace-nowrap text-xs" >
- {getPriorityText(doc.currentStagePriority)}
- </Badge>
- )} */}
</div>
)
},
@@ -193,7 +194,93 @@ export function getUpdatedEnhancedColumns({
excelHeader: "문서번호"
},
},
+ ]
+ // ✅ Ship 프로젝트용 추가 컬럼들
+ const plantColumns: ColumnDef<EnhancedDocumentsView>[] = isPlantProject ? [
+ // 벤더 문서번호
+ {
+ accessorKey: "vendorDocNumber",
+ header: ({ column }) => (
+ <DataTableColumnHeaderSimple column={column} title="벤더 문서번호" />
+ ),
+ cell: ({ row }) => {
+ const doc = row.original
+ return (
+ <div className="flex flex-col gap-1 items-start">
+ {doc.vendorDocNumber ? (
+ <span className="font-mono text-sm text-blue-600">{doc.vendorDocNumber}</span>
+ ) : (
+ <span className="text-gray-400 text-sm">-</span>
+ )}
+ </div>
+ )
+ },
+ size: 120,
+ enableResizing: true,
+ meta: {
+ excelHeader: "벤더 문서번호"
+ },
+ },
+
+ // 프로젝트 코드
+ {
+ accessorKey: "projectCode",
+ header: ({ column }) => (
+ <DataTableColumnHeaderSimple column={column} title="프로젝트" />
+ ),
+ cell: ({ row }) => {
+ const doc = row.original
+ return (
+ <div className="flex items-center gap-2">
+ {/* <Code className="w-4 h-4 text-gray-500" /> */}
+ <span className="font-mono text-sm font-medium text-gray-700">
+ {doc.projectCode || '-'}
+ </span>
+ </div>
+ )
+ },
+ size: 100,
+ enableResizing: true,
+ meta: {
+ excelHeader: "프로젝트 코드"
+ },
+ },
+
+ // 벤더 정보
+ {
+ accessorKey: "vendorName",
+ header: ({ column }) => (
+ <DataTableColumnHeaderSimple column={column} title="벤더" />
+ ),
+ cell: ({ row }) => {
+ const doc = row.original
+ return (
+ <div className="flex flex-col gap-1 items-start">
+ <div className="flex items-center gap-2">
+ {/* <Building className="w-4 h-4 text-gray-500" /> */}
+ <span className="text-sm font-medium text-gray-900">
+ {doc.vendorName || '-'}
+ </span>
+ </div>
+ {doc.vendorCode && (
+ <span className="text-xs font-mono text-gray-500 bg-gray-100 px-2 py-0.5 rounded">
+ {doc.vendorCode}
+ </span>
+ )}
+ </div>
+ )
+ },
+ size: 150,
+ enableResizing: true,
+ meta: {
+ excelHeader: "벤더명"
+ },
+ },
+ ] : []
+
+ // 나머지 공통 컬럼들
+ const commonColumns: ColumnDef<EnhancedDocumentsView>[] = [
// 문서명 + 담당자
{
accessorKey: "title",
@@ -223,7 +310,7 @@ export function getUpdatedEnhancedColumns({
</div>
)
},
- size: 250,
+ size: isPlantProject ? 200 : 250, // Ship 프로젝트일 때는 너비 조정
enableResizing: true,
meta: {
excelHeader: "문서명"
@@ -341,7 +428,6 @@ export function getUpdatedEnhancedColumns({
return (
<div className="flex flex-col gap-1 items-start">
<span className="font-mono text-sm font-medium">{doc.latestRevision}</span>
- {/* <div className="text-xs text-gray-500">{doc.latestRevisionUploaderName}</div> */}
{doc.latestRevisionStatus && (
<Badge variant={getStatusColor(doc.latestRevisionStatus)} className="self-start inline-flex w-auto shrink-0 whitespace-nowrap text-xs" >
{getStatusText(doc.latestRevisionStatus)}
@@ -381,7 +467,6 @@ export function getUpdatedEnhancedColumns({
},
// 액션 메뉴
- // 액션 메뉴
{
id: "actions",
enableHiding: false,
@@ -532,6 +617,13 @@ export function getUpdatedEnhancedColumns({
size: 40,
}
]
+
+ // ✅ 모든 컬럼을 순서대로 결합
+ return [
+ ...baseColumns, // 체크박스, 문서번호
+ ...plantColumns, // Ship 전용 컬럼들 (조건부)
+ ...commonColumns // 나머지 공통 컬럼들
+ ]
}
// 확장된 행 컨텐츠 컴포넌트 (업데이트된 버전)