summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-10-27 12:31:52 +0900
committerjoonhoekim <26rote@gmail.com>2025-10-27 12:31:52 +0900
commit2e92d5f83ae5f0f39090552b46c519982e9279c9 (patch)
tree6c32b55bc765f2a8ca7da86572fe3f9ca48a8893 /lib
parent9f761849c2e98f650d089d00aed9df090497ada9 (diff)
(김준회) SWP 컬럼조정 및 그에 따른 로직 변경, 결재로그 오류수정
Diffstat (limited to 'lib')
-rw-r--r--lib/approval-log/table/approval-log-table-column.tsx21
-rw-r--r--lib/swp/actions.ts3
-rw-r--r--lib/swp/table/swp-revision-list-dialog.tsx2
-rw-r--r--lib/swp/table/swp-table-columns.tsx46
4 files changed, 38 insertions, 34 deletions
diff --git a/lib/approval-log/table/approval-log-table-column.tsx b/lib/approval-log/table/approval-log-table-column.tsx
index 8b466c69..a77ed0d3 100644
--- a/lib/approval-log/table/approval-log-table-column.tsx
+++ b/lib/approval-log/table/approval-log-table-column.tsx
@@ -8,7 +8,6 @@ import { Checkbox } from "@/components/ui/checkbox"
import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
import { type ApprovalLog } from "../service"
import { formatDate } from "@/lib/utils"
-import { getApprovalStatusText } from "@/lib/knox-api/approval/approval"
import { MoreHorizontal, Eye } from "lucide-react"
import {
DropdownMenu,
@@ -88,7 +87,23 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<Approva
),
cell: ({ row }) => {
const status = row.getValue("status") as string;
- const statusText = getApprovalStatusText(status);
+
+ // 클라이언트 측에서 상태 텍스트 변환
+ const getStatusText = (status: string) => {
+ const statusMap: Record<string, string> = {
+ '-3': '암호화실패',
+ '-2': '암호화중',
+ '-1': '예약상신',
+ '0': '보류',
+ '1': '진행중',
+ '2': '완결',
+ '3': '반려',
+ '4': '상신취소',
+ '5': '전결',
+ '6': '후완결'
+ };
+ return statusMap[status] || '알 수 없음';
+ };
const getStatusVariant = (status: string) => {
switch (status) {
@@ -105,7 +120,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<Approva
return (
<div className="flex space-x-2">
<Badge variant={getStatusVariant(status)}>
- {statusText}
+ {getStatusText(status)}
</Badge>
</div>
)
diff --git a/lib/swp/actions.ts b/lib/swp/actions.ts
index f58793e2..1faa69db 100644
--- a/lib/swp/actions.ts
+++ b/lib/swp/actions.ts
@@ -39,6 +39,7 @@ export interface SwpDocumentWithStats {
CPY_NM: string | null;
LTST_REV_NO: string | null;
STAGE: string | null;
+ LTST_ACTV_STAT: string | null;
sync_status: "synced" | "pending" | "error";
last_synced_at: Date;
revision_count: number;
@@ -107,6 +108,7 @@ export async function fetchSwpDocuments(params: SwpTableParams) {
CPY_NM: swpDocuments.CPY_NM,
LTST_REV_NO: swpDocuments.LTST_REV_NO,
STAGE: swpDocuments.STAGE,
+ LTST_ACTV_STAT: swpDocuments.LTST_ACTV_STAT,
sync_status: swpDocuments.sync_status,
last_synced_at: swpDocuments.last_synced_at,
revision_count: sql<number>`COUNT(DISTINCT ${swpDocumentRevisions.id})::int`,
@@ -126,6 +128,7 @@ export async function fetchSwpDocuments(params: SwpTableParams) {
swpDocuments.CPY_NM,
swpDocuments.LTST_REV_NO,
swpDocuments.STAGE,
+ swpDocuments.LTST_ACTV_STAT,
swpDocuments.sync_status,
swpDocuments.last_synced_at
)
diff --git a/lib/swp/table/swp-revision-list-dialog.tsx b/lib/swp/table/swp-revision-list-dialog.tsx
index 74402bd9..8924db81 100644
--- a/lib/swp/table/swp-revision-list-dialog.tsx
+++ b/lib/swp/table/swp-revision-list-dialog.tsx
@@ -86,7 +86,7 @@ export function SwpRevisionListDialog({
)}
</div>
<div>
- <span className="text-sm font-semibold">최신 리비전:</span>
+ <span className="text-sm font-semibold">마지막 리비전 넘버:</span>
<div className="text-sm">{document.LTST_REV_NO || "-"}</div>
</div>
</div>
diff --git a/lib/swp/table/swp-table-columns.tsx b/lib/swp/table/swp-table-columns.tsx
index 573acf1b..9954ab73 100644
--- a/lib/swp/table/swp-table-columns.tsx
+++ b/lib/swp/table/swp-table-columns.tsx
@@ -40,7 +40,7 @@ export const swpDocumentColumns: ColumnDef<SwpDocumentWithStats>[] = [
accessorKey: "DOC_TITLE",
header: "문서제목",
cell: ({ row }) => (
- <div className="max-w-md truncate" title={row.original.DOC_TITLE}>
+ <div className="max-w-md" title={row.original.DOC_TITLE}>
{row.original.DOC_TITLE}
</div>
),
@@ -53,7 +53,7 @@ export const swpDocumentColumns: ColumnDef<SwpDocumentWithStats>[] = [
<div>
<div className="font-medium">{row.original.PROJ_NO}</div>
{row.original.PROJ_NM && (
- <div className="text-xs text-muted-foreground truncate max-w-[150px]">
+ <div className="text-xs text-muted-foreground max-w-[150px]">
{row.original.PROJ_NM}
</div>
)}
@@ -106,7 +106,7 @@ export const swpDocumentColumns: ColumnDef<SwpDocumentWithStats>[] = [
},
{
accessorKey: "LTST_REV_NO",
- header: "최신 REV",
+ header: "마지막 REV NO",
cell: ({ row }) => row.original.LTST_REV_NO || "-",
size: 80,
},
@@ -123,22 +123,26 @@ export const swpDocumentColumns: ColumnDef<SwpDocumentWithStats>[] = [
size: 100,
},
{
- accessorKey: "sync_status",
- header: "상태",
+ accessorKey: "LTST_ACTV_STAT",
+ header: "상태 (최신 액티비티)",
cell: ({ row }) => {
- const status = row.original.sync_status;
- const color =
- status === "synced" ? "bg-green-100 text-green-800" :
- status === "pending" ? "bg-yellow-100 text-yellow-800" :
- "bg-red-100 text-red-800";
-
+ const status = row.original.LTST_ACTV_STAT;
+ if (!status) return "-";
+
+ // 상태에 따른 색상 설정 (필요에 따라 조정 가능)
+ const color =
+ status === "Complete" ? "bg-green-100 text-green-800" :
+ status === "In Progress" ? "bg-blue-100 text-blue-800" :
+ status === "Pending" ? "bg-yellow-100 text-yellow-800" :
+ "bg-gray-100 text-gray-800";
+
return (
<Badge variant="outline" className={color}>
{status}
</Badge>
);
},
- size: 80,
+ size: 100,
},
{
accessorKey: "last_synced_at",
@@ -250,24 +254,6 @@ export const swpRevisionColumns: ColumnDef<RevisionRow>[] = [
size: 100,
},
{
- accessorKey: "sync_status",
- header: "상태",
- cell: ({ row }) => {
- const status = row.original.sync_status;
- const color =
- status === "synced" ? "bg-green-100 text-green-800" :
- status === "pending" ? "bg-yellow-100 text-yellow-800" :
- "bg-red-100 text-red-800";
-
- return (
- <Badge variant="outline" className={color}>
- {status}
- </Badge>
- );
- },
- size: 80,
- },
- {
accessorKey: "last_synced_at",
header: "동기화",
cell: ({ row }) => (