diff options
Diffstat (limited to 'lib/basic-contract/vendor-table')
| -rw-r--r-- | lib/basic-contract/vendor-table/basic-contract-columns.tsx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/basic-contract/vendor-table/basic-contract-columns.tsx b/lib/basic-contract/vendor-table/basic-contract-columns.tsx index 1b11285c..c8af2e02 100644 --- a/lib/basic-contract/vendor-table/basic-contract-columns.tsx +++ b/lib/basic-contract/vendor-table/basic-contract-columns.tsx @@ -241,6 +241,57 @@ export function getColumns({ setRowAction, locale = 'ko', t }: GetColumnsProps): groupMap[groupName].push(childCol) }) + const contractTypeColumn: ColumnDef<BasicContractView> = { + id: "contractType", + accessorFn: (row) => { + // 계약 유형 판별 로직 + if (row.generalContractId) return "contract"; + if (row.rfqCompanyId) return "quotation"; + if (row.biddingCompanyId) return "bidding"; + return "general"; + }, + header: ({ column }) => ( + <DataTableColumnHeaderSimple + column={column} + title={locale === 'ko' ? "계약 소스" : "Contract Source"} + /> + ), + cell: ({ getValue }) => { + const type = getValue() as string; + + // 타입별 표시 텍스트와 스타일 정의 + const typeConfig = { + general: { + label: locale === 'ko' ? '일반' : 'General', + variant: 'outline' as const + }, + quotation: { + label: locale === 'ko' ? '견적' : 'Quotation', + variant: 'secondary' as const + }, + contract: { + label: locale === 'ko' ? '계약' : 'Contract', + variant: 'default' as const + }, + bidding: { + label: locale === 'ko' ? '입찰' : 'Bidding', + variant: 'destructive' as const + } + }; + + const config = typeConfig[type as keyof typeof typeConfig] || typeConfig.general; + + return ( + <Badge variant={config.variant}> + {config.label} + </Badge> + ); + }, + enableSorting: true, + enableHiding: true, + minSize: 80, + }; + // ---------------------------------------------------------------- // 4-2) groupMap에서 실제 상위 컬럼(그룹)을 만들기 // ---------------------------------------------------------------- @@ -269,6 +320,7 @@ export function getColumns({ setRowAction, locale = 'ko', t }: GetColumnsProps): return [ selectColumn, downloadColumn, // 다운로드 컬럼 추가 + contractTypeColumn, ...nestedColumns, ] }
\ No newline at end of file |
